moved back to 'index.cgi' model

This commit is contained in:
Rushabh Mehta
2012-02-01 14:47:29 +05:30
parent ab1148cbc9
commit 9ef63f93d6
5 changed files with 27 additions and 172 deletions

View File

@@ -9,33 +9,29 @@ sys.path.append('lib/py')
sys.path.append('erpnext')
import webnotes
import webnotes.handler
import webnotes.auth
webnotes.form = cgi.FieldStorage()
def init():
# make the form_dict
webnotes.form = cgi.FieldStorage(keep_blank_values=True)
for key in webnotes.form.keys():
webnotes.form_dict[key] = webnotes.form.getvalue(key)
# make the form_dict
for key in webnotes.form.keys():
webnotes.form_dict[key] = webnotes.form.getvalue(key)
# init request
webnotes.http_request = webnotes.auth.HTTPRequest()
# url comes with sid, redirect to html, sid set and all
if 'sid' in webnotes.form_dict:
import webnotes.auth
import webnotes.widgets.page_body
webnotes.auth.HTTPRequest()
print "Content-Type: text/html"
# print cookies, if there ar additional cookies defined during the request, add them here
if webnotes.cookies or webnotes.add_cookies:
for c in webnotes.add_cookies.keys():
webnotes.cookies[c] = webnotes.add_cookies[c]
print webnotes.cookies
print
print webnotes.widgets.page_body.redirect_template % ('Redirecting...', 'index.html')
else:
# pass on to legacy handler
import webnotes.handler
def respond():
import webnotes
if 'cmd' in webnotes.form_dict:
webnotes.handler.handle()
else:
import webnotes.index
print "Content-Type: text/html"
webnotes.handler.print_cookies()
print
print webnotes.index.get()
if __name__=="__main__":
init()
respond()