aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlouise <louise>2009-12-09 13:34:35 +0000
committerlouise <louise>2009-12-09 13:34:35 +0000
commitf64dd76a0ee8b35d02232181e13ea2ede7cf2cea (patch)
tree745082016e1992b447973fad1788606829e3ee88
parent9b2cb2c40d8489149c3d013690278a61d7de8e9e (diff)
Allow cobrands to perform a check on geocoded string locations
-rw-r--r--perllib/Cobrand.pm20
-rwxr-xr-xt/Page.t3
2 files changed, 21 insertions, 2 deletions
diff --git a/perllib/Cobrand.pm b/perllib/Cobrand.pm
index d225fdb8e..18704ed9a 100644
--- a/perllib/Cobrand.pm
+++ b/perllib/Cobrand.pm
@@ -7,7 +7,7 @@
# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
# Email: louise@mysociety.org. WWW: http://www.mysociety.org
#
-# $Id: Cobrand.pm,v 1.49 2009-12-08 17:43:13 louise Exp $
+# $Id: Cobrand.pm,v 1.50 2009-12-09 13:34:35 louise Exp $
package Cobrand;
use strict;
@@ -728,6 +728,24 @@ sub allow_update_reporting {
}
+=item geocoded_string_check LOCATION QUERY
+
+Return a boolean indicating whether the string LOCATION passes the cobrands
+checks.
+
+=cut
+sub geocoded_string_check {
+ my ($cobrand, $location, $query) = @_;
+ my $handle;
+ if ($cobrand){
+ $handle = cobrand_handle($cobrand);
+ }
+ if ( !$cobrand || !$handle || !$handle->can('geocoded_string_check')){
+ return 1;
+ } else{
+ return $handle->geocoded_string_check($location, $query);
+ }
+}
=item council_check COBRAND COUNCILS QUERY
diff --git a/t/Page.t b/t/Page.t
index 77e48e809..4d5d93fbf 100755
--- a/t/Page.t
+++ b/t/Page.t
@@ -6,7 +6,7 @@
# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
# Email: louise@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: Page.t,v 1.11 2009-11-18 16:57:40 louise Exp $
+# $Id: Page.t,v 1.12 2009-12-09 13:34:36 louise Exp $
#
use strict;
@@ -49,6 +49,7 @@ sub test_geocode_string() {
# expect a failure message for Northern Ireland
($x, $y, $easting, $northing, $error) = Page::geocode_string('Falls Road, Belfast', $q);
ok($error eq "We do not cover Northern Ireland, I'm afraid, as our licence doesn't include any maps for the region.", 'error message produced for NI location') or diag("Got $error");
+
}
sub test_header() {