account_browser: remove can_create check

This commit is contained in:
Rushabh Mehta
2012-12-06 14:58:44 +05:30
parent 28bc87fb8c
commit 89c7b41fee
4 changed files with 42 additions and 41 deletions

View File

@@ -17,6 +17,40 @@
from __future__ import unicode_literals
import webnotes
def render(page_name):
"""render html page"""
import webnotes
try:
if page_name:
html = get_html(page_name)
else:
html = get_html('index')
except Exception, e:
html = get_html('404')
from webnotes.handler import eprint, print_zip
eprint("Content-Type: text/html")
print_zip(html)
def get_html(page_name):
"""get page html"""
page_name = 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
def scrub_page_name(page_name):
if page_name.endswith('.html'):
page_name = page_name[:-5]
@@ -41,37 +75,3 @@ def page_name(title):
name = title.lower()
name = re.sub('[~!@#$%^&*()<>,."\']', '', name)
return '-'.join(name.split()[:4])
def render(page_name):
"""render html page"""
import webnotes
try:
if page_name:
html = get_html(page_name)
else:
html = get_html('index')
except Exception, e:
html = get_html('404')
from webnotes.handler import eprint, print_zip
eprint("Content-Type: text/html")
print_zip(html)
def get_html(page_name):
"""get page html"""
page_name = 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