Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' into release

  • Loading branch information...
commit ae9601edcb1b14a656fc9e5bf0351fa080c43967 2 parents 00ac2d8 + aed6f54
@davorg authored
View
9 PoliticalWeb/lib/PoliticalWeb/Constituency.pm
@@ -40,7 +40,7 @@ sub name_from_postcode {
my $constit = from_json(encode('utf8', decode('iso-8859-1', $ret->{results})));
# debug Dumper $constit;
return if $constit->{error};
- cache_set 'C:' . $constit->{name}, $constit, 60*60*60;
+ # cache_set 'C:' . $constit->{name}, $constit, 60*60*60;
return $constit->{name};
}
@@ -64,7 +64,9 @@ sub new_from_name {
}
sub _get_from_cache {
- return cache_get "C:$_[0]";
+ my $name = shift;
+ $name =~ s/\s+/+/g;
+ return cache_get "C:$name";
}
sub _get_from_twfy {
@@ -80,7 +82,8 @@ sub _get_from_twfy {
if ($ret->{is_success}) {
my $con = from_json(encode('utf8', $ret->{results}));
return if $con->{error};
- # debug "Setting cache key - 'C:$_[0]'";
+ $name =~ s/\s+/+/g;
+ debug "Setting cache key - 'C:$name'";
# debug 'Setting cache val - ' . Dumper(from_json(encode('utf8', $ret->{results})));
cache_set "C:$name", $con, 60*60*60;
} else {
View
5 PoliticalWeb/lib/PoliticalWeb/Mp.pm
@@ -39,7 +39,9 @@ sub new_from_constituency_name {
}
sub _get_from_cache {
- return cache_get "M:$_[0]";
+ my $name = shift;
+ $name =~ s/\s+/+/g;
+ return cache_get "M:$name";
}
sub _get_from_twfy {
@@ -66,6 +68,7 @@ sub _get_from_twfy {
$mp->{extra} = from_json(encode('utf8', decode('iso-8859-1', $ret->{results})));
}
+ $constit_name =~ s/\s+/+/g;
cache_set "M:$constit_name", $mp, 60*60*60;
} else {
return;
Please sign in to comment.
Something went wrong with that request. Please try again.