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 9222f2aeb9e5b9797bb9351e78738595800d8d80 (commit)
via ac801cf7b29d9015b724f7c5d0cc449e81c9a89d (commit)
from b03575eda1a85de245167ff1d7ebdcf6680064d4 (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/9222f2aeb9e5b9797bb9351e78738595800d8d80
commit 9222f2aeb9e5b9797bb9351e78738595800d8d80
Author: Oleg Broytman <ph...@ph...>
Date: Mon Oct 27 18:44:23 2014 +0300
Apply patch 112: _fromDatabase and UNIQUE should result in alternateID
See https://sourceforge.net/p/sqlobject/patches/112/
diff --git a/docs/News.txt b/docs/News.txt
index 311247a..2db7c51 100644
--- a/docs/News.txt
+++ b/docs/News.txt
@@ -22,6 +22,9 @@ Features & Interface
Minor features
--------------
+* PostgresConnection, when used with fromDatabase=True, sets alternateID
+ for unique columns.
+
* Upgrade ez_setup to 5.4.2.
Development
diff --git a/sqlobject/postgres/pgconnection.py b/sqlobject/postgres/pgconnection.py
index 1152891..1f94ee3 100644
--- a/sqlobject/postgres/pgconnection.py
+++ b/sqlobject/postgres/pgconnection.py
@@ -280,6 +280,17 @@ class PostgresConnection(DBAPI):
AND pg_index.indisprimary
"""
+ otherKeyQuery = """
+ SELECT pg_index.indisprimary,
+ pg_catalog.pg_get_indexdef(pg_index.indexrelid)
+ FROM pg_catalog.pg_class c, pg_catalog.pg_class c2,
+ pg_catalog.pg_index AS pg_index
+ WHERE c.relname = %s
+ AND c.oid = pg_index.indrelid
+ AND pg_index.indexrelid = c2.oid
+ AND NOT pg_index.indisprimary
+ """
+
keyData = self.queryAll(keyQuery % self.sqlrepr(tableName))
keyRE = re.compile(r"\((.+)\) REFERENCES (.+)\(")
keymap = {}
@@ -306,6 +317,18 @@ class PostgresConnection(DBAPI):
assert primaryKey.endswith('"')
primaryKey = primaryKey[1:-1]
+ otherData = self.queryAll(otherKeyQuery % self.sqlrepr(tableName))
+ otherRE = primaryRE
+ otherKeys = []
+ for isPrimary, indexDef in otherData:
+ match = otherRE.search(indexDef)
+ assert match, "Unparseable constraint definition: %r" % indexDef
+ otherKey = match.group(1)
+ if otherKey.startswith('"'):
+ assert otherKey.endswith('"')
+ otherKey = otherKey[1:-1]
+ otherKeys.append(otherKey)
+
colData = self.queryAll(colQuery % self.sqlrepr(tableName))
results = []
if self.unicodeCols:
@@ -332,6 +355,8 @@ class PostgresConnection(DBAPI):
kw['default'] = self.defaultFromSchema(colClass, defaultstr)
elif not notnull:
kw['default'] = None
+ if field in otherKeys:
+ kw['alternateID'] = True
results.append(colClass(**kw))
return results
http://sourceforge.net/p/sqlobject/sqlobject/ci/ac801cf7b29d9015b724f7c5d0cc449e81c9a89d
commit ac801cf7b29d9015b724f7c5d0cc449e81c9a89d
Author: Oleg Broytman <ph...@ph...>
Date: Sun Oct 26 23:33:40 2014 +0300
Upgrade ez_setup.py to version 7.0
diff --git a/ez_setup.py b/ez_setup.py
index b2435fe..a523401 100644
--- a/ez_setup.py
+++ b/ez_setup.py
@@ -36,7 +36,7 @@ try:
except ImportError:
USER_SITE = None
-DEFAULT_VERSION = "5.4.2"
+DEFAULT_VERSION = "7.0"
DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
def _python_cmd(*args):
@@ -268,7 +268,7 @@ def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
Download setuptools from a specified location and return its filename
`version` should be a valid setuptools version number that is available
- as an egg for download under the `download_base` URL (which should end
+ as an sdist for download under the `download_base` URL (which should end
with a '/'). `to_dir` is the directory where the egg will be downloaded.
`delay` is the number of seconds to pause before an actual download
attempt.
-----------------------------------------------------------------------
Summary of changes:
docs/News.txt | 3 +++
ez_setup.py | 4 ++--
sqlobject/postgres/pgconnection.py | 25 +++++++++++++++++++++++++
3 files changed, 30 insertions(+), 2 deletions(-)
hooks/post-receive
--
SQLObject development repository
|