Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

35 righe
886 B

  1. import webnotes
  2. import os, urllib
  3. from webnotes.utils import escape_html, get_request_site_address
  4. no_cache = True
  5. def get_context():
  6. """generate rss feed"""
  7. host = get_request_site_address()
  8. blog_list = webnotes.conn.sql("""\
  9. select page_name as name, published_on, modified, title, content from `tabBlog Post`
  10. where ifnull(published,0)=1
  11. order by published_on desc limit 20""", as_dict=1)
  12. for blog in blog_list:
  13. blog.link = urllib.quote(host + '/' + blog.name + '.html')
  14. blog.content = escape_html(blog.content or "")
  15. modified = max((blog['modified'] for blog in blog_list))
  16. ws = webnotes.doc('Website Settings', 'Website Settings')
  17. context = {
  18. 'title': ws.title_prefix,
  19. 'description': ws.description or ((ws.title_prefix or "") + ' Blog'),
  20. 'modified': modified,
  21. 'items': blog_list,
  22. 'link': host + '/blog'
  23. }
  24. print context
  25. return context