You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 12 години
преди 11 години
преди 12 години
преди 11 години
преди 12 години
преди 12 години
преди 12 години
преди 12 години
преди 12 години
преди 12 години
преди 12 години
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
  2. # MIT License. See license.txt
  3. from __future__ import unicode_literals
  4. import webnotes
  5. import os, urllib
  6. from webnotes.utils import escape_html, get_request_site_address, now, cstr
  7. no_cache = 1
  8. base_template_path = "templates/pages/rss.xml"
  9. def get_context(context):
  10. """generate rss feed"""
  11. host = get_request_site_address()
  12. blog_list = webnotes.conn.sql("""\
  13. select page_name as name, published_on, modified, title, content from `tabBlog Post`
  14. where ifnull(published,0)=1
  15. order by published_on desc limit 20""", as_dict=1)
  16. for blog in blog_list:
  17. blog_page = cstr(urllib.quote(blog.name.encode("utf-8"))) + ".html"
  18. blog.link = urllib.basejoin(host, blog_page)
  19. blog.content = escape_html(blog.content or "")
  20. if blog_list:
  21. modified = max((blog['modified'] for blog in blog_list))
  22. else:
  23. modified = now()
  24. ws = webnotes.doc('Website Settings', 'Website Settings')
  25. context = {
  26. 'title': ws.title_prefix,
  27. 'description': ws.description or ((ws.title_prefix or "") + ' Blog'),
  28. 'modified': modified,
  29. 'items': blog_list,
  30. 'link': host + '/blog'
  31. }
  32. # print context
  33. return context