@@ -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 pydal._compat import iteritems, PY2, pickle, xrange, urlopen, to_bytes, StringIO, to_native
|
||||
from gluon._compat import iteritems, PY2, pickle, xrange, urlopen, to_bytes, StringIO, to_native
|
||||
import shutil
|
||||
import platform
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import datetime
|
||||
import copy
|
||||
import gluon.contenttype
|
||||
import gluon.fileutils
|
||||
from pydal._compat import iteritems
|
||||
from gluon._compat import iteritems
|
||||
|
||||
try:
|
||||
import pygraphviz as pgv
|
||||
@@ -213,7 +213,7 @@ def select():
|
||||
|
||||
if is_imap:
|
||||
step = 3
|
||||
|
||||
|
||||
stop = start + step
|
||||
|
||||
table = None
|
||||
@@ -421,7 +421,7 @@ def ccache():
|
||||
'oldest': time.time(),
|
||||
'keys': []
|
||||
}
|
||||
|
||||
|
||||
disk = copy.copy(ram)
|
||||
total = copy.copy(ram)
|
||||
disk['keys'] = []
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
import sys
|
||||
import hashlib
|
||||
import os
|
||||
|
||||
PY2 = sys.version_info[0] == 2
|
||||
|
||||
_identity = lambda x: x
|
||||
|
||||
if PY2:
|
||||
import cPickle as pickle
|
||||
from cStringIO import StringIO
|
||||
import copy_reg as copyreg
|
||||
from HTMLParser import HTMLParser
|
||||
import urlparse
|
||||
from htmlentitydefs import entitydefs, name2codepoint
|
||||
import __builtin__ as builtin
|
||||
import thread
|
||||
import Cookie
|
||||
import urllib2
|
||||
import Queue
|
||||
import ConfigParser as configparser
|
||||
from email.MIMEBase import MIMEBase
|
||||
from email.Header import Header
|
||||
from email import Encoders, Charset
|
||||
from email.MIMEMultipart import MIMEMultipart
|
||||
from email.MIMEText import MIMEText
|
||||
from email.Charset import add_charset, QP as charset_QP
|
||||
from urllib import FancyURLopener, urlencode, urlopen
|
||||
from urllib import quote as urllib_quote, unquote as urllib_unquote
|
||||
from string import maketrans
|
||||
from types import ClassType
|
||||
import cgi
|
||||
import cookielib
|
||||
BytesIO = StringIO
|
||||
reduce = reduce
|
||||
hashlib_md5 = hashlib.md5
|
||||
iterkeys = lambda d: d.iterkeys()
|
||||
itervalues = lambda d: d.itervalues()
|
||||
iteritems = lambda d: d.iteritems()
|
||||
integer_types = (int, long)
|
||||
string_types = (str, unicode)
|
||||
text_type = unicode
|
||||
basestring = basestring
|
||||
xrange = xrange
|
||||
long = long
|
||||
unichr = unichr
|
||||
unicodeT = unicode
|
||||
|
||||
def implements_bool(cls):
|
||||
cls.__nonzero__ = cls.__bool__
|
||||
del cls.__bool__
|
||||
return cls
|
||||
|
||||
def implements_iterator(cls):
|
||||
cls.next = cls.__next__
|
||||
del cls.__next__
|
||||
return cls
|
||||
|
||||
def to_bytes(obj, charset='utf-8', errors='strict'):
|
||||
if obj is None:
|
||||
return None
|
||||
if isinstance(obj, (bytes, bytearray, buffer)):
|
||||
return bytes(obj)
|
||||
if isinstance(obj, unicode):
|
||||
return obj.encode(charset, errors)
|
||||
raise TypeError('Expected bytes')
|
||||
|
||||
def to_native(obj, charset='utf8', errors='strict'):
|
||||
if obj is None or isinstance(obj, str):
|
||||
return obj
|
||||
return obj.encode(charset, errors)
|
||||
|
||||
|
||||
else:
|
||||
import pickle
|
||||
from io import StringIO, BytesIO
|
||||
import copyreg
|
||||
from functools import reduce
|
||||
from html.parser import HTMLParser
|
||||
from http import cookies as Cookie
|
||||
from urllib import parse as urlparse
|
||||
from urllib import request as urllib2
|
||||
from html.entities import entitydefs, name2codepoint
|
||||
import builtins as builtin
|
||||
import _thread as thread
|
||||
import configparser
|
||||
import queue as Queue
|
||||
from email.mime.base import MIMEBase
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
from email import encoders as Encoders
|
||||
from email.header import Header
|
||||
from email.charset import Charset, add_charset, QP as charset_QP
|
||||
from urllib.request import FancyURLopener, urlopen
|
||||
from urllib.parse import quote as urllib_quote, unquote as urllib_unquote, urlencode
|
||||
from http import cookiejar as cookielib
|
||||
import html # warning, this is the python3 module and not the web2py html module
|
||||
hashlib_md5 = lambda s: hashlib.md5(bytes(s, 'utf8'))
|
||||
iterkeys = lambda d: iter(d.keys())
|
||||
itervalues = lambda d: iter(d.values())
|
||||
iteritems = lambda d: iter(d.items())
|
||||
integer_types = (int,)
|
||||
string_types = (str,)
|
||||
text_type = str
|
||||
basestring = str
|
||||
xrange = range
|
||||
long = int
|
||||
unichr = chr
|
||||
unicodeT = str
|
||||
maketrans = str.maketrans
|
||||
ClassType = type
|
||||
|
||||
implements_iterator = _identity
|
||||
implements_bool = _identity
|
||||
|
||||
def to_bytes(obj, charset='utf-8', errors='strict'):
|
||||
if obj is None:
|
||||
return None
|
||||
if isinstance(obj, (bytes, bytearray, memoryview)):
|
||||
return bytes(obj)
|
||||
if isinstance(obj, str):
|
||||
return obj.encode(charset, errors)
|
||||
raise TypeError('Expected bytes')
|
||||
|
||||
def to_native(obj, charset='utf8', errors='strict'):
|
||||
if obj is None or isinstance(obj, str):
|
||||
return obj
|
||||
return obj.decode(charset, errors)
|
||||
|
||||
|
||||
def with_metaclass(meta, *bases):
|
||||
"""Create a base class with a metaclass."""
|
||||
# This requires a bit of explanation: the basic idea is to make a dummy
|
||||
# metaclass for one level of class instantiation that replaces itself with
|
||||
# the actual metaclass.
|
||||
class metaclass(meta):
|
||||
__call__ = type.__call__
|
||||
__init__ = type.__init__
|
||||
|
||||
def __new__(cls, name, this_bases, d):
|
||||
if this_bases is None:
|
||||
return type.__new__(cls, name, (), d)
|
||||
return meta(name, bases, d)
|
||||
return metaclass('temporary_class', None, {})
|
||||
|
||||
|
||||
def to_unicode(obj, charset='utf-8', errors='strict'):
|
||||
if obj is None:
|
||||
return None
|
||||
if not isinstance(obj, bytes):
|
||||
return text_type(obj)
|
||||
return obj.decode(charset, errors)
|
||||
|
||||
|
||||
# shortcuts
|
||||
pjoin = os.path.join
|
||||
exists = os.path.exists
|
||||
+1
-1
@@ -22,7 +22,7 @@ from gluon.fileutils import read_file, write_file, parse_version
|
||||
from gluon.restricted import RestrictedError
|
||||
from gluon.settings import global_settings
|
||||
from gluon.cache import CacheOnDisk
|
||||
from pydal._compat import urlopen, to_native
|
||||
from gluon._compat import urlopen, to_native
|
||||
|
||||
if not global_settings.web2py_runtime_gae:
|
||||
import site
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ except ImportError:
|
||||
have_settings = False
|
||||
|
||||
from pydal.contrib import portalocker
|
||||
from pydal._compat import pickle, thread, to_bytes, to_native, hashlib_md5
|
||||
from gluon._compat import pickle, thread, to_bytes, to_native, hashlib_md5
|
||||
|
||||
try:
|
||||
import psutil
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ Note:
|
||||
|
||||
from os import stat
|
||||
from gluon.fileutils import read_file
|
||||
from pydal._compat import thread
|
||||
from gluon._compat import thread
|
||||
|
||||
cfs = {} # for speed-up
|
||||
cfs_lock = thread.allocate_lock() # and thread safety
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import fnmatch
|
||||
import os
|
||||
import copy
|
||||
import random
|
||||
from pydal._compat import builtin, PY2, unicodeT, to_native, to_bytes, iteritems, basestring, reduce, xrange, long
|
||||
from gluon._compat import builtin, PY2, unicodeT, to_native, to_bytes, iteritems, basestring, reduce, xrange, long
|
||||
from gluon.storage import Storage, List
|
||||
from gluon.template import parse_template
|
||||
from gluon.restricted import restricted, compile2
|
||||
|
||||
@@ -19,7 +19,7 @@ Additions:
|
||||
- .pickle: application/python-pickle
|
||||
- .w2p': application/w2p
|
||||
"""
|
||||
from pydal._compat import to_native
|
||||
from gluon._compat import to_native
|
||||
|
||||
__all__ = ['contenttype']
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ is restarted (or reload=True is passed).
|
||||
"""
|
||||
import os
|
||||
import json
|
||||
from pydal._compat import thread, configparser
|
||||
from gluon._compat import thread, configparser
|
||||
from gluon.globals import current
|
||||
|
||||
locker = thread.allocate_lock()
|
||||
|
||||
@@ -42,7 +42,7 @@ revision3.com
|
||||
viddler.com
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from pydal._compat import FancyURLopener, urllib_quote
|
||||
from gluon._compat import FancyURLopener, urllib_quote
|
||||
|
||||
import re
|
||||
import cgi
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
from __future__ import print_function
|
||||
import re
|
||||
import urllib
|
||||
from pydal._compat import maketrans, urllib_quote, unicodeT, to_bytes, to_native, xrange
|
||||
from gluon._compat import maketrans, urllib_quote, unicodeT, to_bytes, to_native, xrange
|
||||
from gluon.utils import local_html_escape as escape
|
||||
from ast import parse as ast_parse
|
||||
import ast
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
An interactive, stateful AJAX shell that runs Python code on the server.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from pydal._compat import ClassType, pickle, StringIO
|
||||
from gluon._compat import ClassType, pickle, StringIO
|
||||
import logging
|
||||
import new
|
||||
import sys
|
||||
|
||||
@@ -16,7 +16,7 @@ mostly for testing purposes
|
||||
Some examples at the bottom.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from pydal._compat import urllib2, cookielib, iteritems, to_native, urlencode, to_bytes
|
||||
from gluon._compat import urllib2, cookielib, iteritems, to_native, urlencode, to_bytes
|
||||
import re
|
||||
import time
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
Support for smart import syntax for web2py applications
|
||||
-------------------------------------------------------
|
||||
"""
|
||||
from pydal._compat import builtin, unicodeT, PY2, to_native
|
||||
from gluon._compat import builtin, unicodeT, PY2, to_native
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ Debugger support classes
|
||||
import logging
|
||||
import pdb
|
||||
import sys
|
||||
from pydal._compat import Queue
|
||||
from gluon._compat import Queue
|
||||
|
||||
logger = logging.getLogger("web2py")
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import logging
|
||||
from gluon.http import HTTP
|
||||
from gzip import open as gzopen
|
||||
from gluon.recfile import generate
|
||||
from pydal._compat import PY2
|
||||
from gluon._compat import PY2
|
||||
|
||||
__all__ = [
|
||||
'parse_version',
|
||||
|
||||
+3
-3
@@ -13,7 +13,7 @@ Contains the classes for the global used variables:
|
||||
- Session
|
||||
|
||||
"""
|
||||
from pydal._compat import pickle, StringIO, copyreg, Cookie, urlparse, PY2, iteritems, to_unicode, to_native, unicodeT
|
||||
from gluon._compat import pickle, StringIO, copyreg, Cookie, urlparse, PY2, iteritems, to_unicode, to_native, unicodeT
|
||||
from gluon.storage import Storage, List
|
||||
from gluon.streamer import streamer, stream_file_or_304_or_206, DEFAULT_CHUNK_SIZE
|
||||
from gluon.contenttype import contenttype
|
||||
@@ -436,7 +436,7 @@ class Response(Storage):
|
||||
self._vars.update(b)
|
||||
self._view_environment.update(self._vars)
|
||||
if view:
|
||||
from pydal._compat import StringIO
|
||||
from gluon._compat import StringIO
|
||||
(obody, oview) = (self.body, self.view)
|
||||
(self.body, self.view) = (StringIO(), view)
|
||||
run_view_in(self._view_environment)
|
||||
@@ -1192,7 +1192,7 @@ class Session(Storage):
|
||||
|
||||
def _try_store_in_file(self, request, response):
|
||||
try:
|
||||
if (not response.session_id or
|
||||
if (not response.session_id or
|
||||
not response.session_filename or
|
||||
self._forget
|
||||
or self._unchanged(response)):
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
| License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from pydal._compat import xrange
|
||||
from gluon._compat import xrange
|
||||
from gluon.utils import local_html_escape
|
||||
import re
|
||||
|
||||
|
||||
+5
-5
@@ -20,7 +20,7 @@ import urllib
|
||||
import base64
|
||||
from gluon import sanitizer, decoder
|
||||
import itertools
|
||||
from pydal._compat import reduce, pickle, copyreg, HTMLParser, name2codepoint, iteritems, unichr, unicodeT, urllib_quote, to_bytes, to_native, to_unicode, basestring, urlencode, implements_bool
|
||||
from gluon._compat import reduce, pickle, copyreg, HTMLParser, name2codepoint, iteritems, unichr, unicodeT, urllib_quote, to_bytes, to_native, to_unicode, basestring, urlencode, implements_bool
|
||||
from gluon.utils import local_html_escape
|
||||
import marshal
|
||||
|
||||
@@ -127,7 +127,7 @@ def xmlescape(data, quote=True):
|
||||
data=str(data)
|
||||
data = to_bytes(data, 'utf8', 'xmlcharrefreplace')
|
||||
|
||||
|
||||
|
||||
# ... and do the escaping
|
||||
data = local_html_escape(data, quote)
|
||||
return data
|
||||
@@ -945,7 +945,7 @@ class DIV(XmlComponent):
|
||||
fa = b''
|
||||
for name, value in attr:
|
||||
fa += (b' %s="%s"') % (to_bytes(name), xmlescape(value, True))
|
||||
|
||||
|
||||
# get the xml for the inner components
|
||||
co = b''.join([xmlescape(component) for component in self.components])
|
||||
return (fa, co)
|
||||
@@ -975,7 +975,7 @@ class DIV(XmlComponent):
|
||||
"""
|
||||
# In PY3 __str__ cannot return bytes (TypeError: __str__ returned non-string (type bytes))
|
||||
return to_native(self.xml())
|
||||
|
||||
|
||||
def flatten(self, render=None):
|
||||
"""
|
||||
Returns the text stored by the DIV object rendered by the render function
|
||||
@@ -1440,7 +1440,7 @@ class STYLE(DIV):
|
||||
|
||||
def xml(self):
|
||||
(fa, co) = self._xml()
|
||||
fa = to_native(fa)
|
||||
fa = to_native(fa)
|
||||
# no escaping of subcomponents
|
||||
co = '\n'.join([str(component) for component in
|
||||
self.components])
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ HTTP statuses helpers
|
||||
"""
|
||||
|
||||
import re
|
||||
from pydal._compat import iteritems
|
||||
from gluon._compat import iteritems
|
||||
|
||||
__all__ = ['HTTP', 'redirect']
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ from threading import RLock
|
||||
from gluon.utf8 import Utf8
|
||||
from gluon.utils import local_html_escape
|
||||
|
||||
from pydal._compat import copyreg, PY2, maketrans, iterkeys, unicodeT, to_unicode, to_bytes, iteritems, to_native, pjoin
|
||||
from gluon._compat import copyreg, PY2, maketrans, iterkeys, unicodeT, to_unicode, to_bytes, iteritems, to_native, pjoin
|
||||
from pydal.contrib.portalocker import read_locked, LockedFile
|
||||
|
||||
from gluon.fileutils import listdir
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ import socket
|
||||
import random
|
||||
import string
|
||||
|
||||
from pydal._compat import Cookie, urllib2
|
||||
from gluon._compat import Cookie, urllib2
|
||||
#from thread import allocate_lock
|
||||
|
||||
from gluon.fileutils import abspath, write_file
|
||||
|
||||
+1
-1
Submodule gluon/packages/dal updated: 79ec4e99d0...77e0d3f386
+1
-1
@@ -10,7 +10,7 @@ Generates names for cache and session files
|
||||
--------------------------------------------
|
||||
"""
|
||||
import os
|
||||
from pydal._compat import builtin
|
||||
from gluon._compat import builtin
|
||||
|
||||
def generate(filename, depth=2, base=512):
|
||||
if os.path.sep in filename:
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ Restricted environment to execute application's code
|
||||
"""
|
||||
|
||||
import sys
|
||||
from pydal._compat import pickle, ClassType
|
||||
from gluon._compat import pickle, ClassType
|
||||
import traceback
|
||||
import types
|
||||
import os
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ from gluon.storage import Storage, List
|
||||
from gluon.http import HTTP
|
||||
from gluon.fileutils import abspath, read_file
|
||||
from gluon.settings import global_settings
|
||||
from pydal._compat import urllib_unquote, urllib_quote, iteritems, xrange
|
||||
from gluon._compat import urllib_unquote, urllib_quote, iteritems, xrange
|
||||
|
||||
isdir = os.path.isdir
|
||||
isfile = os.path.isfile
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import errno
|
||||
import socket
|
||||
import logging
|
||||
import platform
|
||||
from pydal._compat import iteritems, to_bytes, StringIO, urllib_unquote
|
||||
from gluon._compat import iteritems, to_bytes, StringIO, urllib_unquote
|
||||
|
||||
# Define Constants
|
||||
VERSION = '1.2.6'
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ Cross-site scripting (XSS) defense
|
||||
-----------------------------------
|
||||
"""
|
||||
|
||||
from pydal._compat import HTMLParser, urlparse, entitydefs, basestring
|
||||
from gluon._compat import HTMLParser, urlparse, entitydefs, basestring
|
||||
from cgi import escape
|
||||
from formatter import AbstractFormatter
|
||||
from xml.sax.saxutils import quoteattr
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ from json import loads, dumps
|
||||
from gluon import DAL, Field, IS_NOT_EMPTY, IS_IN_SET, IS_NOT_IN_DB, IS_EMPTY_OR
|
||||
from gluon import IS_INT_IN_RANGE, IS_DATETIME, IS_IN_DB
|
||||
from gluon.utils import web2py_uuid
|
||||
from pydal._compat import Queue, long, iteritems
|
||||
from gluon._compat import Queue, long, iteritems
|
||||
from gluon.storage import Storage
|
||||
|
||||
USAGE = """
|
||||
|
||||
@@ -10,7 +10,7 @@ from gluon.html import TAG, XmlComponent, xmlescape
|
||||
from gluon.languages import lazyT
|
||||
import gluon.contrib.rss2 as rss2
|
||||
import json as json_parser
|
||||
from pydal._compat import long, to_native, unicodeT
|
||||
from gluon._compat import long, to_native, unicodeT
|
||||
|
||||
have_yaml = True
|
||||
try:
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ import os
|
||||
import sys
|
||||
import platform
|
||||
from gluon.storage import Storage
|
||||
from pydal._compat import PY2
|
||||
from gluon._compat import PY2
|
||||
|
||||
global_settings = Storage()
|
||||
settings = global_settings # legacy compatibility
|
||||
@@ -41,5 +41,5 @@ global_settings.is_jython = \
|
||||
|
||||
global_settings.is_source = os.path.exists(os.path.join(
|
||||
global_settings.gluon_parent, 'web2py.py'))
|
||||
|
||||
|
||||
global_settings.is_py2 = PY2
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ from gluon.globals import Request, Response, Session
|
||||
from gluon.storage import Storage, List
|
||||
from gluon.admin import w2p_unpack
|
||||
from pydal.base import BaseAdapter
|
||||
from pydal._compat import iteritems, ClassType
|
||||
from gluon._compat import iteritems, ClassType
|
||||
|
||||
logger = logging.getLogger("web2py")
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ import urllib
|
||||
import re
|
||||
|
||||
import os
|
||||
from pydal._compat import StringIO, unichr, urllib_quote, iteritems, basestring, long, unicodeT, to_native
|
||||
from gluon._compat import StringIO, unichr, urllib_quote, iteritems, basestring, long, unicodeT, to_native
|
||||
from gluon.http import HTTP, redirect
|
||||
from gluon.html import XmlComponent, truncate_string
|
||||
from gluon.html import XML, SPAN, TAG, A, DIV, CAT, UL, LI, TEXTAREA, BR, IMG
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ Provides:
|
||||
"""
|
||||
|
||||
from pydal.contrib import portalocker
|
||||
from pydal._compat import copyreg, pickle, PY2
|
||||
from gluon._compat import copyreg, pickle, PY2
|
||||
|
||||
__all__ = ['List', 'Storage', 'Settings', 'Messages',
|
||||
'StorageList', 'load_storage', 'save_storage']
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import re
|
||||
import errno
|
||||
from gluon.http import HTTP
|
||||
from gluon.contenttype import contenttype
|
||||
from pydal._compat import PY2
|
||||
from gluon._compat import PY2
|
||||
|
||||
|
||||
regex_start_range = re.compile('\d+(?=\-)')
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import os
|
||||
import cgi
|
||||
import logging
|
||||
from re import compile, sub, escape, DOTALL
|
||||
from pydal._compat import StringIO, unicodeT, to_unicode, to_bytes, to_native
|
||||
from gluon._compat import StringIO, unicodeT, to_unicode, to_bytes, to_native
|
||||
|
||||
try:
|
||||
# have web2py
|
||||
|
||||
@@ -11,7 +11,7 @@ from .fix_path import fix_sys_path
|
||||
fix_sys_path(__file__)
|
||||
|
||||
from gluon.contenttype import contenttype
|
||||
from pydal._compat import iteritems
|
||||
from gluon._compat import iteritems
|
||||
|
||||
class TestContentType(unittest.TestCase):
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import os
|
||||
from .fix_path import fix_sys_path
|
||||
|
||||
fix_sys_path(__file__)
|
||||
from pydal._compat import to_bytes
|
||||
from gluon._compat import to_bytes
|
||||
from gluon.storage import Storage
|
||||
from gluon.contrib import fpdf as fpdf
|
||||
from gluon.contrib import pyfpdf as pyfpdf
|
||||
|
||||
@@ -34,7 +34,7 @@ class TestDALSubclass(unittest.TestCase):
|
||||
db.close()
|
||||
|
||||
def testSerialization(self):
|
||||
from pydal._compat import pickle
|
||||
from gluon._compat import pickle
|
||||
db = DAL(check_reserved=['all'])
|
||||
db.define_table('t_a', Field('f_a'))
|
||||
db.t_a.insert(f_a='test')
|
||||
|
||||
@@ -14,7 +14,7 @@ fix_sys_path(__file__)
|
||||
|
||||
from gluon.globals import Request, Response, Session
|
||||
from gluon import URL
|
||||
from pydal._compat import basestring
|
||||
from gluon._compat import basestring
|
||||
|
||||
def setup_clean_session():
|
||||
request = Request(env={})
|
||||
|
||||
@@ -17,7 +17,7 @@ from gluon.html import STYLE, TABLE, TR, TD, TAG, TBODY, THEAD, TEXTAREA, TFOOT,
|
||||
from gluon.storage import Storage
|
||||
from gluon.html import XML_pickle, XML_unpickle
|
||||
from gluon.html import TAG_pickler, TAG_unpickler
|
||||
from pydal._compat import xrange, PY2, to_native
|
||||
from gluon._compat import xrange, PY2, to_native
|
||||
|
||||
class TestBareHelpers(unittest.TestCase):
|
||||
|
||||
@@ -676,7 +676,7 @@ class TestBareHelpers(unittest.TestCase):
|
||||
# TODO: def test_markdown_serializer(self):
|
||||
|
||||
# TODO: def test_markmin_serializer(self):
|
||||
|
||||
|
||||
@unittest.skipIf(not PY2, "Skipping Python 3.x tests for MARKMIN")
|
||||
def test_MARKMIN(self):
|
||||
# This test pass with python 2.7 but expected to fail under 2.6
|
||||
|
||||
@@ -15,7 +15,7 @@ from .fix_path import fix_sys_path
|
||||
fix_sys_path(__file__)
|
||||
|
||||
from gluon import languages
|
||||
from pydal._compat import PY2
|
||||
from gluon._compat import PY2
|
||||
|
||||
MP_WORKING = 0
|
||||
try:
|
||||
|
||||
@@ -21,7 +21,7 @@ from gluon.fileutils import abspath
|
||||
from gluon.settings import global_settings
|
||||
from gluon.http import HTTP
|
||||
from gluon.storage import Storage
|
||||
from pydal._compat import to_bytes, to_native, PY2
|
||||
from gluon._compat import to_bytes, to_native, PY2
|
||||
|
||||
logger = None
|
||||
oldcwd = None
|
||||
|
||||
@@ -21,7 +21,7 @@ from gluon.fileutils import abspath
|
||||
from gluon.settings import global_settings
|
||||
from gluon.http import HTTP
|
||||
from gluon.storage import Storage
|
||||
from pydal._compat import to_bytes
|
||||
from gluon._compat import to_bytes
|
||||
|
||||
logger = None
|
||||
oldcwd = None
|
||||
|
||||
@@ -10,7 +10,7 @@ fix_sys_path(__file__)
|
||||
|
||||
from gluon.storage import Storage, StorageList, List
|
||||
from gluon.http import HTTP
|
||||
from pydal._compat import pickle
|
||||
from gluon._compat import pickle
|
||||
|
||||
|
||||
class TestStorage(unittest.TestCase):
|
||||
|
||||
@@ -66,7 +66,7 @@ class TestTemplate(unittest.TestCase):
|
||||
def testWithDummyFileSystem(self):
|
||||
from os.path import join as pjoin
|
||||
import contextlib
|
||||
from pydal._compat import StringIO
|
||||
from gluon._compat import StringIO
|
||||
from gluon.restricted import RestrictedError
|
||||
|
||||
@contextlib.contextmanager
|
||||
|
||||
@@ -22,7 +22,7 @@ from gluon.dal import DAL, Field
|
||||
from pydal.objects import Table
|
||||
from gluon import tools
|
||||
from gluon.tools import Auth, Mail, Recaptcha, Recaptcha2, prettydate, Expose
|
||||
from pydal._compat import PY2
|
||||
from gluon._compat import PY2
|
||||
from gluon.globals import Request, Response, Session
|
||||
from gluon.storage import Storage
|
||||
from gluon.languages import translator
|
||||
|
||||
@@ -13,7 +13,7 @@ fix_sys_path(__file__)
|
||||
|
||||
|
||||
from gluon.validators import *
|
||||
from pydal._compat import PY2, to_bytes
|
||||
from gluon._compat import PY2, to_bytes
|
||||
|
||||
class TestValidators(unittest.TestCase):
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ from .fix_path import fix_sys_path
|
||||
fix_sys_path(__file__)
|
||||
|
||||
from gluon.contrib.webclient import WebClient
|
||||
from pydal._compat import urllib2, PY2
|
||||
from gluon._compat import urllib2, PY2
|
||||
|
||||
webserverprocess = None
|
||||
|
||||
|
||||
+6
-6
@@ -12,7 +12,7 @@ Auth, Mail, PluginManager and various utilities
|
||||
|
||||
import base64
|
||||
from functools import reduce
|
||||
from pydal._compat import pickle, thread, urllib2, Cookie, StringIO, configparser, MIMEBase, MIMEMultipart, \
|
||||
from gluon._compat import pickle, thread, urllib2, Cookie, StringIO, configparser, MIMEBase, MIMEMultipart, \
|
||||
MIMEText, Encoders, Charset, long, urllib_quote, iteritems, to_bytes, to_native, add_charset, \
|
||||
charset_QP, basestring, unicodeT, to_unicode
|
||||
import datetime
|
||||
@@ -1193,7 +1193,7 @@ class AuthJWT(object):
|
||||
return '%s$%s' % (request.now, auth.user_id)
|
||||
|
||||
return "No auth info!"
|
||||
|
||||
|
||||
|
||||
"""
|
||||
|
||||
@@ -1246,7 +1246,7 @@ class AuthJWT(object):
|
||||
self.before_authorization = before_authorization
|
||||
self.max_header_length = max_header_length
|
||||
self.recvd_token = None
|
||||
|
||||
|
||||
@staticmethod
|
||||
def jwt_b64e(string):
|
||||
string = to_bytes(string)
|
||||
@@ -1362,7 +1362,7 @@ class AuthJWT(object):
|
||||
"""
|
||||
The part that issues (and refreshes) tokens.
|
||||
Used in a controller, given myjwt is the istantiated class, as
|
||||
|
||||
|
||||
@myjwt.allow_jwt(required=False, verify_expiration=False)
|
||||
def api_auth():
|
||||
return myjwt.jwt_token_manager()
|
||||
@@ -1440,7 +1440,7 @@ class AuthJWT(object):
|
||||
|
||||
self.recvd_token = token
|
||||
return token
|
||||
|
||||
|
||||
def allows_jwt(self, otherwise=None, required=True, verify_expiration=True, token_param='_token'):
|
||||
"""
|
||||
The decorator that takes care of injecting auth info in the decorated action.
|
||||
@@ -1832,7 +1832,7 @@ class Auth(object):
|
||||
# ## what happens after registration?
|
||||
|
||||
settings = self.settings = Settings()
|
||||
settings.update(Auth.default_settings)
|
||||
settings.update(Auth.default_settings)
|
||||
host = self.select_host(request.env.http_host, host_names)
|
||||
settings.update(
|
||||
cas_domains=[host],
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ Utilities and class for UTF8 strings managing
|
||||
----------------------------------------------
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from pydal._compat import builtin as __builtin__, unicodeT, iteritems, to_unicode, to_native
|
||||
from gluon._compat import builtin as __builtin__, unicodeT, iteritems, to_unicode, to_native
|
||||
|
||||
__all__ = ['Utf8']
|
||||
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import logging
|
||||
import socket
|
||||
import base64
|
||||
import zlib
|
||||
from pydal._compat import basestring, pickle, PY2, xrange, to_bytes, to_native
|
||||
from gluon._compat import basestring, pickle, PY2, xrange, to_bytes, to_native
|
||||
|
||||
_struct_2_long_long = struct.Struct('=QQ')
|
||||
|
||||
@@ -370,7 +370,7 @@ def local_html_escape(data, quote=False):
|
||||
translated.
|
||||
"""
|
||||
if PY2:
|
||||
import cgi
|
||||
import cgi
|
||||
data = cgi.escape(data, quote)
|
||||
return data.replace("'", "'") if quote else data
|
||||
else:
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import urllib
|
||||
import struct
|
||||
import decimal
|
||||
import unicodedata
|
||||
from pydal._compat import StringIO, long, unicodeT, to_unicode, urllib_unquote, unichr, to_bytes, PY2, to_unicode, to_native
|
||||
from gluon._compat import StringIO, long, unicodeT, to_unicode, urllib_unquote, unichr, to_bytes, PY2, to_unicode, to_native
|
||||
from gluon.utils import simple_hash, web2py_uuid, DIGEST_ALG_BY_SIZE
|
||||
from pydal.objects import Field, FieldVirtual, FieldMethod
|
||||
from functools import reduce
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ from __future__ import print_function
|
||||
|
||||
import datetime
|
||||
import sys
|
||||
from pydal._compat import StringIO, thread, xrange
|
||||
from gluon._compat import StringIO, thread, xrange
|
||||
import time
|
||||
import threading
|
||||
import os
|
||||
@@ -935,7 +935,7 @@ def console():
|
||||
sys.argv, other_args = sys.argv[:k], sys.argv[k + 1:]
|
||||
(options, args) = parser.parse_args()
|
||||
options.args = [options.run] + other_args
|
||||
|
||||
|
||||
copy_options = copy.deepcopy(options)
|
||||
copy_options.password = '******'
|
||||
global_settings.cmd_options = copy_options
|
||||
|
||||
Reference in New Issue
Block a user