mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-13 18:21:22 +00:00
html generation moved from web.py to web_cache.py so it can be called from other places as a response from server.py
This commit is contained in:
@@ -40,39 +40,8 @@ def init():
|
||||
|
||||
def respond():
|
||||
import webnotes
|
||||
try:
|
||||
if 'page' in webnotes.form_dict:
|
||||
html = get_html(webnotes.form_dict['page'])
|
||||
else:
|
||||
# show home page
|
||||
html = get_html('index')
|
||||
except Exception, e:
|
||||
html = get_html('404')
|
||||
|
||||
print "Content-Type: text/html"
|
||||
print
|
||||
print html.encode('utf-8')
|
||||
|
||||
def get_html(page_name):
|
||||
import website.utils
|
||||
page_name = website.utils.scrub_page_name(page_name)
|
||||
|
||||
comments = get_comments(page_name)
|
||||
|
||||
import website.web_cache
|
||||
html = website.web_cache.get_html(page_name, comments)
|
||||
|
||||
return html
|
||||
|
||||
def get_comments(page_name):
|
||||
import webnotes
|
||||
|
||||
if page_name == '404':
|
||||
comments = """error: %s""" % webnotes.getTraceback()
|
||||
else:
|
||||
comments = """page: %s""" % page_name
|
||||
|
||||
return comments
|
||||
return website.utils.render(webnotes.form_dict.get('page'))
|
||||
|
||||
if __name__=="__main__":
|
||||
init()
|
||||
|
||||
Reference in New Issue
Block a user