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 9238f42a2c13ffb41f044b33f4d4c6bfb1c05c5c (commit)
via 2c89eaee7b4d52938fb5a4d62343e538bc587c99 (commit)
via 71b7885bc1e3740adf8c07c23b41835e1e69f8a2 (commit)
via c9a97f15da4963884d13e654f901b331dae7886a (commit)
via 7827ef27ad83edb9f371c2d459020fdef9a155f1 (commit)
from 121791d3f21fc16b93b7402f3d393bfc94b9b5e8 (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/9238f42a2c13ffb41f044b33f4d4c6bfb1c05c5c
commit 9238f42a2c13ffb41f044b33f4d4c6bfb1c05c5c
Merge: 121791d 2c89eae
Author: Oleg Broytman <ph...@ph...>
Date: Mon Jan 18 20:30:09 2016 +0300
Merge pull request #117 from drnlm/bugs/issue-115-hashable-columns
Bugs/issue 115 hashable rows
http://sourceforge.net/p/sqlobject/sqlobject/ci/2c89eaee7b4d52938fb5a4d62343e538bc587c99
commit 2c89eaee7b4d52938fb5a4d62343e538bc587c99
Author: Neil <drn...@gm...>
Date: Mon Jan 18 18:08:24 2016 +0200
Fix __name__ typo
diff --git a/sqlobject/main.py b/sqlobject/main.py
index 6b8ac9b..38953d5 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -1748,7 +1748,7 @@ class SQLObject(with_metaclass(declarative.DeclarativeMeta, object)):
def __hash__(self):
# We hash on class name and id, since that should be
# unique
- return hash((self.__class__.name, self.id))
+ return hash((self.__class__.__name__, self.id))
# Comparison
http://sourceforge.net/p/sqlobject/sqlobject/ci/71b7885bc1e3740adf8c07c23b41835e1e69f8a2
commit 71b7885bc1e3740adf8c07c23b41835e1e69f8a2
Author: Neil <drn...@gm...>
Date: Mon Jan 18 17:49:28 2016 +0200
Fix flake8 warning in test case
diff --git a/sqlobject/tests/test_class_hash.py b/sqlobject/tests/test_class_hash.py
index 875f020..cc3b3aa 100644
--- a/sqlobject/tests/test_class_hash.py
+++ b/sqlobject/tests/test_class_hash.py
@@ -15,7 +15,6 @@ def test_class_hash():
setupClass(ClassHashTest)
ClassHashTest(name='bob')
- conn = ClassHashTest._connection
b = ClassHashTest.byName('bob')
hashed = hash(b)
b.expire()
http://sourceforge.net/p/sqlobject/sqlobject/ci/c9a97f15da4963884d13e654f901b331dae7886a
commit c9a97f15da4963884d13e654f901b331dae7886a
Author: Neil <drn...@gm...>
Date: Mon Jan 18 17:43:05 2016 +0200
Add simple test case for hash implementation
diff --git a/sqlobject/tests/test_class_hash.py b/sqlobject/tests/test_class_hash.py
new file mode 100644
index 0000000..875f020
--- /dev/null
+++ b/sqlobject/tests/test_class_hash.py
@@ -0,0 +1,23 @@
+from sqlobject import *
+from sqlobject.tests.dbtest import *
+
+
+########################################
+# Test hashing a column instance
+########################################
+
+
+class ClassHashTest(SQLObject):
+ name = StringCol(length=50, alternateID=True, dbName='name_col')
+
+
+def test_class_hash():
+ setupClass(ClassHashTest)
+ ClassHashTest(name='bob')
+
+ conn = ClassHashTest._connection
+ b = ClassHashTest.byName('bob')
+ hashed = hash(b)
+ b.expire()
+ b = ClassHashTest.byName('bob')
+ assert hash(b) == hashed
http://sourceforge.net/p/sqlobject/sqlobject/ci/7827ef27ad83edb9f371c2d459020fdef9a155f1
commit 7827ef27ad83edb9f371c2d459020fdef9a155f1
Author: Neil <drn...@gm...>
Date: Mon Jan 18 17:34:21 2016 +0200
Add hash function
diff --git a/sqlobject/main.py b/sqlobject/main.py
index 0a50668..6b8ac9b 100644
--- a/sqlobject/main.py
+++ b/sqlobject/main.py
@@ -1743,6 +1743,13 @@ class SQLObject(with_metaclass(declarative.DeclarativeMeta, object)):
def tablesUsedImmediate(self):
return [self.__class__.q]
+ # hash implementation
+
+ def __hash__(self):
+ # We hash on class name and id, since that should be
+ # unique
+ return hash((self.__class__.name, self.id))
+
# Comparison
def __eq__(self, other):
-----------------------------------------------------------------------
Summary of changes:
sqlobject/main.py | 7 +++++++
sqlobject/tests/test_class_hash.py | 22 ++++++++++++++++++++++
2 files changed, 29 insertions(+), 0 deletions(-)
create mode 100644 sqlobject/tests/test_class_hash.py
hooks/post-receive
--
SQLObject development repository
|