Merge branch 'master' of github.com:webnotes/erpnext
diff --git a/README.md b/README.md
index 27f86fe..1dde74c 100644
--- a/README.md
+++ b/README.md
@@ -35,6 +35,11 @@
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.
diff --git a/cgi-bin/README.md b/cgi-bin/README.md
new file mode 100644
index 0000000..0ea0779
--- /dev/null
+++ b/cgi-bin/README.md
@@ -0,0 +1 @@
+## Deprecated
\ No newline at end of file
diff --git a/cgi-bin/getfile.cgi b/cgi-bin/getfile.cgi
new file mode 100755
index 0000000..6b11305
--- /dev/null
+++ b/cgi-bin/getfile.cgi
@@ -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)
diff --git a/index.cgi b/index.cgi
index da52ef1..3d61c56 100755
--- a/index.cgi
+++ b/index.cgi
@@ -9,7 +9,6 @@
sys.path.append('erpnext')
import webnotes
-import webnotes.defs
webnotes.form = cgi.FieldStorage()
diff --git a/index.html b/index.html
index 5d45b5f..35beeef 100644
--- a/index.html
+++ b/index.html
@@ -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]={}}
diff --git a/versions-master.db b/versions-master.db
index 6f4bd52..f51b6de 100644
--- a/versions-master.db
+++ b/versions-master.db
Binary files differ