2011-09-05 18:43:09 +05:30
|
|
|
#!/usr/bin/python
|
|
|
|
# main handler file
|
|
|
|
|
|
|
|
import cgi, cgitb, os, sys
|
|
|
|
cgitb.enable()
|
|
|
|
|
|
|
|
# import libs
|
|
|
|
sys.path.append('lib/py')
|
|
|
|
sys.path.append('erpnext')
|
|
|
|
|
|
|
|
import webnotes
|
2012-02-01 14:47:29 +05:30
|
|
|
import webnotes.handler
|
|
|
|
import webnotes.auth
|
2012-02-17 12:47:36 +05:30
|
|
|
import webnotes.defs
|
2012-02-01 14:47:29 +05:30
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
# init request
|
2012-02-06 10:58:48 +01:00
|
|
|
try:
|
|
|
|
webnotes.http_request = webnotes.auth.HTTPRequest()
|
2012-02-14 11:44:13 +05:30
|
|
|
except webnotes.AuthenticationError, e:
|
|
|
|
pass
|
2012-02-20 12:35:23 +05:30
|
|
|
except webnotes.UnknownDomainError, e:
|
2012-02-17 12:47:36 +05:30
|
|
|
print "Location: " + (webnotes.defs.redirect_404)
|
2012-02-01 14:47:29 +05:30
|
|
|
|
|
|
|
def respond():
|
|
|
|
import webnotes
|
|
|
|
if 'cmd' in webnotes.form_dict:
|
|
|
|
webnotes.handler.handle()
|
|
|
|
else:
|
2012-02-07 13:31:09 +05:30
|
|
|
import webnotes.cms.index
|
2012-02-01 14:47:29 +05:30
|
|
|
print "Content-Type: text/html"
|
|
|
|
webnotes.handler.print_cookies()
|
|
|
|
print
|
2012-02-07 13:31:09 +05:30
|
|
|
print webnotes.cms.index.get()
|
2012-02-01 14:47:29 +05:30
|
|
|
|
|
|
|
if __name__=="__main__":
|
|
|
|
init()
|
2012-02-06 10:58:48 +01:00
|
|
|
respond()
|