--- gluon/compileapp.py +++ gluon/compileapp.py @@ -61,7 +61,7 @@ TEST_CODE = \ r""" def _TEST(): - import doctest, sys, cStringIO, types, cgi, gluon.fileutils + import doctest, sys, cStringIO, types, gluon.fileutils if not gluon.fileutils.check_credentials(request): raise HTTP(401, web2py_error='invalid credentials') stdout = sys.stdout --- gluon/globals.py +++ gluon/globals.py @@ -241,7 +241,15 @@ # parse POST variables on POST, PUT, BOTH only in post_vars if body and not is_json and env.request_method in ('POST', 'PUT', 'DELETE', 'BOTH'): query_string = env.pop('QUERY_STRING', None) - dpost = cgi.FieldStorage(fp=body, environ=env, keep_blank_values=1) + content_disposition = env.get('HTTP_CONTENT_DISPOSITION') + if content_disposition: + headers = {'content-disposition': content_disposition, + 'content-type': env['CONTENT_TYPE'], + 'content-length': env['CONTENT_LENGTH'], + } + else: + headers = None + dpost = cgi.FieldStorage(fp=body, environ=env, headers=headers, keep_blank_values=1) try: post_vars.update(dpost) except: --- gluon/languages.py +++ gluon/languages.py @@ -16,7 +16,6 @@ import sys import pkgutil import logging -from cgi import escape from threading import RLock from pydal._compat import copyreg, PY2, maketrans, iterkeys, unicodeT, to_unicode, to_bytes, iteritems, to_native, pjoin --- gluon/packages/dal/pydal/_compat.py +++ gluon/packages/dal/pydal/_compat.py @@ -32,7 +32,6 @@ from urllib2 import urlopen from string import maketrans from types import ClassType - import cgi import cookielib from xmlrpclib import ProtocolError BytesIO = StringIO Only in web2py: gluon/packages/dal/pydal/_compat.py.orig --- gluon/packages/dal/pydal/adapters/oracle.py +++ gluon/packages/dal/pydal/adapters/oracle.py @@ -96,7 +96,7 @@ return self.dialect.quote(tablename) def _build_value_for_insert(self, field, value, r_values): - if field.type is 'text': + if field.type == 'text': r_values[':' + field._rname] = self.expand(value, field.type) return ':' + field._rname return self.expand(value, field.type) Only in web2py: gluon/packages/dal/pydal/adapters/oracle.py.orig --- gluon/packages/dal/pydal/contrib/portalocker.py +++ gluon/packages/dal/pydal/contrib/portalocker.py @@ -193,6 +193,9 @@ def read(self, size=None): return self.file.read() if size is None else self.file.read(size) + def readinto(self, b): + b[:] = self.file.read() + def readline(self): return self.file.readline() --- gluon/packages/dal/pydal/helpers/classes.py +++ gluon/packages/dal/pydal/helpers/classes.py @@ -532,6 +532,9 @@ self.p += len(data) return data + def readinto(self, bytes): + return self.read(bytes) + def readline(self): i = self.data.find('\n', self.p)+1 if i > 0: --- gluon/packages/dal/pydal/validators.py +++ gluon/packages/dal/pydal/validators.py @@ -148,7 +148,7 @@ def validator_caller(func, value): - if getattr(func, 'validate', None) is Validator.validate: + if getattr(func, 'validate', None) is not Validator.validate: return func.validate(value) value, error = func(value) if error is not None: @@ -3154,7 +3154,7 @@ if not all_special.count(True) >= self.special: failures.append(self.translator("Must include at least %s of the following: %s") % (self.special, self.specials)) - elif self.special is 0: + elif self.special == 0 and self.special is not False: if len(all_special) > 0: failures.append(self.translator("May not contain any of the following: %s") % self.specials) @@ -3169,7 +3169,7 @@ if not len(all_upper) >= self.upper: failures.append(self.translator("Must include at least %s uppercase") % str(self.upper)) - elif self.upper is 0: + elif self.upper == 0 and self.upper is not False: if len(all_upper) > 0: failures.append( self.translator("May not include any uppercase letters")) @@ -3179,7 +3179,7 @@ if not len(all_lower) >= self.lower: failures.append(self.translator("Must include at least %s lowercase") % str(self.lower)) - elif self.lower is 0: + elif self.lower == 0 and self.lower is not False: if len(all_lower) > 0: failures.append( self.translator("May not include any lowercase letters")) @@ -3192,7 +3192,7 @@ if not len(all_number) >= self.number: failures.append(self.translator("Must include at least %s %s") % (str(self.number), numbers)) - elif self.number is 0: + elif self.number == 0 and self.number is not False: if len(all_number) > 0: failures.append(self.translator("May not include any numbers")) if len(failures) == 0: