blob: 8a7a72e40bb334339db6659a05398bcfbef6b730 [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
Rushabh Mehta4167e2f2012-02-06 10:58:48 +010022 try:
23 webnotes.http_request = webnotes.auth.HTTPRequest()
Rushabh Mehtaafaac602012-02-14 11:44:13 +053024 except webnotes.AuthenticationError, e:
25 pass
Rushabh Mehta66ac2b02011-09-05 18:43:09 +053026
Rushabh Mehta9ef63f92012-02-01 14:47:29 +053027def respond():
28 import webnotes
29 if 'cmd' in webnotes.form_dict:
30 webnotes.handler.handle()
31 else:
Rushabh Mehta8ebf4e22012-02-07 13:31:09 +053032 import webnotes.cms.index
Rushabh Mehta9ef63f92012-02-01 14:47:29 +053033 print "Content-Type: text/html"
34 webnotes.handler.print_cookies()
35 print
Rushabh Mehta8ebf4e22012-02-07 13:31:09 +053036 print webnotes.cms.index.get()
Rushabh Mehta5ede3e82011-09-08 14:16:34 +053037
Rushabh Mehta9ef63f92012-02-01 14:47:29 +053038if __name__=="__main__":
39 init()
Rushabh Mehta4167e2f2012-02-06 10:58:48 +010040 respond()