generic.rss 631 B

1234567891011121314151617181920
  1. {{
  2. ###
  3. # response._vars contains the dictionary returned by the controller action
  4. # for this to work the action must return something like
  5. #
  6. # dict(title=...,link=...,description=...,created_on='...',items=...)
  7. #
  8. # items is a list of dictionaries each with title, link, description, pub_date.
  9. ###
  10. try:
  11. from gluon.serializers import rss
  12. response.write(rss(response._vars), escape=False)
  13. response.headers['Content-Type'] = 'application/rss+xml'
  14. except (TypeError, ValueError):
  15. raise HTTP(405, 'RSS serialization error')
  16. except ImportError:
  17. raise HTTP(405, 'RSS not available')
  18. except:
  19. raise HTTP(405, 'RSS error')
  20. }}