fixes in blog feed

This commit is contained in:
Anand Doshi 2012-07-13 01:14:43 +05:30
parent aaeb2e2e55
commit 746f00972a
2 changed files with 10 additions and 16 deletions

View file

@ -62,10 +62,11 @@ def generate():
where cache.doc_type = 'Blog' and blog.page_name = cache.name
order by published desc, modified desc, name asc limit 100""", as_dict=1)
import website.blog
for blog in blog_list:
blog['link'] = host + '/' + blog['name'] + '.html'
blog['content'] = get_content(blog['name'])
blog['content'] = website.blog.get_blog_content(blog['name'])
items += rss_item % blog
@ -79,18 +80,3 @@ def generate():
'items': items,
'link': host + '/blog.html'
}).encode('utf-8', 'ignore')
def get_content(page_name):
import website.web_cache
content = website.web_cache.get_html(page_name)
import webnotes.utils
content = content.split("<!-- begin blog content -->")
content = len(content) > 1 and content[1] or content[0]
content = content.split("<!-- end blog content -->")
content = content[0]
content = webnotes.utils.escape_html(content)
return content

8
wnf.py
View file

@ -111,6 +111,10 @@ def setup_options():
# build
parser.add_option("-b", "--build", default=False, action="store_true",
help="minify + concat js files")
parser.add_option("--build_web_cache", default=False, action="store_true",
help="build web cache")
parser.add_option("--domain", metavar="DOMAIN",
help="store domain in Website Settings", nargs=1)
@ -297,6 +301,10 @@ def run():
webnotes.conn.set_value('Website Settings', None, 'subdomain', options.domain)
webnotes.conn.commit()
print "Domain set to", options.domain
elif options.build_web_cache:
import website.web_cache
website.web_cache.refresh_cache(True)
# print messages
if webnotes.message_log: