Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
fd6a2c7c9e
@ -35,6 +35,11 @@ To update from wnframework version 1.
|
||||
|
||||
python lib/wnf.py setup
|
||||
|
||||
4. copy defs.py from cgi-bin/webnotes to py/webnotes
|
||||
5. change module_path (point to erpnext/erpnext) in defs.py
|
||||
6. delete cgi-bin directory
|
||||
7. delete all old module directories from erpnext
|
||||
|
||||
## License
|
||||
|
||||
ERPNext is available under the GNU/GPL license.
|
||||
|
1
cgi-bin/README.md
Normal file
1
cgi-bin/README.md
Normal file
@ -0,0 +1 @@
|
||||
## Deprecated
|
83
cgi-bin/getfile.cgi
Executable file
83
cgi-bin/getfile.cgi
Executable file
@ -0,0 +1,83 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
try:
|
||||
|
||||
import sys, os
|
||||
|
||||
sys.path.append('../lib/py')
|
||||
sys.path.append('../erpnext')
|
||||
|
||||
def getTraceback():
|
||||
import sys, traceback, string
|
||||
type, value, tb = sys.exc_info()
|
||||
body = "Traceback (innermost last):\n"
|
||||
list = traceback.format_tb(tb, None) \
|
||||
+ traceback.format_exception_only(type, value)
|
||||
body = body + "%-20s %s" % (string.join(list[:-1], ""), list[-1])
|
||||
return body
|
||||
|
||||
import cgi
|
||||
import webnotes
|
||||
import webnotes.auth
|
||||
import webnotes.utils
|
||||
import webnotes.utils.file_manager
|
||||
import webnotes.db
|
||||
import webnotes.defs
|
||||
|
||||
sys.path.append(webnotes.defs.modules_path)
|
||||
|
||||
form = cgi.FieldStorage()
|
||||
webnotes.form_dict = {}
|
||||
|
||||
for each in form.keys():
|
||||
webnotes.form_dict[each] = form.getvalue(each)
|
||||
|
||||
n = form.getvalue('name')
|
||||
|
||||
# authenticate
|
||||
webnotes.auth.HTTPRequest()
|
||||
|
||||
# get file
|
||||
res = webnotes.utils.file_manager.get_file(n)
|
||||
|
||||
fname = res[0]
|
||||
if hasattr(res[1], 'tostring'):
|
||||
fcontent = res[1].tostring()
|
||||
else:
|
||||
fcontent = res[1]
|
||||
|
||||
if form.getvalue('thumbnail'):
|
||||
tn = webnotes.utils.cint(form.getvalue('thumbnail'))
|
||||
try:
|
||||
from PIL import Image
|
||||
import cStringIO
|
||||
|
||||
fobj = cStringIO.StringIO(fcontent)
|
||||
image = Image.open(fobj)
|
||||
image.thumbnail((tn,tn*2), Image.ANTIALIAS)
|
||||
outfile = cStringIO.StringIO()
|
||||
|
||||
if image.mode != "RGB":
|
||||
image = image.convert("RGB")
|
||||
|
||||
image.save(outfile, 'JPEG')
|
||||
outfile.seek(0)
|
||||
fcontent = outfile.read()
|
||||
except:
|
||||
pass
|
||||
|
||||
import mimetypes
|
||||
print "Content-Type: %s" % (mimetypes.guess_type(fname)[0] or 'application/unknown')
|
||||
print "Content-Disposition: filename="+fname.replace(' ', '_')
|
||||
print "Cache-Control: max-age=3600"
|
||||
print
|
||||
print fcontent
|
||||
|
||||
except Exception, e:
|
||||
print "Content-Type: text/html"
|
||||
try:
|
||||
out = {'message':'', 'exc':getTraceback().replace('\n','<br>')}
|
||||
except:
|
||||
out = {'exc': e}
|
||||
print
|
||||
print str(out)
|
@ -9,7 +9,6 @@ sys.path.append('lib/py')
|
||||
sys.path.append('erpnext')
|
||||
|
||||
import webnotes
|
||||
import webnotes.defs
|
||||
|
||||
webnotes.form = cgi.FieldStorage()
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<meta charset="utf-8">
|
||||
<title>ERPNext</title>
|
||||
<meta name="author" content="">
|
||||
<script type="text/javascript">window._version_number="34"
|
||||
<script type="text/javascript">window._version_number="50"
|
||||
|
||||
wn={}
|
||||
wn.provide=function(namespace){var nsl=namespace.split('.');var l=nsl.length;var parent=window;for(var i=0;i<l;i++){var n=nsl[i];if(!parent[n]){parent[n]={}}
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user