aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatthew <matthew>2009-12-15 15:54:37 +0000
committermatthew <matthew>2009-12-15 15:54:37 +0000
commit75e0301c9350ec965d0d0b0516e879f6ee0c7daa (patch)
tree8ffff0a0fa06b6ecf0731a07063f36e69de0fa13
parent8c5a9dbccdb14ac63e4686d4468274308b285ec8 (diff)
Couple of extra checks for if cobrand has the function.
-rw-r--r--perllib/Cobrand.pm18
1 files changed, 8 insertions, 10 deletions
diff --git a/perllib/Cobrand.pm b/perllib/Cobrand.pm
index 1541f97f4..a781b1db0 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.52 2009-12-15 14:55:52 louise Exp $
+# $Id: Cobrand.pm,v 1.53 2009-12-15 15:54:37 matthew Exp $
package Cobrand;
use strict;
@@ -59,7 +59,7 @@ sub site_restriction {
my $site_restriction = '';
my $site_id = 0;
my $handle = cobrand_handle($cobrand);
- return ($site_restriction, $site_id) unless $handle;
+ return ($site_restriction, $site_id) unless $handle && $handle->can('site_restriction');
return $handle->site_restriction($cobrand_data);
}
@@ -242,17 +242,15 @@ Set the language and domain of the site based on the cobrand and host
=cut
sub set_lang_and_domain($$;$) {
- my ($cobrand, $lang, $unicode) = @_;
- if ($cobrand){
- my $handle = cobrand_handle($cobrand);
- if ($handle){
- $handle->set_lang_and_domain($lang, $unicode);
- }
- }else{
+ my ($cobrand, $lang, $unicode) = @_;
+ my $handle;
+ if ($cobrand && ($handle = cobrand_handle($cobrand)) && $handle->can('set_lang_and_domain')) {
+ $handle->set_lang_and_domain($lang, $unicode);
+ } else {
mySociety::Locale::negotiate_language('en-gb,English,en_GB|nb,Norwegian,nb_NO', $lang); # XXX Testing
mySociety::Locale::gettext_domain('FixMyStreet', $unicode);
mySociety::Locale::change();
- }
+ }
}
=item recent_photos COBRAND N [EASTING NORTHING DISTANCE]