p3 fixes in applications
This commit is contained in:
@@ -15,7 +15,7 @@ from gluon.utils import web2py_uuid
|
|||||||
from gluon.tools import Config
|
from gluon.tools import Config
|
||||||
from gluon.compileapp import find_exposed_functions
|
from gluon.compileapp import find_exposed_functions
|
||||||
from glob import glob
|
from glob import glob
|
||||||
from gluon._compat import iteritems, PY2, pickle, xrange, urlopen, to_bytes
|
from gluon._compat import iteritems, PY2, pickle, xrange, urlopen, to_bytes, StringIO, to_native
|
||||||
import shutil
|
import shutil
|
||||||
import platform
|
import platform
|
||||||
|
|
||||||
@@ -382,7 +382,6 @@ def pack_plugin():
|
|||||||
def pack_exe(app, base, filenames=None):
|
def pack_exe(app, base, filenames=None):
|
||||||
import urllib
|
import urllib
|
||||||
import zipfile
|
import zipfile
|
||||||
from cStringIO import StringIO
|
|
||||||
# Download latest web2py_win and open it with zipfile
|
# Download latest web2py_win and open it with zipfile
|
||||||
download_url = 'http://www.web2py.com/examples/static/web2py_win.zip'
|
download_url = 'http://www.web2py.com/examples/static/web2py_win.zip'
|
||||||
out = StringIO()
|
out = StringIO()
|
||||||
@@ -1742,9 +1741,9 @@ def make_link(path):
|
|||||||
for key in editable.keys():
|
for key in editable.keys():
|
||||||
check_extension = folder.endswith("%s/%s" % (app, key))
|
check_extension = folder.endswith("%s/%s" % (app, key))
|
||||||
if ext.lower() == editable[key] and check_extension:
|
if ext.lower() == editable[key] and check_extension:
|
||||||
return A('"' + tryFile + '"',
|
return to_native(A('"' + tryFile + '"',
|
||||||
_href=URL(r=request,
|
_href=URL(r=request,
|
||||||
f='edit/%s/%s/%s' % (app, key, filename))).xml()
|
f='edit/%s/%s/%s' % (app, key, filename))).xml())
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,7 @@ import os
|
|||||||
import re
|
import re
|
||||||
import gzip
|
import gzip
|
||||||
import tarfile
|
import tarfile
|
||||||
try:
|
from gluon._compat import StringIO
|
||||||
from cStringIO import StringIO
|
|
||||||
except ImportError:
|
|
||||||
from StringIO import StringIO
|
|
||||||
from xmlrpclib import ProtocolError
|
from xmlrpclib import ProtocolError
|
||||||
from gluon.contrib.simplejsonrpc import ServerProxy
|
from gluon.contrib.simplejsonrpc import ServerProxy
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import sys
|
import sys
|
||||||
import cStringIO
|
|
||||||
import gluon.contrib.shell
|
import gluon.contrib.shell
|
||||||
import code
|
import code
|
||||||
import thread
|
import thread
|
||||||
import cgi
|
import cgi
|
||||||
from gluon.shell import env
|
from gluon.shell import env
|
||||||
|
from gluon._compat import StringIO
|
||||||
|
|
||||||
if DEMO_MODE or MULTI_USER_MODE:
|
if DEMO_MODE or MULTI_USER_MODE:
|
||||||
session.flash = T('disabled in demo mode')
|
session.flash = T('disabled in demo mode')
|
||||||
|
|||||||
@@ -7,15 +7,11 @@ import platform
|
|||||||
import time
|
import time
|
||||||
import base64
|
import base64
|
||||||
import os
|
import os
|
||||||
try:
|
from gluon._compat import StringIO
|
||||||
from cStringIO import StringIO
|
|
||||||
except ImportError:
|
|
||||||
from StringIO import StringIO
|
|
||||||
|
|
||||||
|
|
||||||
service = Service(globals())
|
service = Service(globals())
|
||||||
|
|
||||||
|
|
||||||
@service.jsonrpc
|
@service.jsonrpc
|
||||||
def login():
|
def login():
|
||||||
"dummy function to test credentials"
|
"dummy function to test credentials"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import gluon.template
|
import gluon.template
|
||||||
|
from gluon.fileutils import open_file
|
||||||
|
|
||||||
markmin_dict = dict(
|
markmin_dict = dict(
|
||||||
code_python=lambda code: str(CODE(code)),
|
code_python=lambda code: str(CODE(code)),
|
||||||
@@ -24,7 +25,7 @@ def get_content(b=None,
|
|||||||
import os
|
import os
|
||||||
path = os.path.join(
|
path = os.path.join(
|
||||||
request.folder, 'private', 'content', l, c, f, b + '.' + format)
|
request.folder, 'private', 'content', l, c, f, b + '.' + format)
|
||||||
return open(path)
|
return open_file(path, mode='r')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
openedfile = openfile()
|
openedfile = openfile()
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ class RESIZE(object):
|
|||||||
if isinstance(value, str) and len(value) == 0:
|
if isinstance(value, str) and len(value) == 0:
|
||||||
return (value, None)
|
return (value, None)
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
import cStringIO
|
from io import BytesIO
|
||||||
try:
|
try:
|
||||||
img = Image.open(value.file)
|
img = Image.open(value.file)
|
||||||
img.thumbnail((self.nx, self.ny), Image.ANTIALIAS)
|
img.thumbnail((self.nx, self.ny), Image.ANTIALIAS)
|
||||||
s = cStringIO.StringIO()
|
s = BytesIO()
|
||||||
if self.padding:
|
if self.padding:
|
||||||
background = Image.new('RGBA', (self.nx, self.ny), (255, 255, 255, 0))
|
background = Image.new('RGBA', (self.nx, self.ny), (255, 255, 255, 0))
|
||||||
background.paste(
|
background.paste(
|
||||||
@@ -48,7 +48,7 @@ class RESIZE(object):
|
|||||||
((self.nx - img.size[0]) / 2, (self.ny - img.size[1]) / 2))
|
((self.nx - img.size[0]) / 2, (self.ny - img.size[1]) / 2))
|
||||||
background.save(s, 'JPEG', quality=self.quality)
|
background.save(s, 'JPEG', quality=self.quality)
|
||||||
else:
|
else:
|
||||||
img.save(s, 'JPEG', queality=self.quality)
|
img.save(s, 'JPEG', quality=self.quality)
|
||||||
s.seek(0)
|
s.seek(0)
|
||||||
value.file = s
|
value.file = s
|
||||||
except:
|
except:
|
||||||
|
|||||||
Reference in New Issue
Block a user