aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/general_controller.rb
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-01-17 13:09:00 +0000
committerRobin Houston <robin.houston@gmail.com>2012-01-17 13:09:00 +0000
commit80e56fde3b4bdb9d2483a7c858960a6d2bd964e0 (patch)
tree09742b72b053f6623954baefd13a0a9e32bfeb5f /app/controllers/general_controller.rb
parentbae21e38242aac2c5843bae5ea5fe3b09408a4f9 (diff)
parentba7310b580b2b03068568497c02eae7cbcd2d901 (diff)
Merge branch 'release/0.5' into wdtk
Diffstat (limited to 'app/controllers/general_controller.rb')
-rw-r--r--app/controllers/general_controller.rb15
1 files changed, 8 insertions, 7 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 6cdfb9d5f..d28f4deec 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -71,14 +71,15 @@ class GeneralController < ApplicationController
medium_cache
@feed_autodetect = []
@feed_url = "#{MySociety::Config.get('BLOG_FEED', '')}?lang=#{self.locale_from_params()}"
+ @blog_items = []
if not @feed_url.empty?
- content = open(@feed_url).read
- @data = XmlSimple.xml_in(content)
- @channel = @data['channel'][0]
- @blog_items = @channel['item']
- @feed_autodetect = [{:url => @feed_url, :title => "#{site_name} blog"}]
- else
- @blog_items = []
+ content = quietly_try_to_open(@feed_url)
+ if !content.empty?
+ @data = XmlSimple.xml_in(content)
+ @channel = @data['channel'][0]
+ @blog_items = @channel['item']
+ @feed_autodetect = [{:url => @feed_url, :title => "#{site_name} blog"}]
+ end
end
@twitter_user = MySociety::Config.get('TWITTER_USERNAME', '')
end