aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-10-04 18:05:33 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-10-10 23:16:14 +0100
commit6f0ee01f37029c0fdabd161646b8dbbdec676165 (patch)
treeffd43cc0f02a6dd7cda3afc607a64e0de3a85a5c
parent328e1933d1ada8b99bc69c15c7cdb01f3ce04a1d (diff)
Upgrade commonlib to read in config as Unicode.
This means variables do not need decoding in a few places.
m---------commonlib0
-rw-r--r--perllib/FixMyStreet.pm5
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm6
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm1
-rw-r--r--perllib/FixMyStreet/TestAppProve.pm4
-rw-r--r--templates/web/base/admin/config_page.html2
6 files changed, 7 insertions, 11 deletions
diff --git a/commonlib b/commonlib
-Subproject b9fdb8ee6614adbe858891afd09da1c6079a66c
+Subproject 35699070f4d889c4aa8d4e472bacd15eeef3212
diff --git a/perllib/FixMyStreet.pm b/perllib/FixMyStreet.pm
index 7ee497584..b30f59472 100644
--- a/perllib/FixMyStreet.pm
+++ b/perllib/FixMyStreet.pm
@@ -12,7 +12,7 @@ use Sub::Override;
use mySociety::Config;
-my $CONF_FILE = $ENV{FMS_OVERRIDE_CONFIG} || 'general';
+my $CONF_FILE = $ENV{FMS_OVERRIDE_CONFIG} || 'general.yml';
# load the config file and store the contents in a readonly hash
mySociety::Config::set_file( __PACKAGE__->path_to("conf/${CONF_FILE}") );
@@ -108,8 +108,7 @@ sub override_config($&) {
my ($class, $key) = @_;
return { %CONFIG, %$config } unless $key;
return $config->{$key} if exists $config->{$key};
- my $orig_config = mySociety::Config::load_default();
- return $orig_config->{$key} if exists $orig_config->{$key};
+ return $CONFIG{$key} if exists $CONFIG{$key};
}
);
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index 1258c8bca..b482d7612 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -7,7 +7,6 @@ use FixMyStreet;
use FixMyStreet::DB;
use FixMyStreet::Geocode::Bing;
use DateTime;
-use Encode;
use List::MoreUtils 'none';
use URI;
use Digest::MD5 qw(md5_hex);
@@ -897,9 +896,8 @@ sub _fallback_body_sender {
};
sub example_places {
- my $e = FixMyStreet->config('EXAMPLE_PLACES') || [ 'High Street', 'Main Street' ];
- $e = [ map { Encode::decode('UTF-8', $_) } @$e ];
- return $e;
+ # uncoverable branch true
+ FixMyStreet->config('EXAMPLE_PLACES') || [ 'High Street', 'Main Street' ];
}
=head2 title_list
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index de4a5262a..4dc95b178 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -994,7 +994,6 @@ sub _admin_send_email {
my $sender = FixMyStreet->config('DO_NOT_REPLY_EMAIL');
my $sender_name = $c->cobrand->contact_name;
- utf8::decode($sender_name) unless utf8::is_utf8($sender_name);
$c->send_email( $template, {
to => [ $to ],
diff --git a/perllib/FixMyStreet/TestAppProve.pm b/perllib/FixMyStreet/TestAppProve.pm
index 7a387547d..d549b0148 100644
--- a/perllib/FixMyStreet/TestAppProve.pm
+++ b/perllib/FixMyStreet/TestAppProve.pm
@@ -86,8 +86,8 @@ sub run {
$config->{FMS_DB_PASS} = '';
}
- my $config_out = "general-test-autogenerated.$$";
- path("conf/$config_out.yml")->spew( YAML::Dump($config) );
+ my $config_out = "general-test-autogenerated.$$.yml";
+ path("conf/$config_out")->spew( YAML::Dump($config) );
local $ENV{FMS_OVERRIDE_CONFIG} = $config_out;
diff --git a/templates/web/base/admin/config_page.html b/templates/web/base/admin/config_page.html
index 87032b0b6..d448d2a63 100644
--- a/templates/web/base/admin/config_page.html
+++ b/templates/web/base/admin/config_page.html
@@ -55,7 +55,7 @@ running version <strong>[% git_version || 'unknown' %]</strong>.
</tr>
[% INCLUDE with_cobrand value="MAP_TYPE" cob=c.cobrand.map_type %]
[% INCLUDE with_cobrand value="EXAMPLE_PLACES"
- conf = decode(c.config.EXAMPLE_PLACES.join(', '))
+ conf = c.config.EXAMPLE_PLACES.join(', ')
cob = c.cobrand.example_places %]
[% INCLUDE with_cobrand value="LANGUAGES"
cob = c.cobrand.languages %]