sqlobject-cvs Mailing List for SQLObject (Page 41)
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
(9) |
Apr
(74) |
May
(29) |
Jun
(16) |
Jul
(28) |
Aug
(10) |
Sep
(57) |
Oct
(9) |
Nov
(29) |
Dec
(12) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(7) |
Feb
(14) |
Mar
(6) |
Apr
(3) |
May
(12) |
Jun
(34) |
Jul
(9) |
Aug
(29) |
Sep
(22) |
Oct
(2) |
Nov
(15) |
Dec
(52) |
| 2005 |
Jan
(47) |
Feb
(78) |
Mar
(14) |
Apr
(35) |
May
(33) |
Jun
(16) |
Jul
(26) |
Aug
(63) |
Sep
(40) |
Oct
(96) |
Nov
(96) |
Dec
(123) |
| 2006 |
Jan
(159) |
Feb
(144) |
Mar
(64) |
Apr
(31) |
May
(88) |
Jun
(48) |
Jul
(16) |
Aug
(64) |
Sep
(87) |
Oct
(92) |
Nov
(56) |
Dec
(76) |
| 2007 |
Jan
(94) |
Feb
(103) |
Mar
(126) |
Apr
(123) |
May
(85) |
Jun
(11) |
Jul
(130) |
Aug
(47) |
Sep
(65) |
Oct
(70) |
Nov
(12) |
Dec
(11) |
| 2008 |
Jan
(30) |
Feb
(55) |
Mar
(88) |
Apr
(20) |
May
(50) |
Jun
|
Jul
(38) |
Aug
(1) |
Sep
(9) |
Oct
(5) |
Nov
(6) |
Dec
(39) |
| 2009 |
Jan
(8) |
Feb
(16) |
Mar
(3) |
Apr
(33) |
May
(44) |
Jun
(1) |
Jul
(10) |
Aug
(33) |
Sep
(74) |
Oct
(22) |
Nov
|
Dec
(15) |
| 2010 |
Jan
(28) |
Feb
(22) |
Mar
(46) |
Apr
(29) |
May
(1) |
Jun
(1) |
Jul
(27) |
Aug
(8) |
Sep
(5) |
Oct
(33) |
Nov
(24) |
Dec
(41) |
| 2011 |
Jan
(4) |
Feb
(12) |
Mar
(35) |
Apr
(29) |
May
(19) |
Jun
(16) |
Jul
(32) |
Aug
(25) |
Sep
(5) |
Oct
(11) |
Nov
(21) |
Dec
(12) |
| 2012 |
Jan
(3) |
Feb
(4) |
Mar
(20) |
Apr
(4) |
May
(25) |
Jun
(13) |
Jul
|
Aug
|
Sep
(2) |
Oct
(25) |
Nov
(9) |
Dec
(1) |
| 2013 |
Jan
(6) |
Feb
(8) |
Mar
|
Apr
(10) |
May
(31) |
Jun
(7) |
Jul
(18) |
Aug
(33) |
Sep
(4) |
Oct
(16) |
Nov
|
Dec
(27) |
| 2014 |
Jan
(2) |
Feb
|
Mar
|
Apr
(11) |
May
(39) |
Jun
(8) |
Jul
(11) |
Aug
(4) |
Sep
|
Oct
(27) |
Nov
|
Dec
(71) |
| 2015 |
Jan
(17) |
Feb
(47) |
Mar
(33) |
Apr
|
May
|
Jun
(9) |
Jul
(7) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(8) |
| 2016 |
Jan
(4) |
Feb
(4) |
Mar
|
Apr
|
May
(12) |
Jun
(7) |
Jul
(9) |
Aug
(31) |
Sep
(8) |
Oct
(3) |
Nov
(15) |
Dec
(1) |
| 2017 |
Jan
(13) |
Feb
(7) |
Mar
(14) |
Apr
(8) |
May
(10) |
Jun
(4) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
(8) |
Nov
(4) |
Dec
(5) |
| 2018 |
Jan
(2) |
Feb
(8) |
Mar
|
Apr
(4) |
May
|
Jun
(6) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2019 |
Jan
(1) |
Feb
(16) |
Mar
(1) |
Apr
(3) |
May
(5) |
Jun
(1) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
(1) |
Dec
(3) |
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(2) |
Nov
|
Dec
(2) |
| 2021 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
| 2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
(1) |
Nov
(1) |
Dec
(4) |
| 2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(3) |
Sep
(2) |
Oct
(2) |
Nov
(4) |
Dec
|
| 2024 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(9) |
| 2025 |
Jan
|
Feb
(4) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(2) |
Dec
|
|
From: <sub...@co...> - 2011-03-01 17:31:11
|
Author: phd
Date: Tue Mar 1 10:31:01 2011
New Revision: 4339
Log:
Quote components of DB URI.
Modified:
SQLObject/trunk/sqlobject/dbconnection.py
SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
SQLObject/trunk/sqlobject/tests/test_parse_uri.py
Modified: SQLObject/trunk/sqlobject/dbconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/dbconnection.py Thu Feb 24 06:02:17 2011 (r4338)
+++ SQLObject/trunk/sqlobject/dbconnection.py Tue Mar 1 10:31:01 2011 (r4339)
@@ -88,7 +88,7 @@
registerConnectionInstance(self)
atexit.register(_closeConnection, weakref.ref(self))
- def uri(self):
+ def oldUri(self):
auth = getattr(self, 'user', '') or ''
if auth:
if self.password:
@@ -105,9 +105,30 @@
uri += '/'
db = self.db
if db.startswith('/'):
- db = path[1:]
+ db = db[1:]
return uri + db
+ def uri(self):
+ auth = getattr(self, 'user', '') or ''
+ if auth:
+ auth = urllib.quote(auth)
+ if self.password:
+ auth = auth + ':' + urllib.quote(self.password)
+ auth = auth + '@'
+ else:
+ assert not getattr(self, 'password', None), (
+ 'URIs cannot express passwords without usernames')
+ uri = '%s://%s' % (self.dbName, auth)
+ if self.host:
+ uri += self.host
+ if self.port:
+ uri += ':%d' % self.port
+ uri += '/'
+ db = self.db
+ if db.startswith('/'):
+ db = db[1:]
+ return uri + urllib.quote(db)
+
def connectionFromOldURI(cls, uri):
return cls._connectionFromParams(*cls._parseOldURI(uri))
connectionFromOldURI = classmethod(connectionFromOldURI)
Modified: SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py Thu Feb 24 06:02:17 2011 (r4338)
+++ SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py Tue Mar 1 10:31:01 2011 (r4339)
@@ -1,6 +1,7 @@
import base64
import os
import thread
+import urllib
from sqlobject.dbconnection import DBAPI, Boolean
from sqlobject import col, sqlbuilder
from sqlobject.dberrors import *
@@ -112,10 +113,12 @@
path = self.filename
if path == ":memory:":
path = "/:memory:"
- elif path.startswith('/'):
- path = "//" + path
else:
- path = "///" + path
+ if path.startswith('/'):
+ path = "//" + path
+ else:
+ path = "///" + path
+ path = urllib.quote(path)
return 'sqlite:%s' % path
def getConnection(self):
Modified: SQLObject/trunk/sqlobject/tests/test_parse_uri.py
==============================================================================
--- SQLObject/trunk/sqlobject/tests/test_parse_uri.py Thu Feb 24 06:02:17 2011 (r4338)
+++ SQLObject/trunk/sqlobject/tests/test_parse_uri.py Tue Mar 1 10:31:01 2011 (r4339)
@@ -1,5 +1,6 @@
import os
from sqlobject.dbconnection import DBConnection
+from sqlobject.sqlite.sqliteconnection import SQLiteConnection
########################################
## Test _parseURI
@@ -88,3 +89,36 @@
assert port is None
assert path == "/C:/full/path/to/database"
assert args == {}
+
+def test_uri():
+ connection = DBConnection()
+ connection.close = lambda: None
+
+ connection.dbName, connection.host, connection.port, connection.user, connection.password, connection.db = 'mysql', 'host', None, None, None, 'database'
+ assert connection.uri() == "mysql://host/database"
+
+ connection.dbName, connection.host, connection.port, connection.user, connection.password, connection.db = 'mysql', 'host', None, 'user', 'pass word', 'database'
+ assert connection.uri() == "mysql://user:pass%20word@host/database"
+
+ connection.dbName, connection.host, connection.port, connection.user, connection.password, connection.db = 'postgres', 'host', None, 'user', None, 'database'
+ assert connection.uri() == "postgres://user@host/database"
+
+ connection.dbName, connection.host, connection.port, connection.user, connection.password, connection.db = 'postgres', 'host', 5432, None, None, 'database'
+ assert connection.uri() == "postgres://host:5432/database"
+
+ connection.dbName, connection.host, connection.port, connection.user, connection.password, connection.db = 'postgres', None, None, None, None, '/full/path/to/socket/database'
+ assert connection.uri() == "postgres:///full/path/to/socket/database"
+
+ connection.dbName, connection.host, connection.port, connection.user, connection.password, connection.db = 'postgres', 'host', None, 'us:er', 'p@ssword', 'database'
+ assert connection.uri() == "postgres://us%3Aer:p%40ssword@host/database"
+
+ connection = SQLiteConnection(None)
+ connection.filename = '/full/path/to/database'
+ assert connection.uri() == "sqlite:///full/path/to/database"
+
+ connection.filename = ':memory:'
+ assert connection.uri() == "sqlite:/:memory:"
+
+ if os.name == 'nt':
+ connection.filename = 'C:/full/path/to/database'
+ assert connection.uri() == "sqlite:///C:/full/path/to/database"
|
|
From: <sub...@co...> - 2011-02-24 13:02:45
|
Author: phd
Date: Thu Feb 24 06:02:17 2011
New Revision: 4338
Log:
Fixed a bug - splitpasswd() can return None. Added a test for quoted special characters.
Modified:
SQLObject/trunk/sqlobject/dbconnection.py
SQLObject/trunk/sqlobject/tests/test_parse_uri.py
Modified: SQLObject/trunk/sqlobject/dbconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/dbconnection.py Tue Feb 22 07:44:08 2011 (r4337)
+++ SQLObject/trunk/sqlobject/dbconnection.py Thu Feb 24 06:02:17 2011 (r4338)
@@ -177,7 +177,7 @@
if '@' in host:
user, host = host.split('@', 1)
if user:
- user, password = [urllib.unquote(x) for x in urllib.splitpasswd(user)]
+ user, password = [x and urllib.unquote(x) or None for x in urllib.splitpasswd(user)]
host, port = urllib.splitport(host)
if port: port = int(port)
elif host == '':
Modified: SQLObject/trunk/sqlobject/tests/test_parse_uri.py
==============================================================================
--- SQLObject/trunk/sqlobject/tests/test_parse_uri.py Tue Feb 22 07:44:08 2011 (r4337)
+++ SQLObject/trunk/sqlobject/tests/test_parse_uri.py Thu Feb 24 06:02:17 2011 (r4338)
@@ -48,9 +48,9 @@
assert path == "/full/path/to/socket/database"
assert args == {}
- user, password, host, port, path, args = _parseURI("postgres://user:at@inpwd@host/database")
- assert user == "user"
- assert password == "at@inpwd"
+ user, password, host, port, path, args = _parseURI("postgres://us%3Aer:p%40ssword@host/database")
+ assert user == "us:er"
+ assert password == "p@ssword"
assert host == "host"
assert port is None
assert path == "/database"
|
|
From: <sub...@co...> - 2011-02-22 14:44:16
|
Author: phd
Date: Tue Feb 22 07:44:08 2011
New Revision: 4337
Log:
Fixed a minor bug: Python < 2.7 have a problem - splituser() calls unquote() too early.
Modified:
SQLObject/trunk/docs/TODO.txt
SQLObject/trunk/sqlobject/dbconnection.py
Modified: SQLObject/trunk/docs/TODO.txt
==============================================================================
--- SQLObject/trunk/docs/TODO.txt Tue Feb 22 07:32:59 2011 (r4336)
+++ SQLObject/trunk/docs/TODO.txt Tue Feb 22 07:44:08 2011 (r4337)
@@ -59,6 +59,8 @@
* Stop supporting Python 2.5: remove import sets.
+* Stop supporting Python 2.6: restore using urllib.splituser in _parseURI.
+
* Expression columns - in SELECT but not in INSERT/UPDATE. Something like this::
class MyClass(SQLObject):
Modified: SQLObject/trunk/sqlobject/dbconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/dbconnection.py Tue Feb 22 07:32:59 2011 (r4336)
+++ SQLObject/trunk/sqlobject/dbconnection.py Tue Feb 22 07:44:08 2011 (r4337)
@@ -172,9 +172,12 @@
host, path = urllib.splithost(request)
if host:
- user, host = urllib.splituser(host)
+ # Python < 2.7 have a problem - splituser() calls unquote() too early
+ #user, host = urllib.splituser(host)
+ if '@' in host:
+ user, host = host.split('@', 1)
if user:
- user, password = urllib.splitpasswd(user)
+ user, password = [urllib.unquote(x) for x in urllib.splitpasswd(user)]
host, port = urllib.splitport(host)
if port: port = int(port)
elif host == '':
|
|
From: <sub...@co...> - 2011-02-22 14:33:08
|
Author: phd
Date: Tue Feb 22 07:32:59 2011
New Revision: 4336
Log:
Renamed `database` to `db`.
Modified:
SQLObject/trunk/sqlobject/maxdb/maxdbconnection.py
Modified: SQLObject/trunk/sqlobject/maxdb/maxdbconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/maxdb/maxdbconnection.py Mon Feb 21 11:48:40 2011 (r4335)
+++ SQLObject/trunk/sqlobject/maxdb/maxdbconnection.py Tue Feb 22 07:32:59 2011 (r4336)
@@ -11,7 +11,7 @@
__connection__ = DBConnection.maxdbConnection(
host=hostname, database=dbname,
- user=user_name, password=user_password,autoCommit=1,debug=1)
+ user=user_name, password=user_password, autoCommit=1, debug=1)
"""
from sqlobject.dbconnection import DBAPI
from sqlobject import col
@@ -68,7 +68,7 @@
self.port = port
self.user = user
self.password = password
- self.database = database
+ self.db = database
self.autoCommit = autoCommit
self.sqlmode = sqlmode
self.isolation = isolation
@@ -97,9 +97,8 @@
def _setAutoCommit(self, conn, auto):
conn.close()
- conn.__init__(self.user, self.password, self.database,
- self.host,
- **self._getConfigParams(self.sqlmode,auto))
+ conn.__init__(self.user, self.password, self.db, self.host,
+ **self._getConfigParams(self.sqlmode, auto))
def createSequenceName(self,table):
"""
@@ -113,8 +112,8 @@
def makeConnection(self):
conn = self.module.Connection(
- self.user, self.password, self.database, self.host,
- **self._getConfigParams(self.sqlmode,self.autoCommit))
+ self.user, self.password, self.db, self.host,
+ **self._getConfigParams(self.sqlmode, self.autoCommit))
return conn
def _queryInsertID(self, conn, soInstance, id, names, values):
|
Author: phd
Date: Mon Feb 21 11:48:40 2011
New Revision: 4335
Log:
DB URI parser was changed to use urllib.split*() and unquote().
Added:
SQLObject/trunk/scripts/sqlobject-convertURI (contents, props changed)
SQLObject/trunk/sqlobject/tests/test_parse_uri.py (contents, props changed)
- copied, changed from r4332, SQLObject/trunk/sqlobject/tests/test_parse.py
Deleted:
SQLObject/trunk/sqlobject/tests/test_parse.py
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/docs/SQLObject.txt
SQLObject/trunk/docs/TODO.txt
SQLObject/trunk/setup.py
SQLObject/trunk/sqlobject/dbconnection.py
SQLObject/trunk/sqlobject/firebird/firebirdconnection.py
SQLObject/trunk/sqlobject/maxdb/maxdbconnection.py
SQLObject/trunk/sqlobject/mssql/mssqlconnection.py
SQLObject/trunk/sqlobject/mysql/mysqlconnection.py
SQLObject/trunk/sqlobject/postgres/pgconnection.py
SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
SQLObject/trunk/sqlobject/sybase/sybaseconnection.py
Modified: SQLObject/trunk/docs/News.txt
==============================================================================
--- SQLObject/trunk/docs/News.txt Mon Feb 21 11:46:11 2011 (r4334)
+++ SQLObject/trunk/docs/News.txt Mon Feb 21 11:48:40 2011 (r4335)
@@ -13,6 +13,11 @@
Features & Interface
--------------------
+* Major API change: DB URI parser was changed to use urllib.split*() and
+ unquote(). This means any username/password/path are allowed in DB
+ URIs if they are properly %-encoded, and DB URIs are automatically
+ unquoted.
+
* In SQLite, id columns are made AUTOINCREMENT.
* Parameter ``backend`` in DB URI is no longer supported, use parameter
Modified: SQLObject/trunk/docs/SQLObject.txt
==============================================================================
--- SQLObject/trunk/docs/SQLObject.txt Mon Feb 21 11:46:11 2011 (r4334)
+++ SQLObject/trunk/docs/SQLObject.txt Mon Feb 21 11:48:40 2011 (r4335)
@@ -152,13 +152,9 @@
postgres:///full/path/to/socket/database
postgres://host:5432/database
sqlite:///full/path/to/database
- sqlite:/C|/full/path/to/database
+ sqlite:/C:/full/path/to/database
sqlite:/:memory:
-Note that there is a special syntax to specify full path on w32 systems
-(useable for sqlite and firebird); also sqlite can manipulate special
-in-memory databases.
-
Parameters are: ``debug`` (default: False), ``debugOutput`` (default: False),
``cache`` (default: True), ``autoCommit`` (default: True),
``debugThreading`` (default: False),
Modified: SQLObject/trunk/docs/TODO.txt
==============================================================================
--- SQLObject/trunk/docs/TODO.txt Mon Feb 21 11:46:11 2011 (r4334)
+++ SQLObject/trunk/docs/TODO.txt Mon Feb 21 11:48:40 2011 (r4335)
@@ -1,8 +1,6 @@
TODO
----
-* Proper %-encoded URI.
-
* __version__.py
* Release 1.0.
@@ -80,6 +78,8 @@
* Better joins - automatic joins in .select()
based on ForeignKey/MultipleJoin/RelatedJoin.
+* Deprecate, then remove connectionForOldURI.
+
* Python 3.0+.
* Switch from setuptools to distribute.
Added: SQLObject/trunk/scripts/sqlobject-convertURI
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ SQLObject/trunk/scripts/sqlobject-convertURI Mon Feb 21 11:48:40 2011 (r4335)
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+import sys
+
+try:
+ uri = sys.argv[1]
+except IndexError:
+ sys.exit("Usage: %s old-style-URI" % sys.argv[0])
+
+try:
+ import pkg_resources
+ pkg_resources.require('SQLObject>=1.0.0a1')
+except (ImportError, pkg_resources.DistributionNotFound):
+ pass
+
+from sqlobject.dbconnection import dbConnectionForScheme
+
+scheme = uri.split(':')[0]
+connCls = dbConnectionForScheme(scheme)
+conn = connCls.connectionFromOldURI(uri)
+print conn.uri()
Modified: SQLObject/trunk/setup.py
==============================================================================
--- SQLObject/trunk/setup.py Mon Feb 21 11:46:11 2011 (r4334)
+++ SQLObject/trunk/setup.py Mon Feb 21 11:48:40 2011 (r4335)
@@ -52,7 +52,7 @@
download_url="http://cheeseshop.python.org/pypi/SQLObject/1.0",
license="LGPL",
packages=["sqlobject"] + ['sqlobject.%s' % package for package in subpackages],
- scripts=["scripts/sqlobject-admin"],
+ scripts=["scripts/sqlobject-admin", "scripts/sqlobject-convertURI"],
install_requires=["FormEncode>=1.1.1"],
extras_require={
'mysql': ['MySQLdb'],
Modified: SQLObject/trunk/sqlobject/dbconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/dbconnection.py Mon Feb 21 11:46:11 2011 (r4334)
+++ SQLObject/trunk/sqlobject/dbconnection.py Mon Feb 21 11:48:40 2011 (r4335)
@@ -1,6 +1,8 @@
import atexit
+from cgi import parse_qsl
import inspect
import new
+import os
import sys
import threading
import types
@@ -87,7 +89,7 @@
atexit.register(_closeConnection, weakref.ref(self))
def uri(self):
- auth = getattr(self, 'user', '')
+ auth = getattr(self, 'user', '') or ''
if auth:
if self.password:
auth = auth + ':' + self.password
@@ -98,17 +100,23 @@
uri = '%s://%s' % (self.dbName, auth)
if self.host:
uri += self.host
+ if self.port:
+ uri += ':%d' % self.port
uri += '/'
db = self.db
if db.startswith('/'):
db = path[1:]
return uri + db
+ def connectionFromOldURI(cls, uri):
+ return cls._connectionFromParams(*cls._parseOldURI(uri))
+ connectionFromOldURI = classmethod(connectionFromOldURI)
+
def connectionFromURI(cls, uri):
- raise NotImplemented
+ return cls._connectionFromParams(*cls._parseURI(uri))
connectionFromURI = classmethod(connectionFromURI)
- def _parseURI(uri):
+ def _parseOldURI(uri):
schema, rest = uri.split(':', 1)
assert rest.startswith('/'), "URIs must start with scheme:/ -- you did not include a / (in %r)" % rest
if rest.startswith('/') and not rest.startswith('//'):
@@ -156,6 +164,42 @@
argvalue = urllib.unquote(argvalue)
args[argname] = argvalue
return user, password, host, port, path, args
+ _parseOldURI = staticmethod(_parseOldURI)
+
+ def _parseURI(uri):
+ protocol, request = urllib.splittype(uri)
+ user, password, port = None, None, None
+ host, path = urllib.splithost(request)
+
+ if host:
+ user, host = urllib.splituser(host)
+ if user:
+ user, password = urllib.splitpasswd(user)
+ host, port = urllib.splitport(host)
+ if port: port = int(port)
+ elif host == '':
+ host = None
+
+ # hash-tag is splitted but ignored
+ path, tag = urllib.splittag(path)
+ path, query = urllib.splitquery(path)
+
+ path = urllib.unquote(path)
+ if (os.name == 'nt') and (len(path) > 2):
+ # Preserve backward compatibility with URIs like /C|/path;
+ # replace '|' by ':'
+ if path[2] == '|':
+ path = "%s:%s" % (path[0:2], path[3:])
+ # Remove leading slash
+ if (path[0] == '/') and (path[2] == ':'):
+ path = path[1:]
+
+ args = {}
+ if query:
+ for name, value in parse_qsl(query):
+ args[name] = value
+
+ return user, password, host, port, path, args
_parseURI = staticmethod(_parseURI)
def soClassAdded(self, soClass):
Modified: SQLObject/trunk/sqlobject/firebird/firebirdconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/firebird/firebirdconnection.py Mon Feb 21 11:46:11 2011 (r4334)
+++ SQLObject/trunk/sqlobject/firebird/firebirdconnection.py Mon Feb 21 11:48:40 2011 (r4335)
@@ -11,13 +11,14 @@
limit_re = re.compile('^\s*(select )(.*)', re.IGNORECASE)
- def __init__(self, host, db, user='sysdba',
+ def __init__(self, host, port, db, user='sysdba',
password='masterkey', autoCommit=1,
dialect=None, role=None, charset=None, **kw):
import kinterbasdb
self.module = kinterbasdb
self.host = host
+ self.port = port
self.db = db
self.user = user
self.password = password
@@ -30,8 +31,7 @@
DBAPI.__init__(self, **kw)
- def connectionFromURI(cls, uri):
- auth, password, host, port, path, args = cls._parseURI(uri)
+ def _connectionFromParams(cls, auth, password, host, port, path, args):
if not password:
password = 'masterkey'
if not auth:
@@ -40,8 +40,8 @@
if (path[0] == '/') and path[-3:].lower() not in ('fdb', 'gdb'):
path = path[1:]
path = path.replace('/', os.sep)
- return cls(host, db=path, user=auth, password=password, **args)
- connectionFromURI = classmethod(connectionFromURI)
+ return cls(host, port, db=path, user=auth, password=password, **args)
+ _connectionFromParams = classmethod(_connectionFromParams)
def _runWithConnection(self, meth, *args):
if not self.autoCommit:
Modified: SQLObject/trunk/sqlobject/maxdb/maxdbconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/maxdb/maxdbconnection.py Mon Feb 21 11:46:11 2011 (r4334)
+++ SQLObject/trunk/sqlobject/maxdb/maxdbconnection.py Mon Feb 21 11:48:40 2011 (r4335)
@@ -59,27 +59,28 @@
dbName = 'maxdb'
schemes = [dbName]
- def __init__ (self, user, password, database,
- host='', autoCommit=1, sqlmode='internal',
+ def __init__ (self, host='', port=None, user=None, password=None,
+ database=None, autoCommit=1, sqlmode='internal',
isolation=None, timeout=None, **kw):
from sapdb import dbapi
self.module = dbapi
- self.autoCommit = autoCommit
+ self.host = host
+ self.port = port
self.user = user
self.password = password
self.database = database
- self.host = host
+ self.autoCommit = autoCommit
self.sqlmode = sqlmode
self.isolation = isolation
self.timeout = timeout
DBAPI.__init__(self, **kw)
- def connectionFromURI(cls, uri):
- auth, password, host, port, path, args = cls._parseURI(uri)
+ def _connectionFromParams(cls, auth, password, host, port, path, args):
path = path.replace('/', os.path.sep)
- return cls(host, db=path, user=auth, password=password, **args)
- connectionFromURI = classmethod(connectionFromURI)
+ return cls(host, port, user=auth, password=password,
+ database=path, **args)
+ _connectionFromParams = classmethod(_connectionFromParams)
def _getConfigParams(self,sqlmode,auto):
autocommit='off'
Modified: SQLObject/trunk/sqlobject/mssql/mssqlconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/mssql/mssqlconnection.py Mon Feb 21 11:46:11 2011 (r4334)
+++ SQLObject/trunk/sqlobject/mssql/mssqlconnection.py Mon Feb 21 11:48:40 2011 (r4335)
@@ -8,7 +8,7 @@
dbName = 'mssql'
schemes = [dbName]
- def __init__(self, db, user, password='', host='localhost',
+ def __init__(self, db, user, password='', host='localhost', port=None,
autoCommit=0, **kw):
drivers = kw.pop('driver', None) or 'adodb,pymssql'
for driver in drivers.split(','):
@@ -64,6 +64,7 @@
self.autoCommit=int(autoCommit)
self.host = host
+ self.port = port
self.db = db
self.user = user
self.password = password
@@ -72,12 +73,11 @@
self._can_use_max_types = None
DBAPI.__init__(self, **kw)
- def connectionFromURI(cls, uri):
- user, password, host, port, path, args = cls._parseURI(uri)
+ def _connectionFromParams(cls, user, password, host, port, path, args):
path = path.strip('/')
- return cls(user=user, password=password, host=host or 'localhost',
- db=path, **args)
- connectionFromURI = classmethod(connectionFromURI)
+ return cls(user=user, password=password,
+ host=host or 'localhost', port=port, db=path, **args)
+ _connectionFromParams = classmethod(_connectionFromParams)
def insert_id(self, conn):
"""
Modified: SQLObject/trunk/sqlobject/mysql/mysqlconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/mysql/mysqlconnection.py Mon Feb 21 11:46:11 2011 (r4334)
+++ SQLObject/trunk/sqlobject/mysql/mysqlconnection.py Mon Feb 21 11:48:40 2011 (r4335)
@@ -50,11 +50,10 @@
DBAPI.__init__(self, **kw)
- def connectionFromURI(cls, uri):
- user, password, host, port, path, args = cls._parseURI(uri)
+ def _connectionFromParams(cls, user, password, host, port, path, args):
return cls(db=path.strip('/'), user=user or '', password=password or '',
host=host or 'localhost', port=port or 0, **args)
- connectionFromURI = classmethod(connectionFromURI)
+ _connectionFromParams = classmethod(_connectionFromParams)
def makeConnection(self):
dbEncoding = self.dbEncoding
Modified: SQLObject/trunk/sqlobject/postgres/pgconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/postgres/pgconnection.py Mon Feb 21 11:46:11 2011 (r4334)
+++ SQLObject/trunk/sqlobject/postgres/pgconnection.py Mon Feb 21 11:48:40 2011 (r4335)
@@ -106,15 +106,14 @@
self.dbEncoding = kw.pop("charset", None)
DBAPI.__init__(self, **kw)
- def connectionFromURI(cls, uri):
- user, password, host, port, path, args = cls._parseURI(uri)
+ def _connectionFromParams(cls, user, password, host, port, path, args):
path = path.strip('/')
if (host is None) and path.count('/'): # Non-default unix socket
path_parts = path.split('/')
host = '/' + '/'.join(path_parts[:-1])
path = path_parts[-1]
return cls(host=host, port=port, db=path, user=user, password=password, **args)
- connectionFromURI = classmethod(connectionFromURI)
+ _connectionFromParams = classmethod(_connectionFromParams)
def _setAutoCommit(self, conn, auto):
# psycopg2 does not have an autocommit method.
Modified: SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py Mon Feb 21 11:46:11 2011 (r4334)
+++ SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py Mon Feb 21 11:48:40 2011 (r4335)
@@ -95,25 +95,27 @@
self._memoryConn = sqlite.connect(
self.filename, **self._connOptions)
- def connectionFromURI(cls, uri):
- user, password, host, port, path, args = cls._parseURI(uri)
- assert host is None, (
+ def _connectionFromParams(cls, user, password, host, port, path, args):
+ assert host is None and port is None, (
"SQLite can only be used locally (with a URI like "
- "sqlite:///file or sqlite:/file, not %r)" % uri)
+ "sqlite:/file or sqlite:///file, not sqlite://%s%s)" %
+ (host, ':%r' % port if port else ''))
assert user is None and password is None, (
"You may not provide usernames or passwords for SQLite "
"databases")
if path == "/:memory:":
path = ":memory:"
return cls(filename=path, **args)
- connectionFromURI = classmethod(connectionFromURI)
+ _connectionFromParams = classmethod(_connectionFromParams)
def uri(self):
path = self.filename
if path == ":memory:":
path = "/:memory:"
- else:
+ elif path.startswith('/'):
path = "//" + path
+ else:
+ path = "///" + path
return 'sqlite:%s' % path
def getConnection(self):
Modified: SQLObject/trunk/sqlobject/sybase/sybaseconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/sybase/sybaseconnection.py Mon Feb 21 11:46:11 2011 (r4334)
+++ SQLObject/trunk/sqlobject/sybase/sybaseconnection.py Mon Feb 21 11:48:40 2011 (r4335)
@@ -8,7 +8,7 @@
schemes = [dbName]
NumericType = None
- def __init__(self, db, user, password='', host='localhost',
+ def __init__(self, db, user, password='', host='localhost', port=None,
locking=1, **kw):
db = db.strip('/')
import Sybase
@@ -21,6 +21,7 @@
self.module = Sybase
self.locking = int(locking)
self.host = host
+ self.port = port
self.db = db
self.user = user
self.password = password
@@ -32,11 +33,10 @@
kw['autoCommit'] = autoCommit
DBAPI.__init__(self, **kw)
- def connectionFromURI(cls, uri):
- user, password, host, port, path, args = cls._parseURI(uri)
- return cls(user=user, password=password, host=host or 'localhost',
- db=path, **args)
- connectionFromURI = classmethod(connectionFromURI)
+ def _connectionFromParams(cls, user, password, host, port, path, args):
+ return cls(user=user, password=password,
+ host=host or 'localhost', port=port, db=path, **args)
+ _connectionFromParams = classmethod(_connectionFromParams)
def insert_id(self, conn):
"""
Copied and modified: SQLObject/trunk/sqlobject/tests/test_parse_uri.py (from r4332, SQLObject/trunk/sqlobject/tests/test_parse.py)
==============================================================================
--- SQLObject/trunk/sqlobject/tests/test_parse.py Fri Feb 11 02:44:20 2011 (r4332, copy source)
+++ SQLObject/trunk/sqlobject/tests/test_parse_uri.py Mon Feb 21 11:48:40 2011 (r4335)
@@ -18,7 +18,7 @@
user, password, host, port, path, args = _parseURI("mysql://user:pass%20word@host/database?unix_socket=/var/mysql/socket")
assert user == "user"
- assert password == "pass%20word"
+ assert password == "pass word"
assert host == "host"
assert port is None
assert path == "/database"
@@ -41,9 +41,9 @@
assert args == {}
user, password, host, port, path, args = _parseURI("postgres:///full/path/to/socket/database")
- assert user == None
+ assert user is None
assert password is None
- assert host == None
+ assert host is None
assert port is None
assert path == "/full/path/to/socket/database"
assert args == {}
@@ -78,5 +78,13 @@
assert password is None
assert host is None
assert port is None
- assert path == "C:/full/path/to/database"
+ assert path == "/C:/full/path/to/database"
+ assert args == {}
+
+ user, password, host, port, path, args = _parseURI("sqlite:///C:/full/path/to/database")
+ assert user is None
+ assert password is None
+ assert host is None
+ assert port is None
+ assert path == "/C:/full/path/to/database"
assert args == {}
|
|
From: <sub...@co...> - 2011-02-21 18:46:20
|
Author: phd
Date: Mon Feb 21 11:46:11 2011
New Revision: 4334
Log:
Next version will be 1.0.
Modified:
SQLObject/trunk/setup.py
Modified: SQLObject/trunk/setup.py
==============================================================================
--- SQLObject/trunk/setup.py Fri Feb 11 09:39:58 2011 (r4333)
+++ SQLObject/trunk/setup.py Mon Feb 21 11:46:11 2011 (r4334)
@@ -21,7 +21,7 @@
"""
setup(name="SQLObject",
- version="0.16",
+ version="1.0",
description="Object-Relational Manager, aka database wrapper",
long_description="""\
SQLObject is a popular *Object Relational Manager* for providing an
@@ -35,7 +35,7 @@
Supports MySQL, PostgreSQL, SQLite, Firebird, Sybase, MSSQL and MaxDB (SAPDB).
For development see the `subversion repository
-<http://svn.colorstudy.com/SQLObject/trunk#egg=SQLObject-0.16dev>`_
+<http://svn.colorstudy.com/SQLObject/trunk#egg=SQLObject-1.0dev>`_
""",
classifiers=[
"Development Status :: 5 - Production/Stable",
@@ -49,7 +49,7 @@
author="Ian Bicking",
author_email="ia...@co...",
url="http://sqlobject.org/devel/",
- download_url="http://cheeseshop.python.org/pypi/SQLObject/0.16",
+ download_url="http://cheeseshop.python.org/pypi/SQLObject/1.0",
license="LGPL",
packages=["sqlobject"] + ['sqlobject.%s' % package for package in subpackages],
scripts=["scripts/sqlobject-admin"],
@@ -83,10 +83,9 @@
as classes, and rows are instances of those classes. SQLObject is meant to be
easy to use and quick to get started with.
-SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite, and
-Firebird. It also has newly added support for Sybase, MSSQL and MaxDB (also
-known as SAPDB).
-
+It currently supports MySQL through the `MySQLdb` package, PostgreSQL
+through the `psycopg` package, SQLite, Firebird, MaxDB (SAP DB), MS SQL
+Sybase and Rdbhost. It should support Python versions back to 2.4.
Where is SQLObject
==================
|
|
From: SourceForge.net <no...@so...> - 2011-02-19 12:55:17
|
Patches item #3131373, was opened at 2010-12-07 15:19 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3131373&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Widget (example) Group: Unstable (example) >Status: Deleted Resolution: None >Priority: 1 >Private: Yes Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: qxjuuav Initial Comment: fophfpi <a href="http://efhddkz.com">efhddkz</a> [url=http://fgawcri.com]fgawcri[/url] http://oghagsf.com ---------------------------------------------------------------------- >Comment By: Oleg Broytman (phd) Date: 2011-02-19 15:55 Message: Spam ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3131373&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2011-02-19 12:52:26
|
Patches item #3186787, was opened at 2011-02-19 15:42 Message generated for change (Settings changed) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3186787&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Deleted Resolution: None >Priority: 1 >Private: Yes Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: onS1Rb <a href="http://efworbiwykpx.com/">efworbiwykpx</a>, Initial Comment: onS1Rb <a href="http://efworbiwykpx.com/">efworbiwykpx</a>, [url=http://mujkeonebzro.com/]mujkeonebzro[/url], [link=http://iiihflgwqtao.com/]iiihflgwqtao[/link], http://gwrbpnjnjqzj.com/ ---------------------------------------------------------------------- >Comment By: Oleg Broytman (phd) Date: 2011-02-19 15:52 Message: Spam ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3186787&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2011-02-19 12:42:18
|
Patches item #3186787, was opened at 2011-02-19 12:42 Message generated for change (Tracker Item Submitted) made by nobody You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3186787&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: onS1Rb <a href="http://efworbiwykpx.com/">efworbiwykpx</a>, Initial Comment: onS1Rb <a href="http://efworbiwykpx.com/">efworbiwykpx</a>, [url=http://mujkeonebzro.com/]mujkeonebzro[/url], [link=http://iiihflgwqtao.com/]iiihflgwqtao[/link], http://gwrbpnjnjqzj.com/ ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=3186787&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2011-02-16 15:16:32
|
Bugs item #3183831, was opened at 2011-02-16 15:16 Message generated for change (Tracker Item Submitted) made by nobody You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=3183831&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: SQLObject release (specify) Status: Open Resolution: None Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: Missing 'os' module in import (dbconnection.py) Initial Comment: [SQLObject 0.16dev-r4333, python 2.6] See exception below: Traceback (most recent call last): ... File "... /python2.6/site-packages/SQLObject-0.16dev_r4333-py2.6.egg/sqlobject/dbconnection.py", line 147, in _parseURI if os.name == 'nt': NameError: global name 'os' is not defined ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=3183831&group_id=74338 |
|
From: <sub...@co...> - 2011-02-11 16:40:10
|
Author: phd
Date: Fri Feb 11 09:39:58 2011
New Revision: 4333
Log:
Sort imports alphabetically.
Modified:
SQLObject/trunk/sqlobject/dbconnection.py
Modified: SQLObject/trunk/sqlobject/dbconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/dbconnection.py Fri Feb 11 02:44:20 2011 (r4332)
+++ SQLObject/trunk/sqlobject/dbconnection.py Fri Feb 11 09:39:58 2011 (r4333)
@@ -1,22 +1,20 @@
-import threading
-from util.threadinglocal import local as threading_local
-import sys
-import re
-import warnings
import atexit
-import os
+import inspect
import new
+import sys
+import threading
import types
import urllib
+import warnings
import weakref
-import inspect
-import sqlbuilder
+
from cache import CacheSet
+import classregistry
import col
-import main
-from joins import sorter
from converters import sqlrepr
-import classregistry
+import main
+import sqlbuilder
+from util.threadinglocal import local as threading_local
warnings.filterwarnings("ignore", "DB-API extension cursor.lastrowid used")
@@ -84,8 +82,7 @@
self._connectionCount = 1
self.autoCommit = Boolean(autoCommit)
self.registry = registry or None
- classregistry.registry(self.registry).addCallback(
- self.soClassAdded)
+ classregistry.registry(self.registry).addCallback(self.soClassAdded)
registerConnectionInstance(self)
atexit.register(_closeConnection, weakref.ref(self))
|
|
From: <sub...@co...> - 2011-02-11 09:44:30
|
Author: phd
Date: Fri Feb 11 02:44:20 2011
New Revision: 4332
Log:
Allow ForeignKey to point to a non-id column.
Modified:
SQLObject/trunk/docs/TODO.txt
Modified: SQLObject/trunk/docs/TODO.txt
==============================================================================
--- SQLObject/trunk/docs/TODO.txt Thu Feb 3 07:40:33 2011 (r4331)
+++ SQLObject/trunk/docs/TODO.txt Fri Feb 11 02:44:20 2011 (r4332)
@@ -17,6 +17,9 @@
* delColumn('foreignKey'), delColumn('foreignKeyID')
+* ForeignKey('Table', otherColumn='other_id') to allow ForeignKey to
+ point to a non-id column.
+
* RelatedJoin.hasOther(otherObject[.id])
* tableParamSQL::
|
|
From: <sub...@co...> - 2011-02-03 14:40:44
|
Author: phd
Date: Thu Feb 3 07:40:33 2011
New Revision: 4331
Log:
In SQLite, id columns are made AUTOINCREMENT.
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
Modified: SQLObject/trunk/docs/News.txt
==============================================================================
--- SQLObject/trunk/docs/News.txt Wed Jan 26 08:19:31 2011 (r4330)
+++ SQLObject/trunk/docs/News.txt Thu Feb 3 07:40:33 2011 (r4331)
@@ -13,6 +13,8 @@
Features & Interface
--------------------
+* In SQLite, id columns are made AUTOINCREMENT.
+
* Parameter ``backend`` in DB URI is no longer supported, use parameter
``driver``.
Modified: SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py Wed Jan 26 08:19:31 2011 (r4330)
+++ SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py Thu Feb 3 07:40:33 2011 (r4331)
@@ -252,8 +252,9 @@
return self._createIDColumn(soClass.sqlmeta)
def _createIDColumn(self, sqlmeta):
- key_type = {int: "INTEGER", str: "TEXT"}[sqlmeta.idType]
- return '%s %s PRIMARY KEY' % (sqlmeta.idName, key_type)
+ if sqlmeta.idType == str:
+ return '%s TEXT PRIMARY KEY' % sqlmeta.idName
+ return '%s INTEGER PRIMARY KEY AUTOINCREMENT' % sqlmeta.idName
def joinSQLType(self, join):
return 'INT NOT NULL'
|
|
From: <sub...@co...> - 2011-01-26 15:19:38
|
Author: phd Date: Wed Jan 26 08:19:31 2011 New Revision: 4330 Log: Some single and double quotes were changed to reST literals (double backticks). Modified: SQLObject/trunk/docs/DeveloperGuide.txt SQLObject/trunk/docs/News.txt SQLObject/trunk/docs/SQLObject.txt SQLObject/trunk/docs/SelectResults.txt SQLObject/trunk/docs/TODO.txt Modified: SQLObject/trunk/docs/DeveloperGuide.txt ============================================================================== --- SQLObject/trunk/docs/DeveloperGuide.txt Wed Jan 26 07:34:09 2011 (r4329) +++ SQLObject/trunk/docs/DeveloperGuide.txt Wed Jan 26 08:19:31 2011 (r4330) @@ -151,10 +151,10 @@ .. __: http://codespeak.net/py/current/doc/test.html .. _getting started: http://codespeak.net/py/dist/test.html#starting-point-py-test-command-line-tool -To actually run the test, you have to give it a database to connect -to. You do so with the option "-D". You can either give a complete URI or one of several -shortcuts like ``mysql`` (these shortcuts are defined in the top of -``tests/dbtest.py``). +To actually run the test, you have to give it a database to connect to. +You do so with the option ``-D``. You can either give a complete URI or +one of several shortcuts like ``mysql`` (these shortcuts are defined in +the top of ``tests/dbtest.py``). All the tests are modules in ``sqlobject/tests``. Each module tests one kind of feature, more or less. If you are testing a module, call Modified: SQLObject/trunk/docs/News.txt ============================================================================== --- SQLObject/trunk/docs/News.txt Wed Jan 26 07:34:09 2011 (r4329) +++ SQLObject/trunk/docs/News.txt Wed Jan 26 08:19:31 2011 (r4330) @@ -13,7 +13,8 @@ Features & Interface -------------------- -* Parameter 'backend' in DB URI is no longer supported, use parameter 'driver'. +* Parameter ``backend`` in DB URI is no longer supported, use parameter + ``driver``. SQLObject 0.15.1 ================ @@ -67,7 +68,7 @@ value True; this means the default schema parser is now based on ``PRAGMA table_info()``. -* Major API change: attribute 'dirty' was moved to sqlmeta. +* Major API change: attribute ``dirty`` was moved to sqlmeta. SQLObject 0.13.1 ================ @@ -114,7 +115,7 @@ * Renamed db_encoding to dbEncoding in UnicodeStringValidator. -* A new parameter 'sslmode' was added to PostgresConnection. +* A new parameter ``sslmode`` was added to PostgresConnection. * Removed SQLValidator - its attemptConvert was never called because in FormEncode it's named attempt_convert. @@ -122,8 +123,9 @@ SQLObject 0.12.5 ================ -* 'backend' parameter was renamed to 'driver'. To preserve backward - compatibility 'backend' is recognized and will be recognized for some time. +* ``backend`` parameter was renamed to ``driver``. To preserve backward + compatibility ``backend`` is still recognized and will be recognized + for some time. SQLObject 0.12.4 ================ @@ -168,29 +170,30 @@ * .selectBy(), .deleteBy() and .by*() methods pass all values through .from_python(), not only unicode. -* The user can choose a DB API driver for SQLite by using a "backend" +* The user can choose a DB API driver for SQLite by using a ``backend`` parameter in DB URI or SQLiteConnection that can be a comma-separated - list of backend names. Possible backends are: "pysqlite2" (alias - "sqlite2"), "sqlite3", "sqlite" (alias "sqlite1"). Default is to test - pysqlite2, sqlite3 and sqlite in that order. + list of backend names. Possible backends are: ``pysqlite2`` (alias + ``sqlite2``), ``sqlite3``, ``sqlite`` (alias ``sqlite1``). Default is + to test pysqlite2, sqlite3 and sqlite in that order. -* The user can choose a DB API driver for PostgreSQL by using a "backend" +* The user can choose a DB API driver for PostgreSQL by using a ``backend`` parameter in DB URI or PostgresConnection that can be a comma-separated - list of backend names. Possible backends are: "psycopg2", "psycopg1", - "psycopg" (tries psycopg2 and psycopg1), "pygresql". Default is - "psycopg". + list of backend names. Possible backends are: ``psycopg2``, ``psycopg1``, + ``psycopg`` (tries psycopg2 and psycopg1), ``pygresql``. Default is + ``psycopg``. WARNING: API change! PostgresConnection's parameter - "usePygresql" is now replaced with "backend=pygresql". + ``usePygresql`` is now replaced with ``backend=pygresql``. -* The user can choose a DB API driver for MSSQL by using a "backend" - parameter in DB URI or MSSQLConnection that can be a comma-separated list - of backend names. Possible backends are: "adodb" (alias "adodbapi") and - "pymssql". Default is to test adodbapi and pymssql in that order. +* The user can choose a DB API driver for MSSQL by using a ``backend`` + parameter in DB URI or MSSQLConnection that can be a comma-separated + list of backend names. Possible backends are: ``adodb`` (alias + ``adodbapi``) and ``pymssql``. Default is to test adodbapi and pymssql + in that order. * alternateMethodName is defined for all unique fields, not only alternateID; this makes SQLObject create .by*() methods for all unique fields. -* SET client_encoding for PostgreSQL to the value of "charset" parameter +* SET client_encoding for PostgreSQL to the value of ``charset`` parameter in DB URI or PostgresConnection. * TimestampCol() can be instantiated without any defaults, in this case @@ -286,8 +289,9 @@ * Dropped support for PostgreSQL 7.2. The minimal supported version of PostgreSQL is 7.3 now. -* New magic attribute 'j' similar to 'q' was added that automagically does - join with the other table in MultipleJoin or RelatedJoin. +* New magic attribute ``j`` similar to ``q`` was added that + automagically does join with the other table in MultipleJoin or + RelatedJoin. * SQLObject can now create and drop a database in MySQL, PostgreSQL, SQLite and Firebird/Interbase. Modified: SQLObject/trunk/docs/SQLObject.txt ============================================================================== --- SQLObject/trunk/docs/SQLObject.txt Wed Jan 26 07:34:09 2011 (r4329) +++ SQLObject/trunk/docs/SQLObject.txt Wed Jan 26 08:19:31 2011 (r4330) @@ -477,7 +477,7 @@ Person.q.firstName=="John" -converts it to the string "first_name = 'John'" and passes the string to +converts it to the string ``first_name = 'John'`` and passes the string to the backend. selectBy Method @@ -1279,17 +1279,17 @@ .. _`Multiple Join Keywords`: `joinColumn`: - The column name of the key that points to this table. So, if you have - a table ``Product``, and another table has a column ``ProductNo`` that - points to this table, then you'd use ``joinColumn="ProductNo"``. - WARNING: the argument you pass must conform to the column name in the - database, not to the column in the class. So, if you have a SQLObject - containing the 'ProductNo' column, this will probably be translated - into 'product_no_id' in the DB ( product_no is the normal uppercase- - to-lowercase + underscores SQLO Translation, the added _id is just - because the column referring to the table is probably a ForeignKey, - and SQLO translates foreign keys that way). - You should pass that parameter. + The column name of the key that points to this table. So, if you + have a table ``Product``, and another table has a column + ``ProductNo`` that points to this table, then you'd use + ``joinColumn="ProductNo"``. WARNING: the argument you pass must + conform to the column name in the database, not to the column in the + class. So, if you have a SQLObject containing the ``ProductNo`` + column, this will probably be translated into ``product_no_id`` in + the DB (``product_no`` is the normal uppercase- to-lowercase + + underscores SQLO Translation, the added _id is just because the + column referring to the table is probably a ForeignKey, and SQLO + translates foreign keys that way). You should pass that parameter. `orderBy`: Like the `orderBy`_ argument to `select()`, you can specify the order that the joined objects should be returned in. `defaultOrder` @@ -1407,9 +1407,10 @@ database connection, and `commit` and `rollback` just pass that message to the low-level connection. -One can call as much .commit()'s, but after a .rollback() one has to call -.begin(). The last .commit() should be called as .commit(close=True) to -release low-level connection back to the connection pool. +One can call as much ``.commit()``'s, but after a ``.rollback()`` one +has to call ``.begin()``. The last ``.commit()`` should be called as +``.commit(close=True)`` to release low-level connection back to the +connection pool. You can use SELECT FOR UPDATE in those databases that support it:: @@ -1563,7 +1564,7 @@ should be used to map the table column name to SQLObject id column. If the Primary Key consists only of number columns it is possible to create a -virtual column "id" this way: +virtual column ``id`` this way: Example for Postgresql: @@ -1592,7 +1593,7 @@ Caveats: -* this way the "id" may become a very large integer number which may cause +* this way the ``id`` may become a very large integer number which may cause troubles elsewhere. * no performance loss takes place if the where clauses specifies the PK @@ -1619,7 +1620,7 @@ Other styles exist. A typical one is mixed case column names, and a primary key that includes the table name, like ``ProductID``. You can -use a different "Style" object to indicate a different naming +use a different `Style` object to indicate a different naming convention. For instance:: class Person(SQLObject): @@ -1674,13 +1675,14 @@ true, then any SQL sent to the database will also be printed to the console. -You can additionally pass `logger` keyword argument which should be a name -of the logger to use. If specified and `debug` is ``True``, SQLObject will -write debug print statements via that logger instead of printing directly -to console. The argument `loglevel` allows to choose the logging level - it -can be "debug", "info", "warning", "error", "critical" or "exception". In -case `logger` is empty or absent SQLObject uses prints instead of logging; -`loglevel` can be "stdout" or "stderr" in this case; default is "stdout". +You can additionally pass `logger` keyword argument which should be a +name of the logger to use. If specified and `debug` is ``True``, +SQLObject will write debug print statements via that logger instead of +printing directly to console. The argument `loglevel` allows to choose +the logging level - it can be ``debug``, ``info``, ``warning``, +``error``, ``critical`` or ``exception``. In case `logger` is absent or +empty SQLObject uses ``print``'s instead of logging; `loglevel` can be +``stdout`` or ``stderr`` in this case; default is ``stdout``. To configure logging one can do something like that:: @@ -1711,7 +1713,7 @@ does not have support for explicitly defining the backend when using ``createTable``. -Keyword argument "conv" allows to pass a list of custom converters. +Keyword argument ``conv`` allows to pass a list of custom converters. Example:: import time @@ -1744,10 +1746,11 @@ PostgresConnection supports transactions and all other features. -The user can choose a DB API driver for PostgreSQL by using a "driver" +The user can choose a DB API driver for PostgreSQL by using a ``driver`` parameter in DB URI or PostgresConnection that can be a comma-separated -list of driver names. Possible drivers are: "psycopg2", "psycopg1", -"psycopg" (tries psycopg2 and psycopg1), "pygresql". Default is "psycopg". +list of driver names. Possible drivers are: ``psycopg2``, ``psycopg1``, +``psycopg`` (tries psycopg2 and psycopg1), ``pygresql``. Default is +``psycopg``. SQLite ------ @@ -1763,10 +1766,10 @@ SQLite may have concurrency issues, depending on your usage in a multi-threaded environment. -The user can choose a DB API driver for SQLite by using a "driver" +The user can choose a DB API driver for SQLite by using a ``driver`` parameter in DB URI or SQLiteConnection that can be a comma-separated list -of driver names. Possible drivers are: "pysqlite2" (alias "sqlite2"), -"sqlite3", "sqlite" (alias "sqlite1"). Default is to test pysqlite2, +of driver names. Possible drivers are: ``pysqlite2`` (alias ``sqlite2``), +``sqlite3``, ``sqlite`` (alias ``sqlite1``). Default is to test pysqlite2, sqlite3 and sqlite in that order. Firebird @@ -1852,15 +1855,15 @@ SQL Server on a "named" port, make sure to specify the port number in the URI. -The two drivers currently supported are pymssql_ and adodbapi_. +The two drivers currently supported are adodbapi_ and pymssql_. -.. _pymssql: http://pymssql.sourceforge.net/ .. _adodbapi: http://adodbapi.sourceforge.net/ +.. _pymssql: http://pymssql.sourceforge.net/ -The user can choose a DB API driver for MSSQL by using a "driver" +The user can choose a DB API driver for MSSQL by using a ``driver`` parameter in DB URI or MSSQLConnection that can be a comma-separated list -of driver names. Possible drivers are: "adodb" (alias "adodbapi") and -"pymssql". Default is to test adodbapi and pymssql in that order. +of driver names. Possible drivers are: ``adodb`` (alias ``adodbapi``) and +``pymssql``. Default is to test ``adodbapi`` and ``pymssql`` in that order. Events (signals) ================ @@ -2043,9 +2046,9 @@ Select() is used instead of .select() because you need to control what columns the inner query returns. -Available queries are IN(), NOTIN(), EXISTS(), NOTEXISTS(), SOME(), ANY() -and ALL(). The last 3 are used with comparison operators, like this: -"somevalue = ANY(Select(...))". +Available queries are ``IN()``, ``NOTIN()``, ``EXISTS()``, +``NOTEXISTS()``, ``SOME()``, ``ANY()`` and ``ALL()``. The last 3 are +used with comparison operators, like this: ``somevalue = ANY(Select(...))``. Utilities --------- Modified: SQLObject/trunk/docs/SelectResults.txt ============================================================================== --- SQLObject/trunk/docs/SelectResults.txt Wed Jan 26 07:34:09 2011 (r4329) +++ SQLObject/trunk/docs/SelectResults.txt Wed Jan 26 08:19:31 2011 (r4330) @@ -191,7 +191,7 @@ Person.select(Person.q.name=='Steve').throughTo.father.throughTo.father returns a SelectResult of Persons who are the paternal grandfather of someone -named 'Steve'. +named ``Steve``. .. image:: http://sflogo.sourceforge.net/sflogo.php?group_id=74338&type=10 :target: http://sourceforge.net/projects/sqlobject Modified: SQLObject/trunk/docs/TODO.txt ============================================================================== --- SQLObject/trunk/docs/TODO.txt Wed Jan 26 07:34:09 2011 (r4329) +++ SQLObject/trunk/docs/TODO.txt Wed Jan 26 08:19:31 2011 (r4330) @@ -26,7 +26,7 @@ tableParamSQL = 'ENGINE InnoDB' tableParamSQL = {'mysql': 'ENGINE InnoDB'} -* List tables in the DB. The query in MySQL is 'SHOW TABLES'; in SQLite it is +* List tables in the DB. The query in MySQL is ``SHOW TABLES``; in SQLite it is SELECT name FROM sqlite_master WHERE type='table' ORDER BY name @@ -54,7 +54,7 @@ * Cache columns in sqlmeta.getColumns(); reset the cache on add/Del Column/Join. -* Stop supporting Python 2.4: use 'with lock'; use hashlib instead of md5. +* Stop supporting Python 2.4: use ``with lock``; use hashlib instead of md5. * Stop supporting Python 2.5: remove import sets. |
|
From: <sub...@co...> - 2011-01-26 14:34:16
|
Author: phd
Date: Wed Jan 26 07:34:09 2011
New Revision: 4329
Log:
Parameter 'backend' in DB URI is no longer supported, use parameter 'driver'.
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/docs/TODO.txt
SQLObject/trunk/sqlobject/mssql/mssqlconnection.py
SQLObject/trunk/sqlobject/postgres/pgconnection.py
SQLObject/trunk/sqlobject/rdbhost/rdbhostconnection.py
SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
Modified: SQLObject/trunk/docs/News.txt
==============================================================================
--- SQLObject/trunk/docs/News.txt Wed Jan 26 07:24:28 2011 (r4328)
+++ SQLObject/trunk/docs/News.txt Wed Jan 26 07:34:09 2011 (r4329)
@@ -13,6 +13,8 @@
Features & Interface
--------------------
+* Parameter 'backend' in DB URI is no longer supported, use parameter 'driver'.
+
SQLObject 0.15.1
================
Modified: SQLObject/trunk/docs/TODO.txt
==============================================================================
--- SQLObject/trunk/docs/TODO.txt Wed Jan 26 07:24:28 2011 (r4328)
+++ SQLObject/trunk/docs/TODO.txt Wed Jan 26 07:34:09 2011 (r4329)
@@ -1,8 +1,6 @@
TODO
----
-* Stop supporting parameter 'backend'.
-
* Proper %-encoded URI.
* __version__.py
Modified: SQLObject/trunk/sqlobject/mssql/mssqlconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/mssql/mssqlconnection.py Wed Jan 26 07:24:28 2011 (r4328)
+++ SQLObject/trunk/sqlobject/mssql/mssqlconnection.py Wed Jan 26 07:34:09 2011 (r4329)
@@ -10,8 +10,7 @@
def __init__(self, db, user, password='', host='localhost',
autoCommit=0, **kw):
- drivers = kw.pop('driver', None) or \
- kw.pop('backend', None) or 'adodb,pymssql'
+ drivers = kw.pop('driver', None) or 'adodb,pymssql'
for driver in drivers.split(','):
driver = driver.strip()
if not driver:
Modified: SQLObject/trunk/sqlobject/postgres/pgconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/postgres/pgconnection.py Wed Jan 26 07:24:28 2011 (r4328)
+++ SQLObject/trunk/sqlobject/postgres/pgconnection.py Wed Jan 26 07:34:09 2011 (r4329)
@@ -12,8 +12,7 @@
def __init__(self, dsn=None, host=None, port=None, db=None,
user=None, password=None, **kw):
- drivers = kw.pop('driver', None) or \
- kw.pop('backend', None) or 'psycopg'
+ drivers = kw.pop('driver', None) or 'psycopg'
for driver in drivers.split(','):
driver = driver.strip()
if not driver:
Modified: SQLObject/trunk/sqlobject/rdbhost/rdbhostconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/rdbhost/rdbhostconnection.py Wed Jan 26 07:24:28 2011 (r4328)
+++ SQLObject/trunk/sqlobject/rdbhost/rdbhostconnection.py Wed Jan 26 07:34:09 2011 (r4329)
@@ -18,15 +18,15 @@
schemes = [dbName]
def __init__(self, dsn=None, host=None, port=None, db=None,
- user=None, password=None, backend='rdbhost', unicodeCols=False,
+ user=None, password=None, unicodeCols=False, driver='rdbhost',
**kw):
- backends = backend
- for backend in backends.split(','):
- backend = backend.strip()
- if not backend:
+ drivers = driver
+ for driver in drivers.split(','):
+ driver = driver.strip()
+ if not driver:
continue
try:
- if backend == 'rdbhost':
+ if driver == 'rdbhost':
from rdbhdb import rdbhdb as rdb
# monkey patch % escaping into Cursor._execute
old_execute = getattr(rdb.Cursor, '_execute')
@@ -38,13 +38,13 @@
setattr(rdb.Cursor, '_execute', _execute)
self.module = rdb
else:
- raise ValueError('Unknown Rdbhost backend %s'%backend)
+ raise ValueError('Unknown Rdbhost driver %s' % driver)
except ImportError:
pass
else:
break
else:
- raise ImportError('Cannot find the Rdbhost backend')
+ raise ImportError('Cannot find the Rdbhost driver')
self.user = user
self.host = host
self.port = port
Modified: SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py
==============================================================================
--- SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py Wed Jan 26 07:24:28 2011 (r4328)
+++ SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py Wed Jan 26 07:34:09 2011 (r4329)
@@ -22,8 +22,7 @@
schemes = [dbName]
def __init__(self, filename, autoCommit=1, **kw):
- drivers = kw.pop('driver', None) or \
- kw.pop('backend', None) or 'pysqlite2,sqlite3,sqlite'
+ drivers = kw.pop('driver', None) or 'pysqlite2,sqlite3,sqlite'
for driver in drivers.split(','):
driver = driver.strip()
if not driver:
|
|
From: <sub...@co...> - 2011-01-26 14:24:38
|
Author: phd Date: Wed Jan 26 07:24:28 2011 New Revision: 4328 Log: Some more future plans. Modified: SQLObject/trunk/docs/TODO.txt Modified: SQLObject/trunk/docs/TODO.txt ============================================================================== --- SQLObject/trunk/docs/TODO.txt Mon Dec 27 10:26:59 2010 (r4327) +++ SQLObject/trunk/docs/TODO.txt Wed Jan 26 07:24:28 2011 (r4328) @@ -81,6 +81,8 @@ * Python 3.0+. +* Switch from setuptools to distribute. + * py-postgresql driver: http://python.projects.postgresql.org/ * MySQL Connector/Python: https://launchpad.net/myconnpy @@ -97,6 +99,8 @@ * More documentation. Wiki. Trac. Mercurial. +* RSS 2.0 and Atom news feeds. + * Use DBUtils_, especially SolidConnection. .. _DBUtils: http://www.webwareforpython.org/DBUtils |
|
From: SourceForge.net <no...@so...> - 2011-01-18 19:46:01
|
Bugs item #3161107, was opened at 2011-01-18 19:46 Message generated for change (Tracker Item Submitted) made by nobody You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=3161107&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: General Group: SQLObject from repository Status: Open Resolution: None Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: SQLObjectIntegrityError exception with from sqlobject import Initial Comment: If I import SQLObject via from sqlobject import * the exception SQLObjectIntegrityError is not available in the global scope after doing that import. The exception is not listed in the __all__ list for the main.py module. I feel it should be in global scope since the sresults.py raises that exception in the getOne method if the select results contain more than one result. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=3161107&group_id=74338 |
|
From: <sub...@co...> - 2010-12-27 17:27:05
|
Author: phd
Date: Mon Dec 27 10:26:59 2010
New Revision: 4327
Log:
Documented Union.
Modified:
SQLObject/trunk/docs/SQLBuilder.txt
Modified: SQLObject/trunk/docs/SQLBuilder.txt
==============================================================================
--- SQLObject/trunk/docs/SQLBuilder.txt Mon Dec 27 10:22:27 2010 (r4326)
+++ SQLObject/trunk/docs/SQLBuilder.txt Mon Dec 27 10:26:59 2010 (r4327)
@@ -85,7 +85,7 @@
>> query = connection.sqlrepr(select) # Convert to SQL string:
>> # SELECT name, AVG(salary) FROM employees GROUP BY name
>> rows = connection.queryAll(query) # Execute the query
- >> # and get back the result as a list of rows
+ >> # and get back the results as a list of rows
>> # where every row is a sequence of length 2 (name and average salary)
.. _`higher-level API`: SQLObject.html
@@ -94,7 +94,8 @@
~~~~~~
A class to build ``SELECT`` queries. Accepts a number of parameters, all
-parameters except `items` are optional.
+parameters except `items` are optional. Use ``connection.queryAll(query)``
+to execute the query and get back the results as a list of rows.
`items`:
An SQLExpression or a sequence of SQLExpression's, represents the
@@ -218,6 +219,24 @@
# DELETE FROM person WHERE id=1
>> connection.query(query)
+Union
+~~~~~
+
+A class to build ``UNION`` queries. Accepts a number of parameters -
+``Select`` queries. Use ``connection.queryAll(query)`` to execute the
+query and get back the results.
+
+Example::
+
+ >> select1 = Select(['min', func.MIN(const.salary)], staticTables=['employees'])
+ >> select2 = Select(['max', func.MAX(const.salary)], staticTables=['employees'])
+ >> union = Union(select1, select2)
+ >> query = connection.sqlrepr(union)
+ # SELECT 'min', MIN(salary) FROM employees
+ # UNION
+ # SELECT 'max', MAX(salary) FROM employees
+ >> rows = connection.queryAll(query)
+
Nested SQL statements (subqueries)
==================================
|
|
From: <sub...@co...> - 2010-12-27 17:22:33
|
Author: phd Date: Mon Dec 27 10:22:27 2010 New Revision: 4326 Log: 0.14.2. Modified: SQLObject/trunk/docs/News.txt Modified: SQLObject/trunk/docs/News.txt ============================================================================== --- SQLObject/trunk/docs/News.txt Mon Dec 27 10:21:34 2010 (r4325) +++ SQLObject/trunk/docs/News.txt Mon Dec 27 10:22:27 2010 (r4326) @@ -16,7 +16,7 @@ SQLObject 0.15.1 ================ -* A bugfix was ported from `SQLObject 0.14.1`_. +* A bugfix was ported from `SQLObject 0.14.2`_. SQLObject 0.15.0 ================ |
|
From: <sub...@co...> - 2010-12-27 17:21:40
|
Author: phd Date: Mon Dec 27 10:21:34 2010 New Revision: 4325 Log: 0.14.2. Modified: SQLObject/branches/0.15/docs/News.txt Modified: SQLObject/branches/0.15/docs/News.txt ============================================================================== --- SQLObject/branches/0.15/docs/News.txt Mon Dec 27 10:10:22 2010 (r4324) +++ SQLObject/branches/0.15/docs/News.txt Mon Dec 27 10:21:34 2010 (r4325) @@ -10,7 +10,7 @@ SQLObject 0.15.1 ================ -* A bugfix was ported from `SQLObject 0.14.1`_. +* A bugfix was ported from `SQLObject 0.14.2`_. SQLObject 0.15.0 ================ |
|
From: <sub...@co...> - 2010-12-27 17:10:28
|
Author: phd Date: Mon Dec 27 10:10:22 2010 New Revision: 4324 Log: Merged revision 4323 from branch 0.15: documented a minor bugfix creeped in revision 4319. Modified: SQLObject/trunk/docs/News.txt Modified: SQLObject/trunk/docs/News.txt ============================================================================== --- SQLObject/trunk/docs/News.txt Mon Dec 27 10:08:43 2010 (r4323) +++ SQLObject/trunk/docs/News.txt Mon Dec 27 10:10:22 2010 (r4324) @@ -13,6 +13,11 @@ Features & Interface -------------------- +SQLObject 0.15.1 +================ + +* A bugfix was ported from `SQLObject 0.14.1`_. + SQLObject 0.15.0 ================ @@ -29,6 +34,11 @@ with the instance as the first parameter. The following signals were changed: RowUpdatedSignal, RowDestroySignal, RowDestroyedSignal. +SQLObject 0.14.2 +================ + +* A minor bug was fixed in sqlbuilder.Union. + SQLObject 0.14.1 ================ |
|
From: <sub...@co...> - 2010-12-27 17:08:50
|
Author: phd Date: Mon Dec 27 10:08:43 2010 New Revision: 4323 Log: Merged revision 4322 from branch 0.14: documented a minor bugfix creeped in revision 4319. Modified: SQLObject/branches/0.15/docs/News.txt Modified: SQLObject/branches/0.15/docs/News.txt ============================================================================== --- SQLObject/branches/0.15/docs/News.txt Mon Dec 27 10:06:44 2010 (r4322) +++ SQLObject/branches/0.15/docs/News.txt Mon Dec 27 10:08:43 2010 (r4323) @@ -7,6 +7,11 @@ .. _start: +SQLObject 0.15.1 +================ + +* A bugfix was ported from `SQLObject 0.14.1`_. + SQLObject 0.15.0 ================ @@ -23,6 +28,11 @@ with the instance as the first parameter. The following signals were changed: RowUpdatedSignal, RowDestroySignal, RowDestroyedSignal. +SQLObject 0.14.2 +================ + +* A minor bug was fixed in sqlbuilder.Union. + SQLObject 0.14.1 ================ |
|
From: <sub...@co...> - 2010-12-27 17:06:50
|
Author: phd Date: Mon Dec 27 10:06:44 2010 New Revision: 4322 Log: Documented a minor bugfix creeped in revision 4319. Modified: SQLObject/branches/0.14/docs/News.txt Modified: SQLObject/branches/0.14/docs/News.txt ============================================================================== --- SQLObject/branches/0.14/docs/News.txt Mon Dec 27 09:35:59 2010 (r4321) +++ SQLObject/branches/0.14/docs/News.txt Mon Dec 27 10:06:44 2010 (r4322) @@ -7,6 +7,11 @@ .. _start: +SQLObject 0.14.2 +================ + +* A minor bug was fixed in sqlbuilder.Union. + SQLObject 0.14.1 ================ |
|
From: <sub...@co...> - 2010-12-27 16:36:06
|
Author: phd
Date: Mon Dec 27 09:35:59 2010
New Revision: 4321
Log:
Merged revisions 4318, 4319 from branch 0.14: more tests for SQLBuilder; fixed spaces after commas.
Modified:
SQLObject/trunk/sqlobject/sqlbuilder.py
SQLObject/trunk/sqlobject/tests/test_sqlbuilder.py
Modified: SQLObject/trunk/sqlobject/sqlbuilder.py
==============================================================================
--- SQLObject/trunk/sqlobject/sqlbuilder.py Mon Dec 27 09:35:37 2010 (r4320)
+++ SQLObject/trunk/sqlobject/sqlbuilder.py Mon Dec 27 09:35:59 2010 (r4321)
@@ -412,7 +412,7 @@
class SQLObjectTableWithJoins(SQLObjectTable):
def __getattr__(self, attr):
- if attr+'ID' in [k for (k,v) in self.soClass.sqlmeta.columns.items() if v.foreignKey]:
+ if attr+'ID' in [k for (k, v) in self.soClass.sqlmeta.columns.items() if v.foreignKey]:
column = self.soClass.sqlmeta.columns[attr+'ID']
return self._getattrFromForeignKey(column, attr)
elif attr in [x.joinMethodName for x in self.soClass.sqlmeta.joins]:
@@ -477,7 +477,7 @@
def __init__(self, table, alias=None):
if hasattr(table, "sqlmeta"):
tableName = SQLConstant(table.sqlmeta.table)
- elif isinstance(table, (Select,Union)):
+ elif isinstance(table, (Select, Union)):
assert alias is not None, "Alias name cannot be constructed from Select instances, please provide 'alias' kw."
tableName = Subquery('', table)
table = None
@@ -527,7 +527,7 @@
if isinstance(t, Table):
t = t.tableName
if not isinstance(t, SQLExpression):
- t = SQLConstant(t.sqlmeta.table)
+ t = SQLConstant(t)
tabs.append(t)
self.tables = tabs
@@ -1246,7 +1246,7 @@
self.sqlmeta = _Delay_proxy(table=_DelayClass(self, clsName))
self.q = self
self.soClass = None
- classregistry.registry(registry).addClassCallback(clsName,lambda foreign, me: setattr(me, 'soClass', foreign), self)
+ classregistry.registry(registry).addClassCallback(clsName, lambda foreign, me: setattr(me, 'soClass', foreign), self)
def __nonzero__(self):
return True
Modified: SQLObject/trunk/sqlobject/tests/test_sqlbuilder.py
==============================================================================
--- SQLObject/trunk/sqlobject/tests/test_sqlbuilder.py Mon Dec 27 09:35:37 2010 (r4320)
+++ SQLObject/trunk/sqlobject/tests/test_sqlbuilder.py Mon Dec 27 09:35:59 2010 (r4321)
@@ -1,4 +1,25 @@
-from sqlobject.sqlbuilder import AND, SQLOp, sqlrepr
+from sqlobject import *
+from sqlobject.sqlbuilder import *
+from sqlobject.tests.dbtest import *
+
+class TestSQLBuilder(SQLObject):
+ name = StringCol()
+ value = IntCol()
+
+def test_Select():
+ setupClass(TestSQLBuilder)
+
+ select1 = Select([const.id, func.MAX(const.salary)], staticTables=['employees'])
+ assert sqlrepr(select1) == 'SELECT id, MAX(salary) FROM employees'
+
+ select2 = Select([TestSQLBuilder.q.name, TestSQLBuilder.q.value])
+ assert sqlrepr(select2) == 'SELECT test_sql_builder.name, test_sql_builder.value FROM test_sql_builder'
+
+ union = Union(select1, select2)
+ assert sqlrepr(union) == 'SELECT id, MAX(salary) FROM employees UNION SELECT test_sql_builder.name, test_sql_builder.value FROM test_sql_builder'
+
+ union = Union(TestSQLBuilder.select().queryForSelect())
+ assert sqlrepr(union) == 'SELECT test_sql_builder.id, test_sql_builder.name, test_sql_builder.value FROM test_sql_builder WHERE 1 = 1'
def test_empty_AND():
assert AND() == None
|
|
From: <sub...@co...> - 2010-12-27 16:35:45
|
Author: phd
Date: Mon Dec 27 09:35:37 2010
New Revision: 4320
Log:
Merged revisions 4318, 4319 from branch 0.14: more tests for SQLBuilder; fixed spaces after commas.
Modified:
SQLObject/branches/0.15/sqlobject/sqlbuilder.py
SQLObject/branches/0.15/sqlobject/tests/test_sqlbuilder.py
Modified: SQLObject/branches/0.15/sqlobject/sqlbuilder.py
==============================================================================
--- SQLObject/branches/0.15/sqlobject/sqlbuilder.py Mon Dec 27 09:33:58 2010 (r4319)
+++ SQLObject/branches/0.15/sqlobject/sqlbuilder.py Mon Dec 27 09:35:37 2010 (r4320)
@@ -412,7 +412,7 @@
class SQLObjectTableWithJoins(SQLObjectTable):
def __getattr__(self, attr):
- if attr+'ID' in [k for (k,v) in self.soClass.sqlmeta.columns.items() if v.foreignKey]:
+ if attr+'ID' in [k for (k, v) in self.soClass.sqlmeta.columns.items() if v.foreignKey]:
column = self.soClass.sqlmeta.columns[attr+'ID']
return self._getattrFromForeignKey(column, attr)
elif attr in [x.joinMethodName for x in self.soClass.sqlmeta.joins]:
@@ -477,7 +477,7 @@
def __init__(self, table, alias=None):
if hasattr(table, "sqlmeta"):
tableName = SQLConstant(table.sqlmeta.table)
- elif isinstance(table, (Select,Union)):
+ elif isinstance(table, (Select, Union)):
assert alias is not None, "Alias name cannot be constructed from Select instances, please provide 'alias' kw."
tableName = Subquery('', table)
table = None
@@ -527,7 +527,7 @@
if isinstance(t, Table):
t = t.tableName
if not isinstance(t, SQLExpression):
- t = SQLConstant(t.sqlmeta.table)
+ t = SQLConstant(t)
tabs.append(t)
self.tables = tabs
@@ -1246,7 +1246,7 @@
self.sqlmeta = _Delay_proxy(table=_DelayClass(self, clsName))
self.q = self
self.soClass = None
- classregistry.registry(registry).addClassCallback(clsName,lambda foreign, me: setattr(me, 'soClass', foreign), self)
+ classregistry.registry(registry).addClassCallback(clsName, lambda foreign, me: setattr(me, 'soClass', foreign), self)
def __nonzero__(self):
return True
Modified: SQLObject/branches/0.15/sqlobject/tests/test_sqlbuilder.py
==============================================================================
--- SQLObject/branches/0.15/sqlobject/tests/test_sqlbuilder.py Mon Dec 27 09:33:58 2010 (r4319)
+++ SQLObject/branches/0.15/sqlobject/tests/test_sqlbuilder.py Mon Dec 27 09:35:37 2010 (r4320)
@@ -1,4 +1,25 @@
-from sqlobject.sqlbuilder import AND, SQLOp, sqlrepr
+from sqlobject import *
+from sqlobject.sqlbuilder import *
+from sqlobject.tests.dbtest import *
+
+class TestSQLBuilder(SQLObject):
+ name = StringCol()
+ value = IntCol()
+
+def test_Select():
+ setupClass(TestSQLBuilder)
+
+ select1 = Select([const.id, func.MAX(const.salary)], staticTables=['employees'])
+ assert sqlrepr(select1) == 'SELECT id, MAX(salary) FROM employees'
+
+ select2 = Select([TestSQLBuilder.q.name, TestSQLBuilder.q.value])
+ assert sqlrepr(select2) == 'SELECT test_sql_builder.name, test_sql_builder.value FROM test_sql_builder'
+
+ union = Union(select1, select2)
+ assert sqlrepr(union) == 'SELECT id, MAX(salary) FROM employees UNION SELECT test_sql_builder.name, test_sql_builder.value FROM test_sql_builder'
+
+ union = Union(TestSQLBuilder.select().queryForSelect())
+ assert sqlrepr(union) == 'SELECT test_sql_builder.id, test_sql_builder.name, test_sql_builder.value FROM test_sql_builder WHERE 1 = 1'
def test_empty_AND():
assert AND() == None
|