brotherton-erpnext/index.cgi

75 lines
2.1 KiB
Plaintext
Raw Normal View History

2011-09-05 13:13:09 +00:00
#!/usr/bin/python
2012-02-23 07:05:32 +00:00
# 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 13:13:09 +00:00
import cgi, cgitb, os, sys
cgitb.enable()
# import libs
sys.path.append('lib/py')
sys.path.append('erpnext')
import webnotes
2012-02-01 09:17:29 +00:00
import webnotes.handler
import webnotes.auth
2012-02-17 07:17:36 +00:00
import webnotes.defs
2012-02-01 09:17:29 +00:00
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 09:58:48 +00:00
try:
webnotes.http_request = webnotes.auth.HTTPRequest()
2012-02-28 11:17:08 +00:00
return True
except webnotes.AuthenticationError, e:
2012-02-29 05:25:43 +00:00
return True
2012-02-20 07:05:23 +00:00
except webnotes.UnknownDomainError, e:
2012-02-17 07:17:36 +00:00
print "Location: " + (webnotes.defs.redirect_404)
2012-02-28 11:17:08 +00: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 09:17:29 +00:00
def respond():
import webnotes
if 'cmd' in webnotes.form_dict:
webnotes.handler.handle()
else:
2012-02-07 08:01:09 +00:00
import webnotes.cms.index
2012-02-01 09:17:29 +00:00
print "Content-Type: text/html"
webnotes.handler.print_cookies()
print
2012-02-07 08:01:09 +00:00
print webnotes.cms.index.get()
2012-02-01 09:17:29 +00:00
if __name__=="__main__":
2012-02-28 11:17:08 +00:00
if init():
respond()