Personal wiki notebook (not under development)

Forum_rss.py 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import cgi
  2. import os.path
  3. import cherrypy
  4. from Rss_channel import Rss_channel
  5. from Rss_item import Rss_item
  6. class Forum_rss( Rss_channel ):
  7. def __init__(
  8. self,
  9. user,
  10. notebooks,
  11. first_notebook,
  12. login_url,
  13. logout_url,
  14. rate_plan,
  15. groups,
  16. forum_name,
  17. threads,
  18. total_thread_count,
  19. start = 0,
  20. count = None,
  21. ):
  22. forum_path = cherrypy.request.base + cherrypy.request.path
  23. if forum_name == u"blog":
  24. full_forum_name = u"Luminotes %s" % forum_name
  25. else:
  26. full_forum_name = u"%s forum" % forum_name
  27. Rss_channel.__init__(
  28. self,
  29. full_forum_name,
  30. forum_path,
  31. full_forum_name,
  32. [ Rss_item(
  33. title = cgi.escape( thread.name ),
  34. link = os.path.join( forum_path, ( forum_name == u"blog" ) and thread.friendly_id or thread.object_id ),
  35. description = cgi.escape( thread.name ),
  36. date = thread.revision.strftime( "%Y-%m-%dT%H:%M:%SZ" ),
  37. guid = os.path.join( forum_path, ( forum_name == u"blog" ) and thread.friendly_id or thread.object_id ),
  38. ) for thread in threads ],
  39. )