blob: a119daeeda9a6af88abea84015704df8037d84d9 [file] [log] [blame]
Rushabh Mehta66ac2b02011-09-05 18:43:09 +05301#!/usr/bin/python
2# main handler file
3
4import cgi, cgitb, os, sys
5cgitb.enable()
6
7# import libs
8sys.path.append('lib/py')
9sys.path.append('erpnext')
10
11import webnotes
Rushabh Mehta9ef63f92012-02-01 14:47:29 +053012import webnotes.handler
13import webnotes.auth
Rushabh Mehta66ac2b02011-09-05 18:43:09 +053014
Rushabh Mehta9ef63f92012-02-01 14:47:29 +053015def init():
16 # make the form_dict
17 webnotes.form = cgi.FieldStorage(keep_blank_values=True)
18 for key in webnotes.form.keys():
19 webnotes.form_dict[key] = webnotes.form.getvalue(key)
Rushabh Mehta66ac2b02011-09-05 18:43:09 +053020
Rushabh Mehta9ef63f92012-02-01 14:47:29 +053021 # init request
22 webnotes.http_request = webnotes.auth.HTTPRequest()
Rushabh Mehta66ac2b02011-09-05 18:43:09 +053023
Rushabh Mehta9ef63f92012-02-01 14:47:29 +053024def respond():
25 import webnotes
26 if 'cmd' in webnotes.form_dict:
27 webnotes.handler.handle()
28 else:
29 import webnotes.index
30 print "Content-Type: text/html"
31 webnotes.handler.print_cookies()
32 print
33 print webnotes.index.get()
Rushabh Mehta5ede3e82011-09-08 14:16:34 +053034
Rushabh Mehta9ef63f92012-02-01 14:47:29 +053035if __name__=="__main__":
36 init()
37 respond()