aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdmund von der Burg <evdb@mysociety.org>2011-04-14 17:45:00 +0100
committerEdmund von der Burg <evdb@mysociety.org>2011-04-14 17:45:00 +0100
commit5d9ae3dba11fc6c72935a3c6bb34d20d6dabec04 (patch)
tree61fd4340c256e76bbd8247bec0d6985da0c1b61d
parent8c9570ed848af6a2967e6dbb5232a3a444b7e399 (diff)
Replace all $c->req with s->fake_q so that we isolate the old setup
-rw-r--r--perllib/FixMyStreet/App.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/Around.pm6
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm4
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm12
4 files changed, 12 insertions, 12 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index 8a93e4501..cf0157ab4 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -123,7 +123,7 @@ sub _get_cobrand {
? FixMyStreet::Cobrand->get_class_for_moniker($override_moniker)
: FixMyStreet::Cobrand->get_class_for_host($host);
- return $cobrand_class->new( { request => $c->req } );
+ return $cobrand_class->new( { request => $c->req, fake_q => $c->fake_q, } );
}
=head2 setup_request
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm
index 09f015055..19b2dbaf7 100644
--- a/perllib/FixMyStreet/App/Controller/Around.pm
+++ b/perllib/FixMyStreet/App/Controller/Around.pm
@@ -144,7 +144,7 @@ sub display_location : Private {
# get the map features
my ( $on_map_all, $on_map, $around_map, $distance ) =
- FixMyStreet::Map::map_features( $c->req, $latitude, $longitude,
+ FixMyStreet::Map::map_features( $c->fake_q, $latitude, $longitude,
$interval );
# copy the found reports to the stash
@@ -188,7 +188,7 @@ sub display_location : Private {
$map_links .= "</p>";
$c->stash->{map_html} = FixMyStreet::Map::display_map(
- $c->req,
+ $c->fake_q,
latitude => $latitude,
longitude => $longitude,
type => 1,
@@ -249,7 +249,7 @@ sub determine_location_from_pc : Private {
$c->stash->{pc} = $pc; # for template
my ( $latitude, $longitude, $error ) =
- eval { FixMyStreet::Geocode::lookup( $pc, $c->req ) };
+ eval { FixMyStreet::Geocode::lookup( $pc, $c->fake_q ) };
# Check that nothing blew up
if ($@) {
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index f5def5d96..b21596ef1 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -419,7 +419,7 @@ sub determine_location_from_tile_click : Private {
# convert the click to lat and lng
my ( $latitude, $longitude ) = FixMyStreet::Map::click_to_wgs84( #
- $c->req, #
+ $c->fake_q, #
$pin_tile_x, $pin_x, $pin_tile_y, $pin_y
);
@@ -1046,7 +1046,7 @@ END_MAP_HTML
my $map_type = $allow_photo_upload ? 2 : 1;
$c->stash->{map_html} = FixMyStreet::Map::display_map(
- $c->req,
+ $c->fake_q,
latitude => $latitude,
longitude => $longitude,
type => $map_type,
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index 2a4bfa243..14f8f6ba3 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -10,7 +10,7 @@ use Carp;
=head2 new
my $cobrand = $class->new;
- my $cobrand = $class->new( { request => $c->req } );
+ my $cobrand = $class->new( { request => $c->req, fake_q => $c->fake_q } );
Create a new cobrand object, optionally setting the web request.
@@ -54,9 +54,9 @@ sub is_default {
return $self->moniker eq 'default';
}
-=head2 q
+=head2 fake_q
- $request = $cobrand->q;
+ $fake_q = $cobrand->fake_q;
Often the cobrand needs access to the request so we add it at the start by
passing it to ->new. If the request has not been set and you call this (or a
@@ -65,10 +65,10 @@ use a request-related method out of a request-context.
=cut
-sub q {
+sub fake_q {
my $self = shift;
- return $self->{request}
- || croak "No request has been set"
+ return $self->{fake_q}
+ || croak "No fake_q has been set"
. " - should you be calling this method outside of a web request?";
}