- Made Weather Data asset more fault tollerant.

- Made CS related upgrades more fault tollerant.
 - Enhanced HTTP caching directives.
This commit is contained in:
JT Smith 2007-03-07 19:12:37 +00:00
parent 9031a17c35
commit 3a8bd77cde
6 changed files with 58 additions and 32 deletions

View file

@ -792,7 +792,12 @@ select sum(Post.rating) from Post
EOSQL
my ($sum) = $self->session->db->quickArray($ratingSumSQL, [$self->getId]);
$self->update({threadRating=>$sum});
$self->getParent->recalculateRating;
my $parent = $self->getParent;
if (defined $parent) {
$parent->recalculateRating;
} else {
$self->session->errorHandler->error("Couldn't get parent for thread ".$self->getId);
}
}

View file

@ -190,23 +190,26 @@ to be displayed within the page style
sub view {
my $self = shift;
my %var;
foreach my $location (split("\n", $self->get("locations"))) {
my $weather = Weather::Com::Simple->new({
'partner_id' => $self->get("partnerId"),
'license' => $self->get("licenseKey"),
'place' => $location,
'cache' => '/tmp',
});
foreach my $foundLocation (@{$weather->get_weather}) {
push(@{$var{'ourLocations.loop'}}, {
query => $location,
cityState => $foundLocation->{place} || $location,
sky => $foundLocation->{conditions} || 'N/A',
tempF => $foundLocation->{temperature_fahrenheit} || 'N/A',
tempC => $foundLocation->{temperature_celsius} || 'N/A',
iconUrl => $self->session->url->extras("wobject/WeatherData/".$self->_chooseWeatherConditionsIcon($foundLocation->{conditions}).'.jpg'),
iconAlt => $foundLocation->{conditions},
});
if ($self->get("partnerId") ne "" && $self->get("licenseKey") ne "") {
foreach my $location (split("\n", $self->get("locations"))) {
my $weather = Weather::Com::Simple->new({
'partner_id' => $self->get("partnerId"),
'license' => $self->get("licenseKey"),
'place' => $location,
'cache' => '/tmp',
});
next unless defined $weather;
foreach my $foundLocation (@{$weather->get_weather}) {
push(@{$var{'ourLocations.loop'}}, {
query => $location,
cityState => $foundLocation->{place} || $location,
sky => $foundLocation->{conditions} || 'N/A',
tempF => $foundLocation->{temperature_fahrenheit} || 'N/A',
tempC => $foundLocation->{temperature_celsius} || 'N/A',
iconUrl => $self->session->url->extras("wobject/WeatherData/".$self->_chooseWeatherConditionsIcon($foundLocation->{conditions}).'.jpg'),
iconAlt => $foundLocation->{conditions},
});
}
}
}
return $self->processTemplate(\%var, undef, $self->{_viewTemplate});