def get_context(context):
 host = get_request_site_address()
 blog_list = frappe.db.sql(u' DCTB  DCTB select route as name, published_on, modified, title, content from `tabBlog Post`\n DCTB  DCTB where ifnull(published,0)=1\n DCTB  DCTB order by published_on desc limit 20', as_dict=1)
 for blog in blog_list:
  blog_page = cstr(urllib.quote(blog.route.encode(u'utf-8')))
  blog.link = urllib.basejoin(host, blog_page)
  blog.content = escape_html((blog.content or u''))
 if blog_list:
  modified = max((blog[u'modified'] for blog in blog_list))
 else:
  modified = now()
 blog_settings = frappe.get_doc(u'Blog Settings', u'Blog Settings')
 context = {u'title': (blog_settings.blog_title or u'Blog'), u'description': (blog_settings.blog_introduction or u''), u'modified': modified, u'items': blog_list, u'link': (host + u'/blog')}
 return context

def get_context ( context ) : host = get_request_site_address ( ) blog_list = frappe . db . sql ( u' DCTB  DCTB select route as name, published_on, modified, title, content from `tabBlog Post`\n DCTB  DCTB where ifnull(published,0)=1\n DCTB  DCTB order by published_on desc limit 20' , as_dict = 1 ) for blog in blog_list : blog_page = cstr ( urllib . quote ( blog . route . encode ( u'utf-8' ) ) ) blog . link = urllib . basejoin ( host , blog_page ) blog . content = escape_html ( ( blog . content or u'' ) ) if blog_list : modified = max ( ( blog [ u'modified' ] for blog in blog_list ) ) else : modified = now ( ) blog_settings = frappe . get_doc ( u'Blog Settings' , u'Blog Settings' ) context = { u'title' : ( blog_settings . blog_title or u'Blog' ) , u'description' : ( blog_settings . blog_introduction or u'' ) , u'modified' : modified , u'items' : blog_list , u'link' : ( host + u'/blog' ) } return context
returns common context data for network topology views .