Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
ed39b79e3e
24
patches/december_2012/website_cache_refactor.py
Normal file
24
patches/december_2012/website_cache_refactor.py
Normal file
@ -0,0 +1,24 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
# set page published = 1
|
||||
webnotes.reload_doc("website", "doctype", "web_page")
|
||||
webnotes.conn.sql("""update `tabWeb Page` set published=1;""")
|
||||
|
||||
# convert all page & blog markdowns to html
|
||||
from markdown2 import markdown
|
||||
|
||||
for page in webnotes.conn.sql("""select name, main_section from `tabWeb Page`"""):
|
||||
m = markdown(page[1]).encode("utf8")
|
||||
webnotes.conn.set_value("Web Page", page[0], "main_section", m)
|
||||
|
||||
for page in webnotes.conn.sql("""select name, content from `tabBlog`"""):
|
||||
m = markdown(page[1]).encode("utf8")
|
||||
webnotes.conn.set_value("Blog", page[0], "content", m)
|
||||
|
||||
# delete website cache
|
||||
webnotes.conn.commit()
|
||||
webnotes.delete_doc("DocType", "Web Cache")
|
||||
webnotes.conn.sql("""drop table if exists `tabWeb Cache`""")
|
Loading…
x
Reference in New Issue
Block a user