blob: da52ef11864723f700319b46ba324cecda65840f [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
12import webnotes.defs
13
14webnotes.form = cgi.FieldStorage()
15
16# make the form_dict
17for key in webnotes.form.keys():
18 webnotes.form_dict[key] = webnotes.form.getvalue(key)
19
Rushabh Mehta5ede3e82011-09-08 14:16:34 +053020# url comes with sid, redirect to html, sid set and all
21if 'sid' in webnotes.form_dict:
22 import webnotes.auth
23 import webnotes.widgets.page_body
24
25 webnotes.auth.HTTPRequest()
26
27 print "Content-Type: text/html"
28
29 # print cookies, if there ar additional cookies defined during the request, add them here
30 if webnotes.cookies or webnotes.add_cookies:
31 for c in webnotes.add_cookies.keys():
32 webnotes.cookies[c] = webnotes.add_cookies[c]
33
34 print webnotes.cookies
35
36 print
37 print webnotes.widgets.page_body.redirect_template % ('Redirecting...', 'index.html')
38
39else:
40 # pass on to legacy handler
41 import webnotes.handler
42