This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SQLObject development repository".
The branch, master has been updated
via 18b036ee1067eb9e9fd5336fb8e6eb16588574c0 (commit)
via 626472a65563ca28caca184fc5f8268dfa9217a0 (commit)
via a5961c761cf764e77d34fac4a53591276c663678 (commit)
via 07d1c3d453ebb49235577ccf0d66114622d0e0ff (commit)
via 5b03947bb4b471c1d519a279112a4e1ff2ff18cb (commit)
via 6abfcc4936a5005a736dac22f44d776f85b71c37 (commit)
via 2c103048123f30df2266401ae8362aa03a7230aa (commit)
via af42f3378aacc17f8cdbbb704cbd9a232e6f77be (commit)
via e0943b1d41c03183741850ffc23f79891e3145aa (commit)
via b16601f7ba87b20b0fb5e467a3d2a82a784c2f97 (commit)
from 0bc786ee9f223b60165c71d76f1626e37e3bcc91 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceforge.net/p/sqlobject/sqlobject/ci/18b036ee1067eb9e9fd5336fb8e6eb16588574c0
commit 18b036ee1067eb9e9fd5336fb8e6eb16588574c0
Author: Oleg Broytman <ph...@ph...>
Date: Sat Mar 21 10:08:08 2015 +0300
Fix tuple syntax
diff --git a/sqlobject/tests/test_validation.py b/sqlobject/tests/test_validation.py
index fd22348..c10d99d 100644
--- a/sqlobject/tests/test_validation.py
+++ b/sqlobject/tests/test_validation.py
@@ -98,7 +98,7 @@ class TestValidation:
assert getattr(t, name) == value
if PY2:
for name, cls, value in (
- ('name7', SOValidationTestUnicode, u'test')):
+ ('name7', SOValidationTestUnicode, u'test'),):
setattr(t, name, cls(value))
assert getattr(t, name) == value
http://sourceforge.net/p/sqlobject/sqlobject/ci/626472a65563ca28caca184fc5f8268dfa9217a0
commit 626472a65563ca28caca184fc5f8268dfa9217a0
Author: Oleg Broytman <ph...@ph...>
Date: Sat Mar 21 10:05:44 2015 +0300
Fix __unicode__: it's only meaningful under Python 2
diff --git a/sqlobject/tests/test_validation.py b/sqlobject/tests/test_validation.py
index 31f3cf8..fd22348 100644
--- a/sqlobject/tests/test_validation.py
+++ b/sqlobject/tests/test_validation.py
@@ -48,9 +48,10 @@ class SOValidationTest(object):
self.value = value
-class SOValidationTestUnicode(SOValidationTest):
- def __unicode__(self):
- return self.value
+if PY2:
+ class SOValidationTestUnicode(SOValidationTest):
+ def __unicode__(self):
+ return self.value
class SOValidationTestInt(SOValidationTest):
@@ -92,10 +93,14 @@ class TestValidation:
for name, cls, value in (
('name4', SOValidationTestFloat, 1.1),
('name6', SOValidationTestBool, True),
- ('name7', SOValidationTestUnicode, u'test'),
('name8', SOValidationTestInt, 1)):
setattr(t, name, cls(value))
assert getattr(t, name) == value
+ if PY2:
+ for name, cls, value in (
+ ('name7', SOValidationTestUnicode, u'test')):
+ setattr(t, name, cls(value))
+ assert getattr(t, name) == value
def test_wrapType(self):
t = SOValidation(name3=1)
http://sourceforge.net/p/sqlobject/sqlobject/ci/a5961c761cf764e77d34fac4a53591276c663678
commit a5961c761cf764e77d34fac4a53591276c663678
Author: Oleg Broytman <ph...@ph...>
Date: Sat Mar 21 09:34:20 2015 +0300
Create unicode alias to satisfy flake8 under python 3
diff --git a/sqlobject/col.py b/sqlobject/col.py
index f392cd8..46cf951 100644
--- a/sqlobject/col.py
+++ b/sqlobject/col.py
@@ -74,8 +74,10 @@ if mxdatetime_available:
default_datetime_implementation = DATETIME_IMPLEMENTATION
if not PY2:
- # alias for python 3 compatability
+ # alias for python 3 compatibility
long = int
+ # This is to satisfy flake8 under python 3
+ unicode = str
NoDefault = sqlbuilder.NoDefault
http://sourceforge.net/p/sqlobject/sqlobject/ci/07d1c3d453ebb49235577ccf0d66114622d0e0ff
commit 07d1c3d453ebb49235577ccf0d66114622d0e0ff
Author: Oleg Broytman <ph...@ph...>
Date: Sat Mar 21 09:29:45 2015 +0300
Simplify and unify testing of sys.version
diff --git a/sqlobject/col.py b/sqlobject/col.py
index 2a7f923..f392cd8 100644
--- a/sqlobject/col.py
+++ b/sqlobject/col.py
@@ -21,7 +21,6 @@ are what gets used.
from array import array
from decimal import Decimal
from itertools import count
-import sys
import time
try:
import cPickle as pickle
@@ -36,7 +35,7 @@ from .classregistry import findClass
from . import constraints as constrs
from . import sqlbuilder
from .styles import capword
-from .compat import string_type, unicode_type, buffer_type
+from .compat import PY2, string_type, unicode_type, buffer_type
import datetime
datetime_available = True
@@ -74,7 +73,7 @@ if mxdatetime_available:
default_datetime_implementation = DATETIME_IMPLEMENTATION
-if sys.version_info[0] > 2:
+if not PY2:
# alias for python 3 compatability
long = int
@@ -565,7 +564,7 @@ class StringValidator(SOValidator):
binaryType = type(None) # Just a simple workaround
dbEncoding = self.getDbEncoding(state, default='ascii')
if isinstance(value, unicode_type):
- if sys.version_info[0] < 3:
+ if PY2:
return value.encode(dbEncoding)
return value
if self.dataType and isinstance(value, self.dataType):
@@ -576,8 +575,7 @@ class StringValidator(SOValidator):
return value
if hasattr(value, '__unicode__'):
return unicode(value).encode(dbEncoding)
- if dbName == 'mysql' and sys.version_info[0] > 2 and \
- isinstance(value, bytes):
+ if dbName == 'mysql' and not PY2 and isinstance(value, bytes):
return value.decode('ascii', errors='surrogateescape')
raise validators.Invalid(
"expected a str in the StringCol '%s', got %s %r instead" % (
@@ -1038,7 +1036,7 @@ class EnumValidator(SOValidator):
if value in self.enumValues:
# Only encode on python 2 - on python 3, the database driver
# will handle this
- if isinstance(value, unicode_type) and sys.version_info[0] == 2:
+ if isinstance(value, unicode_type) and PY2:
dbEncoding = self.getDbEncoding(state)
value = value.encode(dbEncoding)
return value
@@ -1675,10 +1673,10 @@ class BinaryValidator(SOValidator):
binaryType = connection._binaryType
if isinstance(value, str):
if dbName == "sqlite":
- if sys.version_info[0] > 2:
+ if not PY2:
value = bytes(value, 'ascii')
value = connection.module.decode(value)
- if dbName == "mysql" and sys.version_info[0] > 2:
+ if dbName == "mysql" and not PY2:
value = value.encode('ascii', errors='surrogateescape')
return value
if isinstance(value, (buffer_type, binaryType)):
@@ -1687,7 +1685,7 @@ class BinaryValidator(SOValidator):
return cachedValue[0]
if isinstance(value, array): # MySQL
return value.tostring()
- if sys.version_info[0] > 2 and isinstance(value, memoryview):
+ if not PY2 and isinstance(value, memoryview):
return value.tobytes()
return str(value) # buffer => string
raise validators.Invalid(
@@ -1699,7 +1697,7 @@ class BinaryValidator(SOValidator):
return None
connection = state.connection or state.soObject._connection
binary = connection.createBinary(value)
- if sys.version_info[0] > 2 and isinstance(binary, memoryview):
+ if not PY2 and isinstance(binary, memoryview):
binary = str(binary.tobytes(), 'ascii')
self._cachedValue = (value, binary)
return binary
diff --git a/sqlobject/compat.py b/sqlobject/compat.py
index fe7b8d4..6b7d71b 100644
--- a/sqlobject/compat.py
+++ b/sqlobject/compat.py
@@ -17,7 +17,8 @@ def with_metaclass(meta, *bases):
return type.__new__(metaclass, 'temporary_class', (), {})
# Compatability definitions (inspired by six)
-if sys.version_info[0] < 3:
+PY2 = sys.version_info[0] < 3
+if PY2:
# disable flake8 checks on python 3
string_type = basestring # noqa
unicode_type = unicode # noqa
@@ -26,5 +27,5 @@ if sys.version_info[0] < 3:
else:
string_type = str
unicode_type = str
- class_types = (type, )
+ class_types = (type,)
buffer_type = memoryview
diff --git a/sqlobject/constraints.py b/sqlobject/constraints.py
index 9a77983..9241579 100644
--- a/sqlobject/constraints.py
+++ b/sqlobject/constraints.py
@@ -2,8 +2,9 @@
Constraints
"""
-import sys
-if sys.version_info[0] > 2:
+from sqlobject.compat import PY2
+
+if not PY2:
# alias for python 3 compatability
long = int
diff --git a/sqlobject/converters.py b/sqlobject/converters.py
index 1383c41..aa08ba3 100644
--- a/sqlobject/converters.py
+++ b/sqlobject/converters.py
@@ -3,8 +3,9 @@ import datetime
from decimal import Decimal
import time
import sys
-from .compat import buffer_type
-if sys.version_info[0] < 3:
+from .compat import PY2, buffer_type
+
+if PY2:
from types import ClassType, InstanceType, NoneType
else:
# Use suitable aliases for now
@@ -57,7 +58,7 @@ class ConverterRegistry:
else:
self.basic[typ] = func
- if sys.version_info[0] < 3:
+ if PY2:
def lookupConverter(self, value, default=None):
if type(value) is InstanceType:
# lookup on klasses dict
@@ -95,11 +96,11 @@ def StringLikeConverter(value, db):
return "'%s'" % value
registerConverter(str, StringLikeConverter)
-if sys.version_info[0] < 3:
+if PY2:
# noqa for flake8 & python3
registerConverter(unicode, StringLikeConverter) # noqa
registerConverter(array, StringLikeConverter)
-if sys.version_info[0] < 3:
+if PY2:
registerConverter(buffer_type, StringLikeConverter)
else:
registerConverter(memoryview, StringLikeConverter)
diff --git a/sqlobject/dbconnection.py b/sqlobject/dbconnection.py
index ef34be8..f5baaf5 100644
--- a/sqlobject/dbconnection.py
+++ b/sqlobject/dbconnection.py
@@ -19,7 +19,7 @@ from . import col
from .converters import sqlrepr
from . import sqlbuilder
from .util.threadinglocal import local as threading_local
-from .compat import string_type, unicode_type
+from .compat import PY2, string_type, unicode_type
warnings.filterwarnings("ignore", "DB-API extension cursor.lastrowid used")
@@ -40,7 +40,7 @@ class ConsoleWriter:
def write(self, text):
logfile = getattr(sys, self.loglevel)
- if isinstance(text, unicode_type) and sys.version_info[0] < 3:
+ if PY2 and isinstance(text, unicode_type):
try:
text = text.encode(self.dbEncoding)
except UnicodeEncodeError:
@@ -210,7 +210,7 @@ class DBConnection:
@staticmethod
def _parseURI(uri):
parsed = urlparse(uri)
- if sys.version_info[0] == 2 and sys.version_info[1] < 7:
+ if sys.version_info[0:2] == (2, 6):
# In python 2.6, urlparse only parses the uri completely
# for certain schemes, so we force the scheme to
# something that will be parsed correctly
@@ -833,7 +833,7 @@ class Transaction(object):
if cls not in self._deletedCache:
self._deletedCache[cls] = []
self._deletedCache[cls].append(inst.id)
- if sys.version_info[0] < 3:
+ if PY2:
meth = types.MethodType(self._dbConnection._SO_delete.__func__,
self, self.__class__)
else:
@@ -891,7 +891,7 @@ class Transaction(object):
else:
return attr
else:
- if sys.version_info[0] < 3:
+ if PY2:
meth = types.MethodType(func, self, self.__class__)
else:
meth = types.MethodType(func, self)
diff --git a/sqlobject/dberrors.py b/sqlobject/dberrors.py
index 2feedbc..c4560dc 100644
--- a/sqlobject/dberrors.py
+++ b/sqlobject/dberrors.py
@@ -5,8 +5,9 @@
http://www.python.org/topics/database/DatabaseAPI-2.0.html
"""
-import sys
-if sys.version_info[0] >= 3:
+from sqlobject.compat import PY2
+
+if not PY2:
StandardError = Exception
diff --git a/sqlobject/include/hashcol.py b/sqlobject/include/hashcol.py
index d0e55a1..b4f1383 100644
--- a/sqlobject/include/hashcol.py
+++ b/sqlobject/include/hashcol.py
@@ -1,6 +1,5 @@
-import sys
import sqlobject.col
-from sqlobject.compat import string_type
+from sqlobject.compat import PY2, string_type
__all__ = ['HashCol']
@@ -83,7 +82,7 @@ class SOHashCol(sqlobject.col.SOStringCol):
def __init__(self, **kw):
if 'hashMethod' not in kw:
from hashlib import md5
- if sys.version_info[0] == 2:
+ if PY2:
self.hashMethod = lambda v: md5(v).hexdigest()
else:
self.hashMethod = lambda v: md5(v.encode('utf8')).hexdigest()
diff --git a/sqlobject/include/tests/test_hashcol.py b/sqlobject/include/tests/test_hashcol.py
index 0e9794c..d7c199f 100644
--- a/sqlobject/include/tests/test_hashcol.py
+++ b/sqlobject/include/tests/test_hashcol.py
@@ -1,14 +1,14 @@
-import sys
+from hashlib import sha256, md5
from sqlobject import *
-from sqlobject.tests.dbtest import *
+from sqlobject.compat import PY2
from sqlobject.include import hashcol
-from hashlib import sha256, md5
+from sqlobject.tests.dbtest import *
########################################
# HashCol test
########################################
-if sys.version_info[0] == 2:
+if PY2:
def sha256_str(x):
return sha256(x).hexdigest()
diff --git a/sqlobject/main.py b/sqlobject/main.py
index 276ec1c..0a50668 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -41,13 +41,13 @@ from . import declarative
from . import events
from .sresults import SelectResults
from .util.threadinglocal import local
-from sqlobject.compat import with_metaclass, string_type, unicode_type
+from sqlobject.compat import PY2, with_metaclass, string_type, unicode_type
-if ((sys.version_info[0] == 2) and (sys.version_info[:3] < (2, 6, 0))) or \
- ((sys.version_info[0] == 3) and (sys.version_info[:3] < (3, 4, 0))):
+if ((sys.version_info[0] == 2) and (sys.version_info[:2] < (2, 6))) or \
+ ((sys.version_info[0] == 3) and (sys.version_info[:2] < (3, 4))):
raise ImportError("SQLObject requires Python 2.6, 2.7 or 3.4+")
-if sys.version_info[0] > 2:
+if not PY2:
# alias for python 3 compatability
long = int
@@ -475,8 +475,7 @@ class sqlmeta(with_metaclass(declarative.DeclarativeMeta, object)):
conn = connection or soClass._connection
for columnDef in conn.columnsFromSchema(sqlmeta.table, soClass):
if columnDef.name not in sqlmeta.columnDefinitions:
- if isinstance(columnDef.name, unicode_type) and \
- sys.version_info[0] == 2:
+ if isinstance(columnDef.name, unicode_type) and PY2:
columnDef.name = columnDef.name.encode('ascii')
sqlmeta.addColumn(columnDef)
@@ -694,8 +693,8 @@ def deprecated(message, level=1, stacklevel=2):
if warnings_level is not None and warnings_level <= level:
warnings.warn(message, DeprecationWarning, stacklevel=stacklevel)
-# if sys.version_info[:3] < (2, 5, 0):
-# deprecated("Support for Python 2.4 has been declared obsolete "
+# if sys.version_info[:2] < (2, 6):
+# deprecated("Support for Python 2.5 has been declared obsolete "
# "and will be removed in the next release of SQLObject")
diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py
index 9ae271d..2b7bc21 100755
--- a/sqlobject/manager/command.py
+++ b/sqlobject/manager/command.py
@@ -20,7 +20,7 @@ from sqlobject import col
from sqlobject.classregistry import findClass
from sqlobject.declarative import DeclarativeMeta
from sqlobject.util import moduleloader
-from sqlobject.compat import with_metaclass, string_type
+from sqlobject.compat import PY2, with_metaclass, string_type
# It's not very unsafe to use tempnam like we are doing:
warnings.filterwarnings(
@@ -28,7 +28,7 @@ warnings.filterwarnings(
RuntimeWarning, '.*command', 28)
-if sys.version_info[0] == 2:
+if PY2:
# noqa for flake8 and python 3
input = raw_input # noqa
diff --git a/sqlobject/mysql/mysqlconnection.py b/sqlobject/mysql/mysqlconnection.py
index b346110..ccc4908 100644
--- a/sqlobject/mysql/mysqlconnection.py
+++ b/sqlobject/mysql/mysqlconnection.py
@@ -1,6 +1,5 @@
-import sys
-from sqlobject import col
-from sqlobject import dberrors
+from sqlobject import col, dberrors
+from sqlobject.compat import PY2
from sqlobject.dbconnection import DBAPI
@@ -49,7 +48,7 @@ class MySQLConnection(DBAPI):
self.dbEncoding = None
global mysql_Bin
- if sys.version_info[0] > 2 and mysql_Bin is None:
+ if not PY2 and mysql_Bin is None:
mysql_Bin = MySQLdb.Binary
MySQLdb.Binary = lambda x: mysql_Bin(x).decode(
'ascii', errors='surrogateescape')
diff --git a/sqlobject/sqlbuilder.py b/sqlobject/sqlbuilder.py
index bea3395..fd28c29 100644
--- a/sqlobject/sqlbuilder.py
+++ b/sqlobject/sqlbuilder.py
@@ -66,11 +66,10 @@ import re
import threading
import types
import weakref
-import sys
from . import classregistry
from .converters import registerConverter, sqlrepr, quote_str, unquote_str
-from .compat import string_type
+from .compat import PY2, string_type
class VersionError(Exception):
@@ -264,7 +263,7 @@ def tablesUsedSet(obj, db):
return {}
-if sys.version_info[0] < 3:
+if PY2:
div = operator.div
... 227 lines suppressed ...
hooks/post-receive
--
SQLObject development repository
|