brotherton-erpnext/index.cgi

75 lines
2.1 KiB
Plaintext
Raw Normal View History

2011-09-05 18:43:09 +05:30
#!/usr/bin/python
2012-02-23 12:35:32 +05:30
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2011-09-05 18:43:09 +05:30
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-28 12:17:08 +01:00
return True
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-28 12:17:08 +01:00
except webnotes.SessionStopped, e:
if 'cmd' in webnotes.form_dict:
webnotes.handler.print_json()
else:
print "Content-Type: text/html"
print
print """<html>
<body style="background-color: #EEE;">
<h3 style="width: 900px; background-color: #FFF; border: 2px solid #AAA; padding: 20px; font-family: Arial; margin: 20px auto">
Updating.
We will be back in a few moments...
</h3>
</body>
</html>"""
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__":
2012-02-28 12:17:08 +01:00
if init():
respond()