brotherton-erpnext/index.cgi

60 lines
1.6 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()
except webnotes.AuthenticationError, e:
pass
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-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__":
init()
2012-02-06 09:58:48 +00:00
respond()