diff options
-rw-r--r-- | quoins/controllers.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/quoins/controllers.py b/quoins/controllers.py index ac3cef7..6aac7a2 100644 --- a/quoins/controllers.py +++ b/quoins/controllers.py | |||
@@ -217,6 +217,9 @@ class Feed(TGController): | |||
217 | 217 | ||
218 | @expose(content_type='application/atom+xml') | 218 | @expose(content_type='application/atom+xml') |
219 | def atom1_0(self, **kw): | 219 | def atom1_0(self, **kw): |
220 | # fix for http://trac.turbogears.org/ticket/2351 | ||
221 | if request.headers.get('Accept', '') == 'text/html': | ||
222 | abort(500, "This page returns application/atom+xml, please set your Accept header appropriately.") | ||
220 | info = self.get_feed_data(**kw) | 223 | info = self.get_feed_data(**kw) |
221 | feed = Atom1Feed( | 224 | feed = Atom1Feed( |
222 | title=info['title'], | 225 | title=info['title'], |
@@ -236,6 +239,9 @@ class Feed(TGController): | |||
236 | 239 | ||
237 | @expose(content_type='application/rss+xml') | 240 | @expose(content_type='application/rss+xml') |
238 | def rss2_0(self, **kw): | 241 | def rss2_0(self, **kw): |
242 | # fix for http://trac.turbogears.org/ticket/2351 | ||
243 | if request.headers.get('Accept', '') == 'text/html': | ||
244 | abort(500, "This page returns application/rss+xml, please set your Accept header appropriately.") | ||
239 | info = self.get_feed_data(**kw) | 245 | info = self.get_feed_data(**kw) |
240 | feed = Rss201rev2Feed( | 246 | feed = Rss201rev2Feed( |
241 | title=info['title'], | 247 | title=info['title'], |
@@ -261,6 +267,9 @@ class Pingback(TGController): | |||
261 | 267 | ||
262 | @expose(content_type='text/xml') | 268 | @expose(content_type='text/xml') |
263 | def index(self): | 269 | def index(self): |
270 | # fix for http://trac.turbogears.org/ticket/2351 | ||
271 | if request.headers.get('Accept', '') == 'text/html': | ||
272 | abort(500, "This page returns text/xml, please set your Accept header appropriately.") | ||
264 | try: | 273 | try: |
265 | params, method = xmlrpclib.loads(request.body) | 274 | params, method = xmlrpclib.loads(request.body) |
266 | log.debug('Pingback method: %s' % method) | 275 | log.debug('Pingback method: %s' % method) |
@@ -501,7 +510,6 @@ Comment: | |||
501 | def post(self, id): | 510 | def post(self, id): |
502 | post = DBSession.query(Post).get(id) | 511 | post = DBSession.query(Post).get(id) |
503 | if not post: abort(404) | 512 | if not post: abort(404) |
504 | print pylons.request.headers | ||
505 | pylons.response.headers['X-Pingback']=self.absolute_url('/pingback/') | 513 | pylons.response.headers['X-Pingback']=self.absolute_url('/pingback/') |
506 | return dict(quoins = self, | 514 | return dict(quoins = self, |
507 | blog = post.blog, | 515 | blog = post.blog, |