moved back to 'index.cgi' model
diff --git a/index.cgi b/index.cgi
index 3d61c56..a119dae 100755
--- a/index.cgi
+++ b/index.cgi
@@ -9,33 +9,29 @@
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
+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()
- 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
-
+if __name__=="__main__":
+ init()
+ respond()
\ No newline at end of file