Rushabh Mehta | 66ac2b0 | 2011-09-05 18:43:09 +0530 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | # main handler file |
| 3 | |
| 4 | import cgi, cgitb, os, sys |
| 5 | cgitb.enable() |
| 6 | |
| 7 | # import libs |
| 8 | sys.path.append('lib/py') |
| 9 | sys.path.append('erpnext') |
| 10 | |
| 11 | import webnotes |
Rushabh Mehta | 66ac2b0 | 2011-09-05 18:43:09 +0530 | [diff] [blame] | 12 | |
| 13 | webnotes.form = cgi.FieldStorage() |
| 14 | |
| 15 | # make the form_dict |
| 16 | for key in webnotes.form.keys(): |
| 17 | webnotes.form_dict[key] = webnotes.form.getvalue(key) |
| 18 | |
Rushabh Mehta | 5ede3e8 | 2011-09-08 14:16:34 +0530 | [diff] [blame] | 19 | # url comes with sid, redirect to html, sid set and all |
| 20 | if 'sid' in webnotes.form_dict: |
| 21 | import webnotes.auth |
| 22 | import webnotes.widgets.page_body |
| 23 | |
| 24 | webnotes.auth.HTTPRequest() |
| 25 | |
| 26 | print "Content-Type: text/html" |
| 27 | |
| 28 | # print cookies, if there ar additional cookies defined during the request, add them here |
| 29 | if webnotes.cookies or webnotes.add_cookies: |
| 30 | for c in webnotes.add_cookies.keys(): |
| 31 | webnotes.cookies[c] = webnotes.add_cookies[c] |
| 32 | |
| 33 | print webnotes.cookies |
| 34 | |
| 35 | print |
| 36 | print webnotes.widgets.page_body.redirect_template % ('Redirecting...', 'index.html') |
| 37 | |
| 38 | else: |
| 39 | # pass on to legacy handler |
| 40 | import webnotes.handler |
| 41 | |