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