sqlobject-cvs Mailing List for SQLObject (Page 44)
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: SourceForge.net <no...@so...> - 2010-11-18 12:14:38
|
Bugs item #3111474, was opened at 2010-11-18 12:14 Message generated for change (Tracker Item Submitted) made by nobody You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=3111474&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: _defaultOrder Documentation outdated Initial Comment: Documentation autodated, _defaultOrder does not work like described in: http://sqlobject.org/SQLObject.html#exported-symbols from sqlobject import SQLObject, UnicodeCol, connectionForURI, sqlhub connection = connectionForURI('sqlite:/:memory:?debug=1') sqlhub.processConnection = connection class DefOrder(SQLObject): _defaultOrder = "name" name = UnicodeCol(default="") DefOrder.createTable() def test_defaultorder(): b = DefOrder(name="b") a = DefOrder(name="a") s = DefOrder.select() assert s[0] == a def test_defaultorder_sqlmeta(): for d in DefOrder.select(): d.destroySelf() DefOrder.sqlmeta.defaultOrder = DefOrder.q.name b = DefOrder(name="b") a = DefOrder(name="a") s = DefOrder.select() assert s[0] == a gregor@valun:/tmp$ nosetests --pdb defaultorder.py /usr/lib/pymodules/python2.6/tw/core/view.py:223: DeprecationWarning: object.__new__() takes no parameters obj = object.__new__(cls, *args, **kw) F. ====================================================================== FAIL: defaultorder.test_defaultorder ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/pymodules/python2.6/nose/case.py", line 183, in runTest self.test(*self.arg) File "/tmp/defaultorder.py", line 15, in test_defaultorder assert s[0] == a AssertionError: -------------------- >> begin captured stdout << --------------------- 2/QueryIns: INSERT INTO def_order (name) VALUES ('b') 2/QueryR : INSERT INTO def_order (name) VALUES ('b') 3/QueryOne: SELECT name FROM def_order WHERE ((def_order.id) = (1)) 3/QueryR : SELECT name FROM def_order WHERE ((def_order.id) = (1)) 4/QueryIns: INSERT INTO def_order (name) VALUES ('a') 4/QueryR : INSERT INTO def_order (name) VALUES ('a') 5/QueryOne: SELECT name FROM def_order WHERE ((def_order.id) = (2)) 5/QueryR : SELECT name FROM def_order WHERE ((def_order.id) = (2)) 6/Select : SELECT def_order.id, def_order.name FROM def_order WHERE 1 = 1 LIMIT 1 6/QueryR : SELECT def_order.id, def_order.name FROM def_order WHERE 1 = 1 LIMIT 1 --------------------- >> end captured stdout << ---------------------- ---------------------------------------------------------------------- Ran 2 tests in 0.003s FAILED (failures=1) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=3111474&group_id=74338 |
|
From: <sub...@co...> - 2010-11-13 18:14:53
|
Author: phd
Date: Sat Nov 13 10:26:37 2010
New Revision: 4270
Log:
Major API change: all signals are sent with the instance (or the class)
as the first parameter. The following signals were changed:
RowCreateSignal, RowCreatedSignal, DeleteColumnSignal.
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/sqlobject/events.py
SQLObject/trunk/sqlobject/main.py
SQLObject/trunk/sqlobject/tests/test_events.py
Modified: SQLObject/trunk/docs/News.txt
==============================================================================
--- SQLObject/trunk/docs/News.txt Fri Oct 15 07:04:19 2010 (r4269)
+++ SQLObject/trunk/docs/News.txt Sat Nov 13 10:26:37 2010 (r4270)
@@ -13,6 +13,10 @@
Features & Interface
--------------------
+* Major API change: all signals are sent with the instance (or the class)
+ as the first parameter. The following signals were changed:
+ RowCreateSignal, RowCreatedSignal, DeleteColumnSignal.
+
SQLObject 0.14.1
================
Modified: SQLObject/trunk/sqlobject/events.py
==============================================================================
--- SQLObject/trunk/sqlobject/events.py Fri Oct 15 07:04:19 2010 (r4269)
+++ SQLObject/trunk/sqlobject/events.py Sat Nov 13 10:26:37 2010 (r4270)
@@ -70,7 +70,7 @@
class RowCreateSignal(Signal):
"""
Called before an instance is created, with the class as the
- sender. Called with the arguments ``(kwargs, post_funcs)``.
+ sender. Called with the arguments ``(instance, kwargs, post_funcs)``.
There may be a ``connection`` argument. ``kwargs``may be usefully
modified. ``post_funcs`` is a list of callbacks, intended to have
functions appended to it, and are called with the arguments
@@ -82,7 +82,7 @@
class RowCreatedSignal(Signal):
"""
Called after an instance is created, with the class as the
- sender. Called with the arguments ``(kwargs, post_funcs)``.
+ sender. Called with the arguments ``(instance, kwargs, post_funcs)``.
There may be a ``connection`` argument. ``kwargs``may be usefully
modified. ``post_funcs`` is a list of callbacks, intended to have
functions appended to it, and are called with the arguments
Modified: SQLObject/trunk/sqlobject/main.py
==============================================================================
--- SQLObject/trunk/sqlobject/main.py Fri Oct 15 07:04:19 2010 (r4269)
+++ SQLObject/trunk/sqlobject/main.py Sat Nov 13 10:26:37 2010 (r4270)
@@ -461,8 +461,8 @@
raise IndexError(
"Column with definition %r not found" % column)
post_funcs = []
- cls.send(events.DeleteColumnSignal, connection, column.name, column,
- post_funcs)
+ cls.send(events.DeleteColumnSignal, cls.soClass, connection,
+ column.name, column, post_funcs)
name = column.name
del sqlmeta.columns[name]
del sqlmeta.columnDefinitions[name]
@@ -1207,7 +1207,7 @@
return
post_funcs = []
- self.sqlmeta.send(events.RowCreateSignal, kw, post_funcs)
+ self.sqlmeta.send(events.RowCreateSignal, self, kw, post_funcs)
# Pass the connection object along if we were given one.
if kw.has_key('connection'):
@@ -1303,7 +1303,7 @@
post_funcs = []
kw = dict([('class', self.__class__), ('id', id)])
def _send_RowCreatedSignal():
- self.sqlmeta.send(events.RowCreatedSignal, kw, post_funcs)
+ self.sqlmeta.send(events.RowCreatedSignal, self, kw, post_funcs)
for func in post_funcs:
func(self)
_postponed_local.postponed_calls.append(_send_RowCreatedSignal)
Modified: SQLObject/trunk/sqlobject/tests/test_events.py
==============================================================================
--- SQLObject/trunk/sqlobject/tests/test_events.py Fri Oct 15 07:04:19 2010 (r4269)
+++ SQLObject/trunk/sqlobject/tests/test_events.py Sat Nov 13 10:26:37 2010 (r4270)
@@ -37,10 +37,12 @@
def test_row_create():
setupClass(EventTester)
watcher = make_listen(events.RowCreateSignal)
- EventTester(name='foo')
- EventTester(name='bar')
+ row1 = EventTester(name='foo')
+ row2 = EventTester(name='bar')
assert len(watcher.log) == 2
- assert watcher.log[0] == ({'name': 'foo'}, [])
+ assert watcher.log == [
+ (row1, {'name': 'foo'}, []),
+ (row2, {'name': 'bar'}, [])]
def test_row_destroy():
setupClass(EventTester)
@@ -102,9 +104,11 @@
c = IntCol()
def _query(instance):
- InheritableEventTestA.get(instance.id)
+ row = InheritableEventTestA.get(instance.id)
+ assert isinstance(row, InheritableEventTestC)
+ assert row.c == 3
-def _signal(kwargs, postfuncs):
+def _signal(instance, kwargs, postfuncs):
postfuncs.append(_query)
def test_inheritance_row_created():
|
|
From: <sub...@co...> - 2010-11-13 18:14:41
|
Author: phd
Date: Sat Nov 13 10:46:46 2010
New Revision: 4271
Log:
Major API change: post-functions for all signals are called with the
instance as the first parameter. The following signals were changed:
RowUpdatedSignal, RowDestroySignal, RowDestroyedSignal.
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/sqlobject/events.py
SQLObject/trunk/sqlobject/main.py
Modified: SQLObject/trunk/docs/News.txt
==============================================================================
--- SQLObject/trunk/docs/News.txt Sat Nov 13 10:26:37 2010 (r4270)
+++ SQLObject/trunk/docs/News.txt Sat Nov 13 10:46:46 2010 (r4271)
@@ -17,6 +17,10 @@
as the first parameter. The following signals were changed:
RowCreateSignal, RowCreatedSignal, DeleteColumnSignal.
+* Major API change: post-functions for all signals are called with the
+ instance as the first parameter. The following signals were changed:
+ RowUpdatedSignal, RowDestroySignal, RowDestroyedSignal.
+
SQLObject 0.14.1
================
Modified: SQLObject/trunk/sqlobject/events.py
==============================================================================
--- SQLObject/trunk/sqlobject/events.py Sat Nov 13 10:26:37 2010 (r4270)
+++ SQLObject/trunk/sqlobject/events.py Sat Nov 13 10:46:46 2010 (r4271)
@@ -100,8 +100,8 @@
class. Arguments are ``(instance, post_funcs)``.
``post_funcs`` is a list of callbacks, intended to have
- functions appended to it, and are called without arguments. If
- any of the post_funcs raises an exception, the deletion is only
+ functions appended to it, and are called with arguments ``(instance)``.
+ If any of the post_funcs raises an exception, the deletion is only
affected if this will prevent a commit.
You cannot cancel the delete, but you can raise an exception (which will
@@ -139,8 +139,10 @@
"""
Called when an instance is updated through a call to ``.set()``
(or a column attribute assignment). The arguments are
- ``(instance)``. This is run *after* the instance is updated;
- Works better with lazyUpdate = True
+ ``(instance, post_funcs)``. ``post_funcs`` is a list of callbacks,
+ intended to have functions appended to it, and are called with the
+ arguments ``(new_instance)``. This is run *after* the instance is
+ updated; Works better with lazyUpdate = True.
"""
class AddColumnSignal(Signal):
Modified: SQLObject/trunk/sqlobject/main.py
==============================================================================
--- SQLObject/trunk/sqlobject/main.py Sat Nov 13 10:26:37 2010 (r4270)
+++ SQLObject/trunk/sqlobject/main.py Sat Nov 13 10:46:46 2010 (r4271)
@@ -1001,7 +1001,7 @@
post_funcs = []
self.sqlmeta.send(events.RowUpdatedSignal, self, post_funcs)
for func in post_funcs:
- func()
+ func(self)
def expire(self):
if self.sqlmeta.expired:
@@ -1058,7 +1058,7 @@
post_funcs = []
self.sqlmeta.send(events.RowUpdatedSignal, self, post_funcs)
for func in post_funcs:
- func()
+ func(self)
def set(self, _suppress_set_sig=False, **kw):
if not self.sqlmeta._creating and not getattr(self.sqlmeta, "row_update_sig_suppress", False) and not _suppress_set_sig:
@@ -1150,7 +1150,7 @@
post_funcs = []
self.sqlmeta.send(events.RowUpdatedSignal, self, post_funcs)
for func in post_funcs:
- func()
+ func(self)
def _SO_selectInit(self, row):
for col, colValue in zip(self.sqlmeta.columnList, row):
@@ -1584,12 +1584,12 @@
self._connection.cache.expire(self.id, self.__class__)
for func in post_funcs:
- func()
+ func(self)
post_funcs = []
self.sqlmeta.send(events.RowDestroyedSignal, self, post_funcs)
for func in post_funcs:
- func()
+ func(self)
def delete(cls, id, connection=None):
obj = cls.get(id, connection=connection)
|
|
From: <sub...@co...> - 2010-10-15 13:04:25
|
Author: phd Date: 2010-10-15 07:04:19 -0600 (Fri, 15 Oct 2010) New Revision: 4269 Modified: SQLObject/tags/0.14.1/README.txt SQLObject/tags/0.14.1/setup.cfg SQLObject/tags/0.14.1/setup.py SQLObject/tags/0.14.1/sqlobject/__init__.py SQLObject/tags/0.14.1/sqlobject/main.py Log: Version 0.14.1. Modified: SQLObject/tags/0.14.1/README.txt =================================================================== --- SQLObject/tags/0.14.1/README.txt 2010-10-15 13:03:28 UTC (rev 4268) +++ SQLObject/tags/0.14.1/README.txt 2010-10-15 13:04:19 UTC (rev 4269) @@ -1,5 +1,5 @@ -SQLObject 0.14 -============== +SQLObject 0.14.1 +================ Thanks for looking at SQLObject. SQLObject is an object-relational mapper, i.e., a library that will wrap your database tables in Python Modified: SQLObject/tags/0.14.1/setup.cfg =================================================================== --- SQLObject/tags/0.14.1/setup.cfg 2010-10-15 13:03:28 UTC (rev 4268) +++ SQLObject/tags/0.14.1/setup.cfg 2010-10-15 13:04:19 UTC (rev 4269) @@ -5,10 +5,6 @@ [easy_install] #find_links = http://svn.pythonpaste.org/package_index.html -[egg_info] -tag_build = dev -tag_svn_revision = true - [pudge] theme = pythonpaste.org docs = docs/index.txt docs/Authors.txt docs/DeveloperGuide.txt docs/FAQ.txt Modified: SQLObject/tags/0.14.1/setup.py =================================================================== --- SQLObject/tags/0.14.1/setup.py 2010-10-15 13:03:28 UTC (rev 4268) +++ SQLObject/tags/0.14.1/setup.py 2010-10-15 13:04:19 UTC (rev 4269) @@ -21,7 +21,7 @@ """ setup(name="SQLObject", - version="0.14", + version="0.14.1", description="Object-Relational Manager, aka database wrapper", long_description="""\ SQLObject is a popular *Object Relational Manager* for providing an @@ -49,7 +49,7 @@ author="Ian Bicking", author_email="ia...@co...", url="http://sqlobject.org/devel/", - download_url="http://cheeseshop.python.org/pypi/SQLObject/", + download_url="http://cheeseshop.python.org/pypi/SQLObject/0.14.1", license="LGPL", packages=["sqlobject"] + ['sqlobject.%s' % package for package in subpackages], scripts=["scripts/sqlobject-admin"], Modified: SQLObject/tags/0.14.1/sqlobject/__init__.py =================================================================== --- SQLObject/tags/0.14.1/sqlobject/__init__.py 2010-10-15 13:03:28 UTC (rev 4268) +++ SQLObject/tags/0.14.1/sqlobject/__init__.py 2010-10-15 13:04:19 UTC (rev 4269) @@ -1,5 +1,5 @@ """ -SQLObject 0.14 +SQLObject 0.14.1 """ from col import * Modified: SQLObject/tags/0.14.1/sqlobject/main.py =================================================================== --- SQLObject/tags/0.14.1/sqlobject/main.py 2010-10-15 13:03:28 UTC (rev 4268) +++ SQLObject/tags/0.14.1/sqlobject/main.py 2010-10-15 13:04:19 UTC (rev 4269) @@ -1,6 +1,6 @@ """ -SQLObject 0.14 --------------- +SQLObject 0.14.1 +---------------- :author: Ian Bicking <ia...@co...> |
|
From: <sub...@co...> - 2010-10-15 13:03:34
|
Author: phd
Date: 2010-10-15 07:03:28 -0600 (Fri, 15 Oct 2010)
New Revision: 4268
Modified:
SQLObject/branches/0.14/setup.py
Log:
Fixed the download URL.
Modified: SQLObject/branches/0.14/setup.py
===================================================================
--- SQLObject/branches/0.14/setup.py 2010-10-15 13:01:36 UTC (rev 4267)
+++ SQLObject/branches/0.14/setup.py 2010-10-15 13:03:28 UTC (rev 4268)
@@ -49,7 +49,7 @@
author="Ian Bicking",
author_email="ia...@co...",
url="http://sqlobject.org/devel/",
- download_url="http://cheeseshop.python.org/pypi/SQLObject/",
+ download_url="http://cheeseshop.python.org/pypi/SQLObject/0.14",
license="LGPL",
packages=["sqlobject"] + ['sqlobject.%s' % package for package in subpackages],
scripts=["scripts/sqlobject-admin"],
|
|
From: <sub...@co...> - 2010-10-15 13:01:44
|
Author: phd Date: 2010-10-15 07:01:36 -0600 (Fri, 15 Oct 2010) New Revision: 4267 Added: SQLObject/tags/0.14.1/ Log: Tagging 0.14.1 Copied: SQLObject/tags/0.14.1 (from rev 4266, SQLObject/branches/0.14) |
|
From: <sub...@co...> - 2010-10-15 12:43:17
|
Author: phd Date: 2010-10-15 06:43:11 -0600 (Fri, 15 Oct 2010) New Revision: 4266 Modified: SQLObject/tags/0.13.1/README.txt SQLObject/tags/0.13.1/setup.cfg SQLObject/tags/0.13.1/setup.py SQLObject/tags/0.13.1/sqlobject/__init__.py SQLObject/tags/0.13.1/sqlobject/main.py Log: Version 0.13.1. Modified: SQLObject/tags/0.13.1/README.txt =================================================================== --- SQLObject/tags/0.13.1/README.txt 2010-10-15 12:41:19 UTC (rev 4265) +++ SQLObject/tags/0.13.1/README.txt 2010-10-15 12:43:11 UTC (rev 4266) @@ -1,5 +1,5 @@ -SQLObject 0.13 -============== +SQLObject 0.13.1 +================ Thanks for looking at SQLObject. SQLObject is an object-relational mapper, i.e., a library that will wrap your database tables in Python Modified: SQLObject/tags/0.13.1/setup.cfg =================================================================== --- SQLObject/tags/0.13.1/setup.cfg 2010-10-15 12:41:19 UTC (rev 4265) +++ SQLObject/tags/0.13.1/setup.cfg 2010-10-15 12:43:11 UTC (rev 4266) @@ -5,10 +5,6 @@ [easy_install] #find_links = http://svn.pythonpaste.org/package_index.html -[egg_info] -tag_build = dev -tag_svn_revision = true - [pudge] theme = pythonpaste.org docs = docs/index.txt docs/Authors.txt docs/DeveloperGuide.txt docs/FAQ.txt Modified: SQLObject/tags/0.13.1/setup.py =================================================================== --- SQLObject/tags/0.13.1/setup.py 2010-10-15 12:41:19 UTC (rev 4265) +++ SQLObject/tags/0.13.1/setup.py 2010-10-15 12:43:11 UTC (rev 4266) @@ -21,7 +21,7 @@ """ setup(name="SQLObject", - version="0.13", + version="0.13.1", description="Object-Relational Manager, aka database wrapper", long_description="""\ SQLObject is a popular *Object Relational Manager* for providing an @@ -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.13", + download_url="http://cheeseshop.python.org/pypi/SQLObject/0.13.1", license="LGPL", packages=["sqlobject"] + ['sqlobject.%s' % package for package in subpackages], scripts=["scripts/sqlobject-admin"], Modified: SQLObject/tags/0.13.1/sqlobject/__init__.py =================================================================== --- SQLObject/tags/0.13.1/sqlobject/__init__.py 2010-10-15 12:41:19 UTC (rev 4265) +++ SQLObject/tags/0.13.1/sqlobject/__init__.py 2010-10-15 12:43:11 UTC (rev 4266) @@ -1,5 +1,5 @@ """ -SQLObject 0.13 +SQLObject 0.13.1 """ from col import * Modified: SQLObject/tags/0.13.1/sqlobject/main.py =================================================================== --- SQLObject/tags/0.13.1/sqlobject/main.py 2010-10-15 12:41:19 UTC (rev 4265) +++ SQLObject/tags/0.13.1/sqlobject/main.py 2010-10-15 12:43:11 UTC (rev 4266) @@ -1,6 +1,6 @@ """ -SQLObject 0.13 --------------- +SQLObject 0.13.1 +---------------- :author: Ian Bicking <ia...@co...> |
|
From: <sub...@co...> - 2010-10-15 12:41:26
|
Author: phd Date: 2010-10-15 06:41:19 -0600 (Fri, 15 Oct 2010) New Revision: 4265 Added: SQLObject/tags/0.13.1/ Log: Tagging 0.13.1 Copied: SQLObject/tags/0.13.1 (from rev 4264, SQLObject/branches/0.13) |
|
From: <sub...@co...> - 2010-10-15 12:40:23
|
Author: phd Date: 2010-10-15 06:40:16 -0600 (Fri, 15 Oct 2010) New Revision: 4264 Modified: SQLObject/trunk/docs/News.txt Log: SQLObject 0.13.1 and SQLObject 0.14.1 were released 15 Oct 2010. Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2010-10-15 12:38:47 UTC (rev 4263) +++ SQLObject/trunk/docs/News.txt 2010-10-15 12:40:16 UTC (rev 4264) @@ -13,6 +13,13 @@ Features & Interface -------------------- +SQLObject 0.14.1 +================ + +Released 15 Oct 2010. + +* A bugfix was ported from `SQLObject 0.13.1`_. + SQLObject 0.14.0 ================ @@ -37,6 +44,8 @@ SQLObject 0.13.1 ================ +Released 15 Oct 2010. + * A bug was fixed in a subtle case when a per-instance connection is not passed to validators. |
|
From: <sub...@co...> - 2010-10-15 12:38:53
|
Author: phd Date: 2010-10-15 06:38:47 -0600 (Fri, 15 Oct 2010) New Revision: 4263 Modified: SQLObject/branches/0.14/docs/News.txt Log: SQLObject 0.13.1 and SQLObject 0.14.1 were released 15 Oct 2010. Modified: SQLObject/branches/0.14/docs/News.txt =================================================================== --- SQLObject/branches/0.14/docs/News.txt 2010-10-15 12:36:44 UTC (rev 4262) +++ SQLObject/branches/0.14/docs/News.txt 2010-10-15 12:38:47 UTC (rev 4263) @@ -7,6 +7,13 @@ .. _start: +SQLObject 0.14.1 +================ + +Released 15 Oct 2010. + +* A bugfix was ported from `SQLObject 0.13.1`_. + SQLObject 0.14.0 ================ @@ -31,6 +38,8 @@ SQLObject 0.13.1 ================ +Released 15 Oct 2010. + * A bug was fixed in a subtle case when a per-instance connection is not passed to validators. |
|
From: <sub...@co...> - 2010-10-15 12:36:50
|
Author: phd Date: 2010-10-15 06:36:44 -0600 (Fri, 15 Oct 2010) New Revision: 4262 Modified: SQLObject/branches/0.13/docs/News.txt Log: SQLObject 0.13.1 was released 15 Oct 2010. Modified: SQLObject/branches/0.13/docs/News.txt =================================================================== --- SQLObject/branches/0.13/docs/News.txt 2010-10-15 12:32:04 UTC (rev 4261) +++ SQLObject/branches/0.13/docs/News.txt 2010-10-15 12:36:44 UTC (rev 4262) @@ -10,6 +10,8 @@ SQLObject 0.13.1 ================ +Released 15 Oct 2010. + * A bug was fixed in a subtle case when a per-instance connection is not passed to validators. |
|
From: <sub...@co...> - 2010-10-15 12:32:12
|
Author: phd
Date: 2010-10-15 06:32:04 -0600 (Fri, 15 Oct 2010)
New Revision: 4261
Added:
SQLObject/trunk/sqlobject/tests/test_perConnection.py
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/sqlobject/col.py
SQLObject/trunk/sqlobject/dbconnection.py
SQLObject/trunk/sqlobject/main.py
SQLObject/trunk/sqlobject/sqlbuilder.py
Log:
Merged revision 4260 from branch 0.14: a bug was fixed in a subtle case
when a per-instance connection is not passed to validators.
Modified: SQLObject/trunk/docs/News.txt
===================================================================
--- SQLObject/trunk/docs/News.txt 2010-10-15 12:20:07 UTC (rev 4260)
+++ SQLObject/trunk/docs/News.txt 2010-10-15 12:32:04 UTC (rev 4261)
@@ -34,6 +34,12 @@
* Major API change: attribute 'dirty' was moved to sqlmeta.
+SQLObject 0.13.1
+================
+
+* A bug was fixed in a subtle case when a per-instance connection is not
+ passed to validators.
+
SQLObject 0.13.0
================
Modified: SQLObject/trunk/sqlobject/col.py
===================================================================
--- SQLObject/trunk/sqlobject/col.py 2010-10-15 12:20:07 UTC (rev 4260)
+++ SQLObject/trunk/sqlobject/col.py 2010-10-15 12:32:04 UTC (rev 4261)
@@ -503,13 +503,19 @@
def to_python(self, value, state):
if value is None:
return None
- connection = state.soObject._connection
- dbEncoding = getattr(connection, "dbEncoding", None) or "ascii"
+ try:
+ connection = state.connection or state.soObject._connection
+ except AttributeError:
+ dbEncoding = "ascii"
+ binaryType = type(None) # Just a simple workaround
+ else:
+ dbEncoding = getattr(connection, "dbEncoding", None) or "ascii"
+ binaryType = connection._binaryType
if isinstance(value, unicode):
return value.encode(dbEncoding)
if self.dataType and isinstance(value, self.dataType):
return value
- if isinstance(value, (str, buffer, connection._binaryType, sqlbuilder.SQLExpression)):
+ if isinstance(value, (str, buffer, binaryType, sqlbuilder.SQLExpression)):
return value
if hasattr(value, '__unicode__'):
return unicode(value).encode(dbEncoding)
@@ -1305,10 +1311,14 @@
return value
if isinstance(value, float):
value = str(value)
- connection = state.soObject._connection
- if hasattr(connection, "decimalSeparator"):
- value = value.replace(connection.decimalSeparator, ".")
try:
+ connection = state.connection or state.soObject._connection
+ except AttributeError:
+ pass
+ else:
+ if hasattr(connection, "decimalSeparator"):
+ value = value.replace(connection.decimalSeparator, ".")
+ try:
return Decimal(value)
except:
raise validators.Invalid("expected a Decimal in the DecimalCol '%s', got %s %r instead" % \
@@ -1320,10 +1330,14 @@
if isinstance(value, float):
value = str(value)
if isinstance(value, basestring):
- connection = state.soObject._connection
- if hasattr(connection, "decimalSeparator"):
- value = value.replace(connection.decimalSeparator, ".")
try:
+ connection = state.connection or state.soObject._connection
+ except AttributeError:
+ pass
+ else:
+ if hasattr(connection, "decimalSeparator"):
+ value = value.replace(connection.decimalSeparator, ".")
+ try:
return Decimal(value)
except:
raise validators.Invalid("can not parse Decimal value '%s' in the DecimalCol from '%s'" %
@@ -1427,12 +1441,19 @@
def to_python(self, value, state):
if value is None:
return None
+ try:
+ connection = state.connection or state.soObject._connection
+ except AttributeError:
+ dbName = None
+ binaryType = type(None) # Just a simple workaround
+ else:
+ dbName = connection.dbName
+ binaryType = connection._binaryType
if isinstance(value, str):
- connection = state.soObject._connection
- if connection.dbName == "sqlite":
+ if dbName == "sqlite":
value = connection.module.decode(value)
return value
- if isinstance(value, (buffer, state.soObject._connection._binaryType)):
+ if isinstance(value, (buffer, binaryType)):
cachedValue = self._cachedValue
if cachedValue and cachedValue[1] == value:
return cachedValue[0]
@@ -1445,7 +1466,8 @@
def from_python(self, value, state):
if value is None:
return None
- binary = state.soObject._connection.createBinary(value)
+ connection = state.connection or state.soObject._connection
+ binary = connection.createBinary(value)
self._cachedValue = (value, binary)
return binary
@@ -1497,8 +1519,12 @@
if value is None:
return None
if isinstance(value, unicode):
- connection = state.soObject._connection
- dbEncoding = getattr(connection, "dbEncoding", None) or "ascii"
+ try:
+ connection = state.connection or state.soObject._connection
+ except AttributeError:
+ dbEncoding = "ascii"
+ else:
+ dbEncoding = getattr(connection, "dbEncoding", None) or "ascii"
value = value.encode(dbEncoding)
if isinstance(value, str):
return pickle.loads(value)
Modified: SQLObject/trunk/sqlobject/dbconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/dbconnection.py 2010-10-15 12:20:07 UTC (rev 4260)
+++ SQLObject/trunk/sqlobject/dbconnection.py 2010-10-15 12:32:04 UTC (rev 4261)
@@ -582,7 +582,7 @@
if key in kw:
value = kw.pop(key)
if col.from_python:
- value = col.from_python(value, sqlbuilder.SQLObjectState(soClass))
+ value = col.from_python(value, sqlbuilder.SQLObjectState(soClass, connection=self))
data[col.dbName] = value
elif col.foreignName in kw:
obj = kw.pop(col.foreignName)
Modified: SQLObject/trunk/sqlobject/main.py
===================================================================
--- SQLObject/trunk/sqlobject/main.py 2010-10-15 12:20:07 UTC (rev 4260)
+++ SQLObject/trunk/sqlobject/main.py 2010-10-15 12:32:04 UTC (rev 4261)
@@ -1321,7 +1321,7 @@
for n, v in zip(name, value):
from_python = getattr(cls, '_SO_from_python_' + n)
if from_python:
- v = from_python(v, sqlbuilder.SQLObjectState(cls))
+ v = from_python(v, sqlbuilder.SQLObjectState(cls, connection=connection))
new_value.append(v)
condition = sqlbuilder.AND(*[getattr(cls.q, n)==v for n,v in zip(name, new_value)])
return (connection or cls._connection)._SO_selectOneAlt(
Modified: SQLObject/trunk/sqlobject/sqlbuilder.py
===================================================================
--- SQLObject/trunk/sqlobject/sqlbuilder.py 2010-10-15 12:20:07 UTC (rev 4260)
+++ SQLObject/trunk/sqlobject/sqlbuilder.py 2010-10-15 12:32:04 UTC (rev 4261)
@@ -80,8 +80,9 @@
class SQLObjectState(object):
- def __init__(self, soObject):
+ def __init__(self, soObject, connection=None):
self.soObject = weakref.proxy(soObject)
+ self.connection = connection
safeSQLRE = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_\.]*$')
Copied: SQLObject/trunk/sqlobject/tests/test_perConnection.py (from rev 4260, SQLObject/branches/0.14/sqlobject/tests/test_perConnection.py)
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_perConnection.py (rev 0)
+++ SQLObject/trunk/sqlobject/tests/test_perConnection.py 2010-10-15 12:32:04 UTC (rev 4261)
@@ -0,0 +1,15 @@
+from sqlobject import *
+from sqlobject.tests.dbtest import *
+
+########################################
+## Per-instance connection
+########################################
+
+class TestPerConnection(SQLObject):
+ test = StringCol()
+
+def test_perConnection():
+ connection = getConnection()
+ TestPerConnection.createTable(connection=connection)
+ TestPerConnection(test='test', connection=connection)
+ assert len(list(TestPerConnection.select(TestPerConnection.q.test=='test', connection=connection))) == 1
|
|
From: <sub...@co...> - 2010-10-15 12:20:15
|
Author: phd
Date: 2010-10-15 06:20:07 -0600 (Fri, 15 Oct 2010)
New Revision: 4260
Added:
SQLObject/branches/0.14/sqlobject/tests/test_perConnection.py
Modified:
SQLObject/branches/0.14/docs/News.txt
SQLObject/branches/0.14/sqlobject/col.py
SQLObject/branches/0.14/sqlobject/dbconnection.py
SQLObject/branches/0.14/sqlobject/main.py
SQLObject/branches/0.14/sqlobject/sqlbuilder.py
Log:
Merged revision 4259 from branch 0.13: a bug was fixed in a subtle case
when a per-instance connection is not passed to validators.
Modified: SQLObject/branches/0.14/docs/News.txt
===================================================================
--- SQLObject/branches/0.14/docs/News.txt 2010-10-15 12:06:54 UTC (rev 4259)
+++ SQLObject/branches/0.14/docs/News.txt 2010-10-15 12:20:07 UTC (rev 4260)
@@ -28,6 +28,12 @@
* Major API change: attribute 'dirty' was moved to sqlmeta.
+SQLObject 0.13.1
+================
+
+* A bug was fixed in a subtle case when a per-instance connection is not
+ passed to validators.
+
SQLObject 0.13.0
================
Modified: SQLObject/branches/0.14/sqlobject/col.py
===================================================================
--- SQLObject/branches/0.14/sqlobject/col.py 2010-10-15 12:06:54 UTC (rev 4259)
+++ SQLObject/branches/0.14/sqlobject/col.py 2010-10-15 12:20:07 UTC (rev 4260)
@@ -503,13 +503,19 @@
def to_python(self, value, state):
if value is None:
return None
- connection = state.soObject._connection
- dbEncoding = getattr(connection, "dbEncoding", None) or "ascii"
+ try:
+ connection = state.connection or state.soObject._connection
+ except AttributeError:
+ dbEncoding = "ascii"
+ binaryType = type(None) # Just a simple workaround
+ else:
+ dbEncoding = getattr(connection, "dbEncoding", None) or "ascii"
+ binaryType = connection._binaryType
if isinstance(value, unicode):
return value.encode(dbEncoding)
if self.dataType and isinstance(value, self.dataType):
return value
- if isinstance(value, (str, buffer, connection._binaryType, sqlbuilder.SQLExpression)):
+ if isinstance(value, (str, buffer, binaryType, sqlbuilder.SQLExpression)):
return value
if hasattr(value, '__unicode__'):
return unicode(value).encode(dbEncoding)
@@ -1305,10 +1311,14 @@
return value
if isinstance(value, float):
value = str(value)
- connection = state.soObject._connection
- if hasattr(connection, "decimalSeparator"):
- value = value.replace(connection.decimalSeparator, ".")
try:
+ connection = state.connection or state.soObject._connection
+ except AttributeError:
+ pass
+ else:
+ if hasattr(connection, "decimalSeparator"):
+ value = value.replace(connection.decimalSeparator, ".")
+ try:
return Decimal(value)
except:
raise validators.Invalid("expected a Decimal in the DecimalCol '%s', got %s %r instead" % \
@@ -1320,10 +1330,14 @@
if isinstance(value, float):
value = str(value)
if isinstance(value, basestring):
- connection = state.soObject._connection
- if hasattr(connection, "decimalSeparator"):
- value = value.replace(connection.decimalSeparator, ".")
try:
+ connection = state.connection or state.soObject._connection
+ except AttributeError:
+ pass
+ else:
+ if hasattr(connection, "decimalSeparator"):
+ value = value.replace(connection.decimalSeparator, ".")
+ try:
return Decimal(value)
except:
raise validators.Invalid("can not parse Decimal value '%s' in the DecimalCol from '%s'" %
@@ -1427,12 +1441,19 @@
def to_python(self, value, state):
if value is None:
return None
+ try:
+ connection = state.connection or state.soObject._connection
+ except AttributeError:
+ dbName = None
+ binaryType = type(None) # Just a simple workaround
+ else:
+ dbName = connection.dbName
+ binaryType = connection._binaryType
if isinstance(value, str):
- connection = state.soObject._connection
- if connection.dbName == "sqlite":
+ if dbName == "sqlite":
value = connection.module.decode(value)
return value
- if isinstance(value, (buffer, state.soObject._connection._binaryType)):
+ if isinstance(value, (buffer, binaryType)):
cachedValue = self._cachedValue
if cachedValue and cachedValue[1] == value:
return cachedValue[0]
@@ -1445,7 +1466,8 @@
def from_python(self, value, state):
if value is None:
return None
- binary = state.soObject._connection.createBinary(value)
+ connection = state.connection or state.soObject._connection
+ binary = connection.createBinary(value)
self._cachedValue = (value, binary)
return binary
@@ -1497,8 +1519,12 @@
if value is None:
return None
if isinstance(value, unicode):
- connection = state.soObject._connection
- dbEncoding = getattr(connection, "dbEncoding", None) or "ascii"
+ try:
+ connection = state.connection or state.soObject._connection
+ except AttributeError:
+ dbEncoding = "ascii"
+ else:
+ dbEncoding = getattr(connection, "dbEncoding", None) or "ascii"
value = value.encode(dbEncoding)
if isinstance(value, str):
return pickle.loads(value)
Modified: SQLObject/branches/0.14/sqlobject/dbconnection.py
===================================================================
--- SQLObject/branches/0.14/sqlobject/dbconnection.py 2010-10-15 12:06:54 UTC (rev 4259)
+++ SQLObject/branches/0.14/sqlobject/dbconnection.py 2010-10-15 12:20:07 UTC (rev 4260)
@@ -582,7 +582,7 @@
if key in kw:
value = kw.pop(key)
if col.from_python:
- value = col.from_python(value, sqlbuilder.SQLObjectState(soClass))
+ value = col.from_python(value, sqlbuilder.SQLObjectState(soClass, connection=self))
data[col.dbName] = value
elif col.foreignName in kw:
obj = kw.pop(col.foreignName)
Modified: SQLObject/branches/0.14/sqlobject/main.py
===================================================================
--- SQLObject/branches/0.14/sqlobject/main.py 2010-10-15 12:06:54 UTC (rev 4259)
+++ SQLObject/branches/0.14/sqlobject/main.py 2010-10-15 12:20:07 UTC (rev 4260)
@@ -1321,7 +1321,7 @@
for n, v in zip(name, value):
from_python = getattr(cls, '_SO_from_python_' + n)
if from_python:
- v = from_python(v, sqlbuilder.SQLObjectState(cls))
+ v = from_python(v, sqlbuilder.SQLObjectState(cls, connection=connection))
new_value.append(v)
condition = sqlbuilder.AND(*[getattr(cls.q, n)==v for n,v in zip(name, new_value)])
return (connection or cls._connection)._SO_selectOneAlt(
Modified: SQLObject/branches/0.14/sqlobject/sqlbuilder.py
===================================================================
--- SQLObject/branches/0.14/sqlobject/sqlbuilder.py 2010-10-15 12:06:54 UTC (rev 4259)
+++ SQLObject/branches/0.14/sqlobject/sqlbuilder.py 2010-10-15 12:20:07 UTC (rev 4260)
@@ -80,8 +80,9 @@
class SQLObjectState(object):
- def __init__(self, soObject):
+ def __init__(self, soObject, connection=None):
self.soObject = weakref.proxy(soObject)
+ self.connection = connection
safeSQLRE = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_\.]*$')
Copied: SQLObject/branches/0.14/sqlobject/tests/test_perConnection.py (from rev 4259, SQLObject/branches/0.13/sqlobject/tests/test_perConnection.py)
===================================================================
--- SQLObject/branches/0.14/sqlobject/tests/test_perConnection.py (rev 0)
+++ SQLObject/branches/0.14/sqlobject/tests/test_perConnection.py 2010-10-15 12:20:07 UTC (rev 4260)
@@ -0,0 +1,15 @@
+from sqlobject import *
+from sqlobject.tests.dbtest import *
+
+########################################
+## Per-instance connection
+########################################
+
+class TestPerConnection(SQLObject):
+ test = StringCol()
+
+def test_perConnection():
+ connection = getConnection()
+ TestPerConnection.createTable(connection=connection)
+ TestPerConnection(test='test', connection=connection)
+ assert len(list(TestPerConnection.select(TestPerConnection.q.test=='test', connection=connection))) == 1
|
|
From: <sub...@co...> - 2010-10-15 12:07:02
|
Author: phd
Date: 2010-10-15 06:06:54 -0600 (Fri, 15 Oct 2010)
New Revision: 4259
Added:
SQLObject/branches/0.13/sqlobject/tests/test_perConnection.py
Modified:
SQLObject/branches/0.13/docs/News.txt
SQLObject/branches/0.13/sqlobject/col.py
SQLObject/branches/0.13/sqlobject/dbconnection.py
SQLObject/branches/0.13/sqlobject/main.py
SQLObject/branches/0.13/sqlobject/sqlbuilder.py
Log:
A bug was fixed in a subtle case when a per-instance connection is not passed to validators.
Modified: SQLObject/branches/0.13/docs/News.txt
===================================================================
--- SQLObject/branches/0.13/docs/News.txt 2010-10-10 11:54:02 UTC (rev 4258)
+++ SQLObject/branches/0.13/docs/News.txt 2010-10-15 12:06:54 UTC (rev 4259)
@@ -7,6 +7,12 @@
.. _start:
+SQLObject 0.13.1
+================
+
+* A bug was fixed in a subtle case when a per-instance connection is not
+ passed to validators.
+
SQLObject 0.13.0
================
Modified: SQLObject/branches/0.13/sqlobject/col.py
===================================================================
--- SQLObject/branches/0.13/sqlobject/col.py 2010-10-10 11:54:02 UTC (rev 4258)
+++ SQLObject/branches/0.13/sqlobject/col.py 2010-10-15 12:06:54 UTC (rev 4259)
@@ -498,13 +498,19 @@
def to_python(self, value, state):
if value is None:
return None
- connection = state.soObject._connection
- dbEncoding = getattr(connection, "dbEncoding", None) or "ascii"
+ try:
+ connection = state.connection or state.soObject._connection
+ except AttributeError:
+ dbEncoding = "ascii"
+ binaryType = type(None) # Just a simple workaround
+ else:
+ dbEncoding = getattr(connection, "dbEncoding", None) or "ascii"
+ binaryType = connection._binaryType
if isinstance(value, unicode):
return value.encode(dbEncoding)
if self.dataType and isinstance(value, self.dataType):
return value
- if isinstance(value, (str, buffer, connection._binaryType, sqlbuilder.SQLExpression)):
+ if isinstance(value, (str, buffer, binaryType, sqlbuilder.SQLExpression)):
return value
if hasattr(value, '__unicode__'):
return unicode(value).encode(dbEncoding)
@@ -1300,10 +1306,14 @@
return value
if isinstance(value, float):
value = str(value)
- connection = state.soObject._connection
- if hasattr(connection, "decimalSeparator"):
- value = value.replace(connection.decimalSeparator, ".")
try:
+ connection = state.connection or state.soObject._connection
+ except AttributeError:
+ pass
+ else:
+ if hasattr(connection, "decimalSeparator"):
+ value = value.replace(connection.decimalSeparator, ".")
+ try:
return Decimal(value)
except:
raise validators.Invalid("expected a Decimal in the DecimalCol '%s', got %s %r instead" % \
@@ -1315,10 +1325,14 @@
if isinstance(value, float):
value = str(value)
if isinstance(value, basestring):
- connection = state.soObject._connection
- if hasattr(connection, "decimalSeparator"):
- value = value.replace(connection.decimalSeparator, ".")
try:
+ connection = state.connection or state.soObject._connection
+ except AttributeError:
+ pass
+ else:
+ if hasattr(connection, "decimalSeparator"):
+ value = value.replace(connection.decimalSeparator, ".")
+ try:
return Decimal(value)
except:
raise validators.Invalid("can not parse Decimal value '%s' in the DecimalCol from '%s'" %
@@ -1422,12 +1436,19 @@
def to_python(self, value, state):
if value is None:
return None
+ try:
+ connection = state.connection or state.soObject._connection
+ except AttributeError:
+ dbName = None
+ binaryType = type(None) # Just a simple workaround
+ else:
+ dbName = connection.dbName
+ binaryType = connection._binaryType
if isinstance(value, str):
- connection = state.soObject._connection
- if connection.dbName == "sqlite":
+ if dbName == "sqlite":
value = connection.module.decode(value)
return value
- if isinstance(value, (buffer, state.soObject._connection._binaryType)):
+ if isinstance(value, (buffer, binaryType)):
cachedValue = self._cachedValue
if cachedValue and cachedValue[1] == value:
return cachedValue[0]
@@ -1440,7 +1461,8 @@
def from_python(self, value, state):
if value is None:
return None
- binary = state.soObject._connection.createBinary(value)
+ connection = state.connection or state.soObject._connection
+ binary = connection.createBinary(value)
self._cachedValue = (value, binary)
return binary
@@ -1492,8 +1514,12 @@
if value is None:
return None
if isinstance(value, unicode):
- connection = state.soObject._connection
- dbEncoding = getattr(connection, "dbEncoding", None) or "ascii"
+ try:
+ connection = state.connection or state.soObject._connection
+ except AttributeError:
+ dbEncoding = "ascii"
+ else:
+ dbEncoding = getattr(connection, "dbEncoding", None) or "ascii"
value = value.encode(dbEncoding)
if isinstance(value, str):
return pickle.loads(value)
Modified: SQLObject/branches/0.13/sqlobject/dbconnection.py
===================================================================
--- SQLObject/branches/0.13/sqlobject/dbconnection.py 2010-10-10 11:54:02 UTC (rev 4258)
+++ SQLObject/branches/0.13/sqlobject/dbconnection.py 2010-10-15 12:06:54 UTC (rev 4259)
@@ -582,7 +582,7 @@
if key in kw:
value = kw.pop(key)
if col.from_python:
- value = col.from_python(value, sqlbuilder.SQLObjectState(soClass))
+ value = col.from_python(value, sqlbuilder.SQLObjectState(soClass, connection=self))
data[col.dbName] = value
elif col.foreignName in kw:
obj = kw.pop(col.foreignName)
Modified: SQLObject/branches/0.13/sqlobject/main.py
===================================================================
--- SQLObject/branches/0.13/sqlobject/main.py 2010-10-10 11:54:02 UTC (rev 4258)
+++ SQLObject/branches/0.13/sqlobject/main.py 2010-10-15 12:06:54 UTC (rev 4259)
@@ -1318,7 +1318,7 @@
for n, v in zip(name, value):
from_python = getattr(cls, '_SO_from_python_' + n)
if from_python:
- v = from_python(v, sqlbuilder.SQLObjectState(cls))
+ v = from_python(v, sqlbuilder.SQLObjectState(cls, connection=connection))
new_value.append(v)
condition = sqlbuilder.AND(*[getattr(cls.q, n)==v for n,v in zip(name, new_value)])
return (connection or cls._connection)._SO_selectOneAlt(
Modified: SQLObject/branches/0.13/sqlobject/sqlbuilder.py
===================================================================
--- SQLObject/branches/0.13/sqlobject/sqlbuilder.py 2010-10-10 11:54:02 UTC (rev 4258)
+++ SQLObject/branches/0.13/sqlobject/sqlbuilder.py 2010-10-15 12:06:54 UTC (rev 4259)
@@ -80,8 +80,9 @@
class SQLObjectState(object):
- def __init__(self, soObject):
+ def __init__(self, soObject, connection=None):
self.soObject = weakref.proxy(soObject)
+ self.connection = connection
safeSQLRE = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_\.]*$')
Added: SQLObject/branches/0.13/sqlobject/tests/test_perConnection.py
===================================================================
--- SQLObject/branches/0.13/sqlobject/tests/test_perConnection.py (rev 0)
+++ SQLObject/branches/0.13/sqlobject/tests/test_perConnection.py 2010-10-15 12:06:54 UTC (rev 4259)
@@ -0,0 +1,15 @@
+from sqlobject import *
+from sqlobject.tests.dbtest import *
+
+########################################
+## Per-instance connection
+########################################
+
+class TestPerConnection(SQLObject):
+ test = StringCol()
+
+def test_perConnection():
+ connection = getConnection()
+ TestPerConnection.createTable(connection=connection)
+ TestPerConnection(test='test', connection=connection)
+ assert len(list(TestPerConnection.select(TestPerConnection.q.test=='test', connection=connection))) == 1
|
|
From: <sub...@co...> - 2010-10-10 11:54:09
|
Author: phd Date: 2010-10-10 05:54:02 -0600 (Sun, 10 Oct 2010) New Revision: 4258 Modified: SQLObject/tags/0.14.0/README.txt SQLObject/tags/0.14.0/setup.cfg SQLObject/tags/0.14.0/setup.py SQLObject/tags/0.14.0/sqlobject/__init__.py SQLObject/tags/0.14.0/sqlobject/main.py Log: Version 0.14.0. Modified: SQLObject/tags/0.14.0/README.txt =================================================================== --- SQLObject/tags/0.14.0/README.txt 2010-10-10 11:51:54 UTC (rev 4257) +++ SQLObject/tags/0.14.0/README.txt 2010-10-10 11:54:02 UTC (rev 4258) @@ -1,5 +1,5 @@ -SQLObject 0.14 -============== +SQLObject 0.14.0 +================ Thanks for looking at SQLObject. SQLObject is an object-relational mapper, i.e., a library that will wrap your database tables in Python Modified: SQLObject/tags/0.14.0/setup.cfg =================================================================== --- SQLObject/tags/0.14.0/setup.cfg 2010-10-10 11:51:54 UTC (rev 4257) +++ SQLObject/tags/0.14.0/setup.cfg 2010-10-10 11:54:02 UTC (rev 4258) @@ -5,10 +5,6 @@ [easy_install] #find_links = http://svn.pythonpaste.org/package_index.html -[egg_info] -tag_build = dev -tag_svn_revision = true - [pudge] theme = pythonpaste.org docs = docs/index.txt docs/Authors.txt docs/DeveloperGuide.txt docs/FAQ.txt Modified: SQLObject/tags/0.14.0/setup.py =================================================================== --- SQLObject/tags/0.14.0/setup.py 2010-10-10 11:51:54 UTC (rev 4257) +++ SQLObject/tags/0.14.0/setup.py 2010-10-10 11:54:02 UTC (rev 4258) @@ -21,7 +21,7 @@ """ setup(name="SQLObject", - version="0.14", + version="0.14.0", description="Object-Relational Manager, aka database wrapper", long_description="""\ SQLObject is a popular *Object Relational Manager* for providing an Modified: SQLObject/tags/0.14.0/sqlobject/__init__.py =================================================================== --- SQLObject/tags/0.14.0/sqlobject/__init__.py 2010-10-10 11:51:54 UTC (rev 4257) +++ SQLObject/tags/0.14.0/sqlobject/__init__.py 2010-10-10 11:54:02 UTC (rev 4258) @@ -1,5 +1,5 @@ """ -SQLObject 0.14 +SQLObject 0.14.0 """ from col import * Modified: SQLObject/tags/0.14.0/sqlobject/main.py =================================================================== --- SQLObject/tags/0.14.0/sqlobject/main.py 2010-10-10 11:51:54 UTC (rev 4257) +++ SQLObject/tags/0.14.0/sqlobject/main.py 2010-10-10 11:54:02 UTC (rev 4258) @@ -1,6 +1,6 @@ """ -SQLObject 0.14 --------------- +SQLObject 0.14.0 +---------------- :author: Ian Bicking <ia...@co...> |
|
From: <sub...@co...> - 2010-10-10 11:52:01
|
Author: phd Date: 2010-10-10 05:51:54 -0600 (Sun, 10 Oct 2010) New Revision: 4257 Added: SQLObject/tags/0.14.0/ Log: Tagging 0.14.0 Copied: SQLObject/tags/0.14.0 (from rev 4256, SQLObject/branches/0.14) |
|
From: <sub...@co...> - 2010-10-10 11:51:11
|
Author: phd Date: 2010-10-10 05:51:05 -0600 (Sun, 10 Oct 2010) New Revision: 4256 Modified: SQLObject/trunk/docs/News.txt Log: SQLObject 0.14.0 released 10 Oct 2010. Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2010-10-10 11:49:43 UTC (rev 4255) +++ SQLObject/trunk/docs/News.txt 2010-10-10 11:51:05 UTC (rev 4256) @@ -16,6 +16,8 @@ SQLObject 0.14.0 ================ +Released 10 Oct 2010. + Features & Interface -------------------- |
|
From: <sub...@co...> - 2010-10-10 11:49:50
|
Author: phd Date: 2010-10-10 05:49:43 -0600 (Sun, 10 Oct 2010) New Revision: 4255 Modified: SQLObject/branches/0.14/docs/News.txt Log: SQLObject 0.14.0 released 10 Oct 2010. Modified: SQLObject/branches/0.14/docs/News.txt =================================================================== --- SQLObject/branches/0.14/docs/News.txt 2010-10-09 19:33:23 UTC (rev 4254) +++ SQLObject/branches/0.14/docs/News.txt 2010-10-10 11:49:43 UTC (rev 4255) @@ -8,8 +8,10 @@ .. _start: SQLObject 0.14.0 -================= +================ +Released 10 Oct 2010. + Features & Interface -------------------- |
|
From: <sub...@co...> - 2010-10-09 19:33:29
|
Author: phd Date: 2010-10-09 13:33:23 -0600 (Sat, 09 Oct 2010) New Revision: 4254 Modified: SQLObject/trunk/docs/News.txt Log: Merged revision 4253 from branch 0.14: slightly changed wording. Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2010-10-09 19:32:07 UTC (rev 4253) +++ SQLObject/trunk/docs/News.txt 2010-10-09 19:33:23 UTC (rev 4254) @@ -20,7 +20,7 @@ -------------------- * The lists of columns/indices/joins are now sorted according to the order - of creation. + of declaration. * ``validator2`` was added to all columns; it is inserted at the beginning of the list of validators, i.e. its ``from_python()`` method is called |
|
From: <sub...@co...> - 2010-10-09 19:32:14
|
Author: phd Date: 2010-10-09 13:32:07 -0600 (Sat, 09 Oct 2010) New Revision: 4253 Modified: SQLObject/branches/0.14/docs/News.txt Log: Slightly changed wording. Modified: SQLObject/branches/0.14/docs/News.txt =================================================================== --- SQLObject/branches/0.14/docs/News.txt 2010-10-09 19:31:16 UTC (rev 4252) +++ SQLObject/branches/0.14/docs/News.txt 2010-10-09 19:32:07 UTC (rev 4253) @@ -14,7 +14,7 @@ -------------------- * The lists of columns/indices/joins are now sorted according to the order - of creation. + of declaration. * ``validator2`` was added to all columns; it is inserted at the beginning of the list of validators, i.e. its ``from_python()`` method is called |
|
From: <sub...@co...> - 2010-10-09 19:31:25
|
Author: phd Date: 2010-10-09 13:31:16 -0600 (Sat, 09 Oct 2010) New Revision: 4252 Added: SQLObject/branches/0.14/sqlobject/tests/test_columns_order.py Log: Backported a test from the trunk. Added: SQLObject/branches/0.14/sqlobject/tests/test_columns_order.py =================================================================== --- SQLObject/branches/0.14/sqlobject/tests/test_columns_order.py (rev 0) +++ SQLObject/branches/0.14/sqlobject/tests/test_columns_order.py 2010-10-09 19:31:16 UTC (rev 4252) @@ -0,0 +1,15 @@ +from sqlobject import * + +######################################## +## Columns order +######################################## + +class SOColumnsOrder(SQLObject): + name = StringCol() + surname = StringCol() + parname = StringCol() + age = IntCol() + +def test_columns_order(): + column_names = [c.name for c in SOColumnsOrder.sqlmeta.columnList] + assert column_names == ['name', 'surname', 'parname', 'age'] |
|
From: <sub...@co...> - 2010-10-09 02:12:15
|
Author: phd Date: 2010-10-08 20:12:08 -0600 (Fri, 08 Oct 2010) New Revision: 4251 Added: SQLObject/trunk/sqlobject/tests/test_columns_order.py Log: Test the order of columns - they are listed now in the order of declaration. Added: SQLObject/trunk/sqlobject/tests/test_columns_order.py =================================================================== --- SQLObject/trunk/sqlobject/tests/test_columns_order.py (rev 0) +++ SQLObject/trunk/sqlobject/tests/test_columns_order.py 2010-10-09 02:12:08 UTC (rev 4251) @@ -0,0 +1,15 @@ +from sqlobject import * + +######################################## +## Columns order +######################################## + +class SOColumnsOrder(SQLObject): + name = StringCol() + surname = StringCol() + parname = StringCol() + age = IntCol() + +def test_columns_order(): + column_names = [c.name for c in SOColumnsOrder.sqlmeta.columnList] + assert column_names == ['name', 'surname', 'parname', 'age'] |
|
From: <sub...@co...> - 2010-10-09 02:06:53
|
Author: phd
Date: 2010-10-08 20:06:47 -0600 (Fri, 08 Oct 2010)
New Revision: 4250
Added:
SQLObject/trunk/sqlobject/tests/test_string_id.py
Removed:
SQLObject/trunk/sqlobject/tests/test_string_id.py
SQLObject/trunk/sqlobject/tests/test_stringid.py
Log:
Merged revision 4247 from branch 0.12: removed test_string_id.py;
renamed test_stringid.py to test_string_id.py; added tests.
Deleted: SQLObject/trunk/sqlobject/tests/test_string_id.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_string_id.py 2010-10-09 02:05:07 UTC (rev 4249)
+++ SQLObject/trunk/sqlobject/tests/test_string_id.py 2010-10-09 02:06:47 UTC (rev 4250)
@@ -1,17 +0,0 @@
-from sqlobject import *
-from sqlobject.tests.dbtest import *
-
-class TestStringID(SQLObject):
- class sqlmeta(sqlmeta):
- idType = str
- idName = 'test_id_here'
- name = StringCol(length=100)
-
-def test_string_id():
- conn = getConnection()
- TestStringID.setConnection(conn)
- TestStringID.dropTable(ifExists=True)
- assert not conn.tableExists(TestStringID.sqlmeta.table)
- TestStringID.createTable()
- TestStringID(id="TestStringID", name="TestStringID name")
- assert len(list(TestStringID.selectBy(id='TestStringID'))) == 1
Copied: SQLObject/trunk/sqlobject/tests/test_string_id.py (from rev 4249, SQLObject/branches/0.12/sqlobject/tests/test_string_id.py)
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_string_id.py (rev 0)
+++ SQLObject/trunk/sqlobject/tests/test_string_id.py 2010-10-09 02:06:47 UTC (rev 4250)
@@ -0,0 +1,76 @@
+from sqlobject import *
+from sqlobject.tests.dbtest import *
+
+########################################
+## String ID test
+########################################
+
+class SOStringID(SQLObject):
+
+ class sqlmeta(sqlmeta):
+ table = 'so_string_id'
+ idType = str
+ val = StringCol(alternateID=True)
+
+ mysqlCreate = """
+ CREATE TABLE IF NOT EXISTS so_string_id (
+ id VARCHAR(50) PRIMARY KEY,
+ val TEXT
+ )
+ """
+
+ postgresCreate = """
+ CREATE TABLE so_string_id (
+ id VARCHAR(50) PRIMARY KEY,
+ val TEXT
+ )
+ """
+
+ sybaseCreate = """
+ CREATE TABLE so_string_id (
+ id VARCHAR(50) UNIQUE,
+ val VARCHAR(50) NULL
+ )
+ """
+
+ firebirdCreate = """
+ CREATE TABLE so_string_id (
+ id VARCHAR(50) NOT NULL PRIMARY KEY,
+ val BLOB SUB_TYPE TEXT
+ )
+ """
+
+ mssqlCreate = """
+ CREATE TABLE so_string_id (
+ id VARCHAR(50) PRIMARY KEY,
+ val varchar(4000)
+ )
+ """
+
+ sqliteCreate = postgresCreate
+
+ mysqlDrop = """
+ DROP TABLE IF EXISTS so_string_id
+ """
+
+ postgresDrop = """
+ DROP TABLE so_string_id
+ """
+
+ sqliteDrop = postgresDrop
+ firebirdDrop = postgresDrop
+ mssqlDrop = postgresDrop
+
+def test_stringID():
+ setupClass(SOStringID)
+ t1 = SOStringID(id='hey', val='whatever')
+ t2 = SOStringID.byVal('whatever')
+ assert t1 == t2
+ assert t1.val == t2.val
+ assert t1.val == 'whatever'
+
+ t1 = SOStringID(id='you', val='nowhere')
+ t2 = SOStringID.get('you')
+ assert t1 == t2
+ assert t1.val == t2.val
+ assert t1.val == 'nowhere'
Deleted: SQLObject/trunk/sqlobject/tests/test_stringid.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_stringid.py 2010-10-09 02:05:07 UTC (rev 4249)
+++ SQLObject/trunk/sqlobject/tests/test_stringid.py 2010-10-09 02:06:47 UTC (rev 4250)
@@ -1,71 +0,0 @@
-from sqlobject import *
-from sqlobject.tests.dbtest import *
-
-########################################
-## String ID test
-########################################
-
-class SOStringID(SQLObject):
-
- class sqlmeta(sqlmeta):
- table = 'so_string_id'
- idType = str
- val = StringCol(alternateID=True)
-
- mysqlCreate = """
- CREATE TABLE IF NOT EXISTS so_string_id (
- id VARCHAR(50) PRIMARY KEY,
- val TEXT
- )
- """
-
- postgresCreate = """
- CREATE TABLE so_string_id (
- id VARCHAR(50) PRIMARY KEY,
- val TEXT
- )
- """
-
- sybaseCreate = """
- CREATE TABLE so_string_id (
- id VARCHAR(50) UNIQUE,
- val VARCHAR(50) NULL
- )
- """
-
- firebirdCreate = """
- CREATE TABLE so_string_id (
- id VARCHAR(50) NOT NULL PRIMARY KEY,
- val BLOB SUB_TYPE TEXT
- )
- """
-
- mssqlCreate = """
- CREATE TABLE so_string_id (
- id VARCHAR(50) PRIMARY KEY,
- val varchar(4000)
- )
- """
-
- sqliteCreate = postgresCreate
-
- mysqlDrop = """
- DROP TABLE IF EXISTS so_string_id
- """
-
- postgresDrop = """
- DROP TABLE so_string_id
- """
-
- sqliteDrop = postgresDrop
- firebirdDrop = postgresDrop
- mssqlDrop = postgresDrop
-
-def test_stringID():
- setupClass(SOStringID)
- t = SOStringID(id='hey', val='whatever')
- t2 = SOStringID.byVal('whatever')
- assert t == t2
- t3 = SOStringID(id='you', val='nowhere')
- t4 = SOStringID.get('you')
- assert t3 == t4
|
|
From: <sub...@co...> - 2010-10-09 02:05:13
|
Author: phd
Date: 2010-10-08 20:05:07 -0600 (Fri, 08 Oct 2010)
New Revision: 4249
Added:
SQLObject/branches/0.14/sqlobject/tests/test_string_id.py
Removed:
SQLObject/branches/0.14/sqlobject/tests/test_string_id.py
SQLObject/branches/0.14/sqlobject/tests/test_stringid.py
Log:
Merged revision 4247 from branch 0.12: removed test_string_id.py;
renamed test_stringid.py to test_string_id.py; added tests.
Deleted: SQLObject/branches/0.14/sqlobject/tests/test_string_id.py
===================================================================
--- SQLObject/branches/0.14/sqlobject/tests/test_string_id.py 2010-10-09 02:03:38 UTC (rev 4248)
+++ SQLObject/branches/0.14/sqlobject/tests/test_string_id.py 2010-10-09 02:05:07 UTC (rev 4249)
@@ -1,17 +0,0 @@
-from sqlobject import *
-from sqlobject.tests.dbtest import *
-
-class TestStringID(SQLObject):
- class sqlmeta(sqlmeta):
- idType = str
- idName = 'test_id_here'
- name = StringCol(length=100)
-
-def test_string_id():
- conn = getConnection()
- TestStringID.setConnection(conn)
- TestStringID.dropTable(ifExists=True)
- assert not conn.tableExists(TestStringID.sqlmeta.table)
- TestStringID.createTable()
- TestStringID(id="TestStringID", name="TestStringID name")
- assert len(list(TestStringID.selectBy(id='TestStringID'))) == 1
Copied: SQLObject/branches/0.14/sqlobject/tests/test_string_id.py (from rev 4247, SQLObject/branches/0.12/sqlobject/tests/test_string_id.py)
===================================================================
--- SQLObject/branches/0.14/sqlobject/tests/test_string_id.py (rev 0)
+++ SQLObject/branches/0.14/sqlobject/tests/test_string_id.py 2010-10-09 02:05:07 UTC (rev 4249)
@@ -0,0 +1,76 @@
+from sqlobject import *
+from sqlobject.tests.dbtest import *
+
+########################################
+## String ID test
+########################################
+
+class SOStringID(SQLObject):
+
+ class sqlmeta(sqlmeta):
+ table = 'so_string_id'
+ idType = str
+ val = StringCol(alternateID=True)
+
+ mysqlCreate = """
+ CREATE TABLE IF NOT EXISTS so_string_id (
+ id VARCHAR(50) PRIMARY KEY,
+ val TEXT
+ )
+ """
+
+ postgresCreate = """
+ CREATE TABLE so_string_id (
+ id VARCHAR(50) PRIMARY KEY,
+ val TEXT
+ )
+ """
+
+ sybaseCreate = """
+ CREATE TABLE so_string_id (
+ id VARCHAR(50) UNIQUE,
+ val VARCHAR(50) NULL
+ )
+ """
+
+ firebirdCreate = """
+ CREATE TABLE so_string_id (
+ id VARCHAR(50) NOT NULL PRIMARY KEY,
+ val BLOB SUB_TYPE TEXT
+ )
+ """
+
+ mssqlCreate = """
+ CREATE TABLE so_string_id (
+ id VARCHAR(50) PRIMARY KEY,
+ val varchar(4000)
+ )
+ """
+
+ sqliteCreate = postgresCreate
+
+ mysqlDrop = """
+ DROP TABLE IF EXISTS so_string_id
+ """
+
+ postgresDrop = """
+ DROP TABLE so_string_id
+ """
+
+ sqliteDrop = postgresDrop
+ firebirdDrop = postgresDrop
+ mssqlDrop = postgresDrop
+
+def test_stringID():
+ setupClass(SOStringID)
+ t1 = SOStringID(id='hey', val='whatever')
+ t2 = SOStringID.byVal('whatever')
+ assert t1 == t2
+ assert t1.val == t2.val
+ assert t1.val == 'whatever'
+
+ t1 = SOStringID(id='you', val='nowhere')
+ t2 = SOStringID.get('you')
+ assert t1 == t2
+ assert t1.val == t2.val
+ assert t1.val == 'nowhere'
Deleted: SQLObject/branches/0.14/sqlobject/tests/test_stringid.py
===================================================================
--- SQLObject/branches/0.14/sqlobject/tests/test_stringid.py 2010-10-09 02:03:38 UTC (rev 4248)
+++ SQLObject/branches/0.14/sqlobject/tests/test_stringid.py 2010-10-09 02:05:07 UTC (rev 4249)
@@ -1,71 +0,0 @@
-from sqlobject import *
-from sqlobject.tests.dbtest import *
-
-########################################
-## String ID test
-########################################
-
-class SOStringID(SQLObject):
-
- class sqlmeta(sqlmeta):
- table = 'so_string_id'
- idType = str
- val = StringCol(alternateID=True)
-
- mysqlCreate = """
- CREATE TABLE IF NOT EXISTS so_string_id (
- id VARCHAR(50) PRIMARY KEY,
- val TEXT
- )
- """
-
- postgresCreate = """
- CREATE TABLE so_string_id (
- id VARCHAR(50) PRIMARY KEY,
- val TEXT
- )
- """
-
- sybaseCreate = """
- CREATE TABLE so_string_id (
- id VARCHAR(50) UNIQUE,
- val VARCHAR(50) NULL
- )
- """
-
- firebirdCreate = """
- CREATE TABLE so_string_id (
- id VARCHAR(50) NOT NULL PRIMARY KEY,
- val BLOB SUB_TYPE TEXT
- )
- """
-
- mssqlCreate = """
- CREATE TABLE so_string_id (
- id VARCHAR(50) PRIMARY KEY,
- val varchar(4000)
- )
- """
-
- sqliteCreate = postgresCreate
-
- mysqlDrop = """
- DROP TABLE IF EXISTS so_string_id
- """
-
- postgresDrop = """
- DROP TABLE so_string_id
- """
-
- sqliteDrop = postgresDrop
- firebirdDrop = postgresDrop
- mssqlDrop = postgresDrop
-
-def test_stringID():
- setupClass(SOStringID)
- t = SOStringID(id='hey', val='whatever')
- t2 = SOStringID.byVal('whatever')
- assert t == t2
- t3 = SOStringID(id='you', val='nowhere')
- t4 = SOStringID.get('you')
- assert t3 == t4
|
|
From: <sub...@co...> - 2010-10-09 02:03:46
|
Author: phd
Date: 2010-10-08 20:03:38 -0600 (Fri, 08 Oct 2010)
New Revision: 4248
Added:
SQLObject/branches/0.13/sqlobject/tests/test_string_id.py
Removed:
SQLObject/branches/0.13/sqlobject/tests/test_string_id.py
SQLObject/branches/0.13/sqlobject/tests/test_stringid.py
Log:
Merged revision 4247 from branch 0.12:
Removed test_string_id.py. Renamed test_stringid.py to test_string_id.py. Added tests.
Deleted: SQLObject/branches/0.13/sqlobject/tests/test_string_id.py
===================================================================
--- SQLObject/branches/0.13/sqlobject/tests/test_string_id.py 2010-10-09 02:00:48 UTC (rev 4247)
+++ SQLObject/branches/0.13/sqlobject/tests/test_string_id.py 2010-10-09 02:03:38 UTC (rev 4248)
@@ -1,17 +0,0 @@
-from sqlobject import *
-from sqlobject.tests.dbtest import *
-
-class TestStringID(SQLObject):
- class sqlmeta(sqlmeta):
- idType = str
- idName = 'test_id_here'
- name = StringCol(length=100)
-
-def test_string_id():
- conn = getConnection()
- TestStringID.setConnection(conn)
- TestStringID.dropTable(ifExists=True)
- assert not conn.tableExists(TestStringID.sqlmeta.table)
- TestStringID.createTable()
- TestStringID(id="TestStringID", name="TestStringID name")
- assert len(list(TestStringID.selectBy(id='TestStringID'))) == 1
Copied: SQLObject/branches/0.13/sqlobject/tests/test_string_id.py (from rev 4247, SQLObject/branches/0.12/sqlobject/tests/test_string_id.py)
===================================================================
--- SQLObject/branches/0.13/sqlobject/tests/test_string_id.py (rev 0)
+++ SQLObject/branches/0.13/sqlobject/tests/test_string_id.py 2010-10-09 02:03:38 UTC (rev 4248)
@@ -0,0 +1,76 @@
+from sqlobject import *
+from sqlobject.tests.dbtest import *
+
+########################################
+## String ID test
+########################################
+
+class SOStringID(SQLObject):
+
+ class sqlmeta(sqlmeta):
+ table = 'so_string_id'
+ idType = str
+ val = StringCol(alternateID=True)
+
+ mysqlCreate = """
+ CREATE TABLE IF NOT EXISTS so_string_id (
+ id VARCHAR(50) PRIMARY KEY,
+ val TEXT
+ )
+ """
+
+ postgresCreate = """
+ CREATE TABLE so_string_id (
+ id VARCHAR(50) PRIMARY KEY,
+ val TEXT
+ )
+ """
+
+ sybaseCreate = """
+ CREATE TABLE so_string_id (
+ id VARCHAR(50) UNIQUE,
+ val VARCHAR(50) NULL
+ )
+ """
+
+ firebirdCreate = """
+ CREATE TABLE so_string_id (
+ id VARCHAR(50) NOT NULL PRIMARY KEY,
+ val BLOB SUB_TYPE TEXT
+ )
+ """
+
+ mssqlCreate = """
+ CREATE TABLE so_string_id (
+ id VARCHAR(50) PRIMARY KEY,
+ val varchar(4000)
+ )
+ """
+
+ sqliteCreate = postgresCreate
+
+ mysqlDrop = """
+ DROP TABLE IF EXISTS so_string_id
+ """
+
+ postgresDrop = """
+ DROP TABLE so_string_id
+ """
+
+ sqliteDrop = postgresDrop
+ firebirdDrop = postgresDrop
+ mssqlDrop = postgresDrop
+
+def test_stringID():
+ setupClass(SOStringID)
+ t1 = SOStringID(id='hey', val='whatever')
+ t2 = SOStringID.byVal('whatever')
+ assert t1 == t2
+ assert t1.val == t2.val
+ assert t1.val == 'whatever'
+
+ t1 = SOStringID(id='you', val='nowhere')
+ t2 = SOStringID.get('you')
+ assert t1 == t2
+ assert t1.val == t2.val
+ assert t1.val == 'nowhere'
Deleted: SQLObject/branches/0.13/sqlobject/tests/test_stringid.py
===================================================================
--- SQLObject/branches/0.13/sqlobject/tests/test_stringid.py 2010-10-09 02:00:48 UTC (rev 4247)
+++ SQLObject/branches/0.13/sqlobject/tests/test_stringid.py 2010-10-09 02:03:38 UTC (rev 4248)
@@ -1,71 +0,0 @@
-from sqlobject import *
-from sqlobject.tests.dbtest import *
-
-########################################
-## String ID test
-########################################
-
-class SOStringID(SQLObject):
-
- class sqlmeta(sqlmeta):
- table = 'so_string_id'
- idType = str
- val = StringCol(alternateID=True)
-
- mysqlCreate = """
- CREATE TABLE IF NOT EXISTS so_string_id (
- id VARCHAR(50) PRIMARY KEY,
- val TEXT
- )
- """
-
- postgresCreate = """
- CREATE TABLE so_string_id (
- id VARCHAR(50) PRIMARY KEY,
- val TEXT
- )
- """
-
- sybaseCreate = """
- CREATE TABLE so_string_id (
- id VARCHAR(50) UNIQUE,
- val VARCHAR(50) NULL
- )
- """
-
- firebirdCreate = """
- CREATE TABLE so_string_id (
- id VARCHAR(50) NOT NULL PRIMARY KEY,
- val BLOB SUB_TYPE TEXT
- )
- """
-
- mssqlCreate = """
- CREATE TABLE so_string_id (
- id VARCHAR(50) PRIMARY KEY,
- val varchar(4000)
- )
- """
-
- sqliteCreate = postgresCreate
-
- mysqlDrop = """
- DROP TABLE IF EXISTS so_string_id
- """
-
- postgresDrop = """
- DROP TABLE so_string_id
- """
-
- sqliteDrop = postgresDrop
- firebirdDrop = postgresDrop
- mssqlDrop = postgresDrop
-
-def test_stringID():
- setupClass(SOStringID)
- t = SOStringID(id='hey', val='whatever')
- t2 = SOStringID.byVal('whatever')
- assert t == t2
- t3 = SOStringID(id='you', val='nowhere')
- t4 = SOStringID.get('you')
- assert t3 == t4
|