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 fce408b71883cfbafada9c38c3c07328384357ec (commit)
via 7d74887a148f8d0ce180bd225fa5cc0b75fddae4 (commit)
via a5c1389a31e30ee9f0d545a694d63f3093de14ed (commit)
from fb15acc6f07eb639a4dd2be03f080ade895994da (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/fce408b71883cfbafada9c38c3c07328384357ec
commit fce408b71883cfbafada9c38c3c07328384357ec
Author: Oleg Broytman <ph...@ph...>
Date: Mon Feb 16 01:35:47 2015 +0300
Fixed URLs
diff --git a/sqlobject/compat.py b/sqlobject/compat.py
index 261b364..8828235 100644
--- a/sqlobject/compat.py
+++ b/sqlobject/compat.py
@@ -1,5 +1,5 @@
-# Credit to six authors http://pypi.python.org/pypi/
-# License http://opensource.org/licenses/MIT
+# Credit to six authors: http://pypi.python.org/pypi/six
+# License: MIT
def with_metaclass(meta, *bases):
http://sourceforge.net/p/sqlobject/sqlobject/ci/7d74887a148f8d0ce180bd225fa5cc0b75fddae4
commit 7d74887a148f8d0ce180bd225fa5cc0b75fddae4
Merge: fb15acc a5c1389
Author: Oleg Broytman <ph...@ph...>
Date: Mon Feb 16 01:32:25 2015 +0300
Merge pull request #80 from lukmdo/pytest_show_py3_errors
make pytest report py3 issues
http://sourceforge.net/p/sqlobject/sqlobject/ci/a5c1389a31e30ee9f0d545a694d63f3093de14ed
commit a5c1389a31e30ee9f0d545a694d63f3093de14ed
Author: Lukasz Dobrzanski <luk...@gm...>
Date: Sun Feb 15 02:05:55 2015 +0000
make pytest report py3 issues
diff --git a/sqlobject/compat.py b/sqlobject/compat.py
new file mode 100644
index 0000000..261b364
--- /dev/null
+++ b/sqlobject/compat.py
@@ -0,0 +1,14 @@
+# Credit to six authors http://pypi.python.org/pypi/
+# License http://opensource.org/licenses/MIT
+
+
+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):
+ def __new__(cls, name, this_bases, d):
+ return meta(name, bases, d)
+ return type.__new__(metaclass, 'temporary_class', (), {})
diff --git a/sqlobject/declarative.py b/sqlobject/declarative.py
index bc3485a..73373ef 100644
--- a/sqlobject/declarative.py
+++ b/sqlobject/declarative.py
@@ -34,6 +34,7 @@ or an instance method depending on where it is called.
import copy
from . import events
+from sqlobject.compat import with_metaclass
import itertools
counter = itertools.count()
@@ -90,21 +91,22 @@ class DeclarativeMeta(type):
for func in early_funcs:
func(cls)
if '__classinit__' in new_attrs:
- cls.__classinit__ = staticmethod(cls.__classinit__.im_func)
+ if hasattr(cls.__classinit__, '__func__'):
+ cls.__classinit__ = staticmethod(cls.__classinit__.__func__)
+ else:
+ cls.__classinit__ = staticmethod(cls.__classinit__)
cls.__classinit__(cls, new_attrs)
for func in post_funcs:
func(cls)
return cls
-class Declarative(object):
+class Declarative(with_metaclass(DeclarativeMeta, object)):
__unpackargs__ = ()
__mutableattributes__ = ()
- __metaclass__ = DeclarativeMeta
-
__restrict_attributes__ = None
def __classinit__(cls, new_attrs):
diff --git a/sqlobject/main.py b/sqlobject/main.py
index 5812b29..8cdcd22 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -25,7 +25,7 @@ License along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
USA.
"""
-
+import sys
import threading
import weakref
import types
@@ -41,8 +41,8 @@ from . import declarative
from . import events
from .sresults import SelectResults
from .util.threadinglocal import local
+from sqlobject.compat import with_metaclass
-import sys
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))):
raise ImportError("SQLObject requires Python 2.6, 2.7 or 3.4+")
@@ -50,6 +50,7 @@ if ((sys.version_info[0] == 2) and (sys.version_info[:3] < (2, 6, 0))) or \
if sys.version_info[0] > 2:
# alias for python 3 compatability
long = int
+ unicode = str
"""
This thread-local storage is needed for RowCreatedSignals. It gathers
@@ -180,8 +181,7 @@ class CreateNewSQLObject:
pass
-class sqlmeta(object):
-
+class sqlmeta(with_metaclass(declarative.DeclarativeMeta, object)):
"""
This object is the object we use to keep track of all sorts of
information. Subclasses are made for each SQLObject subclass
@@ -254,8 +254,6 @@ class sqlmeta(object):
# Default encoding for UnicodeCol's
dbEncoding = None
- __metaclass__ = declarative.DeclarativeMeta
-
def __classinit__(cls, new_attrs):
for attr in cls._unshared_attributes:
if attr not in new_attrs:
@@ -757,9 +755,7 @@ _postponed_local = local()
# MetaSQLObject.
-class SQLObject(object):
-
- __metaclass__ = declarative.DeclarativeMeta
+class SQLObject(with_metaclass(declarative.DeclarativeMeta, object)):
_connection = sqlhub
@@ -902,7 +898,7 @@ class SQLObject(object):
"(while fixing up sqlmeta %r inheritance)"
% cls.sqlmeta)
values = dict(cls.sqlmeta.__dict__)
- for key in values.keys():
+ for key in list(values.keys()):
if key.startswith('__') and key.endswith('__'):
# Magic values shouldn't be passed through:
del values[key]
@@ -1355,7 +1351,8 @@ class SQLObject(object):
# These are all the column values that were supposed
# to be set, but were delayed until now:
setters = self._SO_createValues.items()
- setters.sort(key=lambda c: self.sqlmeta.columns[c[0]].creationOrder)
+ setters = sorted(
+ setters, key=lambda c: self.sqlmeta.columns[c[0]].creationOrder)
# Here's their database names:
names = [self.sqlmeta.columns[v[0]].dbName for v in setters]
values = [v[1] for v in setters]
@@ -1734,7 +1731,7 @@ class SQLObject(object):
@classmethod
def setConnection(cls, value):
- if isinstance(value, basestring):
+ if isinstance(value, (str, unicode)):
value = dbconnection.connectionForURI(value)
cls._connection = value
diff --git a/sqlobject/manager/command.py b/sqlobject/manager/command.py
index 214c72d..0cabf56 100755
--- a/sqlobject/manager/command.py
+++ b/sqlobject/manager/command.py
@@ -20,6 +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
# It's not very unsafe to use tempnam like we are doing:
warnings.filterwarnings(
@@ -179,9 +180,7 @@ def standard_parser(connection=True, simulate=True,
return parser
-class Command(object):
-
- __metaclass__ = DeclarativeMeta
+class Command(with_metaclass(DeclarativeMeta, object)):
min_args = 0
min_args_error = 'You must provide at least %(min_args)s arguments'
diff --git a/sqlobject/tests/test_boundattributes.py b/sqlobject/tests/test_boundattributes.py
index 1ca9fab..a3c5f8f 100644
--- a/sqlobject/tests/test_boundattributes.py
+++ b/sqlobject/tests/test_boundattributes.py
@@ -6,9 +6,6 @@ pytestmark = py.test.mark.skipif('True')
class TestMe(object):
-
- # __metaclass__ = declarative.DeclarativeMeta
- # __classinit__ = boundattributes.bind_attributes_local
pass
diff --git a/sqlobject/tests/test_reparent_sqlmeta.py b/sqlobject/tests/test_reparent_sqlmeta.py
index 3244ad9..8b61dee 100644
--- a/sqlobject/tests/test_reparent_sqlmeta.py
+++ b/sqlobject/tests/test_reparent_sqlmeta.py
@@ -19,7 +19,7 @@ class Reparented2(SQLObject):
# Well, it's pretty hard to call the superclass method
# when it's a classmethod and it's not actually your
# *current* superclass. Sigh
- real_sqlmeta.setClass.im_func(cls, soClass)
+ real_sqlmeta.setClass.__func__(cls, soClass)
cls.worked = True
dummy = StringCol()
-----------------------------------------------------------------------
Summary of changes:
sqlobject/compat.py | 14 ++++++++++++++
sqlobject/declarative.py | 10 ++++++----
sqlobject/main.py | 21 +++++++++------------
sqlobject/manager/command.py | 5 ++---
sqlobject/tests/test_reparent_sqlmeta.py | 2 +-
5 files changed, 32 insertions(+), 20 deletions(-)
create mode 100644 sqlobject/compat.py
hooks/post-receive
--
SQLObject development repository
|