sqlobject-cvs Mailing List for SQLObject (Page 64)
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
|
Dec
|
From: <sub...@co...> - 2008-11-02 21:57:06
|
Author: dan Date: 2008-11-02 14:57:02 -0700 (Sun, 02 Nov 2008) New Revision: 3641 Modified: SQLObject/branches/0.9/sqlobject/col.py SQLObject/branches/0.9/sqlobject/dbconnection.py Log: Simplified getattr expressions to be terse (backport from trunk rev 3639) Modified: SQLObject/branches/0.9/sqlobject/col.py =================================================================== --- SQLObject/branches/0.9/sqlobject/col.py 2008-11-02 21:56:31 UTC (rev 3640) +++ SQLObject/branches/0.9/sqlobject/col.py 2008-11-02 21:57:02 UTC (rev 3641) @@ -525,7 +525,7 @@ return None if isinstance(value, unicode): connection = state.soObject._connection - dbEncoding = getattr(connection, "dbEncoding", None) or "ascii" + dbEncoding = getattr(connection, "dbEncoding", "ascii") return value.encode(dbEncoding) return value @@ -1451,7 +1451,7 @@ return None if isinstance(value, unicode): connection = state.soObject._connection - dbEncoding = getattr(connection, "dbEncoding", None) or "ascii" + dbEncoding = getattr(connection, "dbEncoding", "ascii") value = value.encode(dbEncoding) if isinstance(value, str): return pickle.loads(value) Modified: SQLObject/branches/0.9/sqlobject/dbconnection.py =================================================================== --- SQLObject/branches/0.9/sqlobject/dbconnection.py 2008-11-02 21:56:31 UTC (rev 3640) +++ SQLObject/branches/0.9/sqlobject/dbconnection.py 2008-11-02 21:57:02 UTC (rev 3641) @@ -88,7 +88,7 @@ atexit.register(_closeConnection, weakref.ref(self)) def uri(self): - auth = getattr(self, 'user', None) or '' + auth = getattr(self, 'user', '') if auth: if self.password: auth = auth + ':' + self.password |
From: <sub...@co...> - 2008-11-02 21:56:35
|
Author: dan Date: 2008-11-02 14:56:31 -0700 (Sun, 02 Nov 2008) New Revision: 3640 Modified: SQLObject/branches/0.10/sqlobject/col.py SQLObject/branches/0.10/sqlobject/dbconnection.py Log: Simplified getattr expressions to be terse (backport from trunk rev 3639) Modified: SQLObject/branches/0.10/sqlobject/col.py =================================================================== --- SQLObject/branches/0.10/sqlobject/col.py 2008-11-02 21:53:49 UTC (rev 3639) +++ SQLObject/branches/0.10/sqlobject/col.py 2008-11-02 21:56:31 UTC (rev 3640) @@ -513,7 +513,7 @@ return None if isinstance(value, unicode): connection = state.soObject._connection - dbEncoding = getattr(connection, "dbEncoding", None) or "ascii" + dbEncoding = getattr(connection, "dbEncoding", "ascii") return value.encode(dbEncoding) return value @@ -1433,7 +1433,7 @@ return None if isinstance(value, unicode): connection = state.soObject._connection - dbEncoding = getattr(connection, "dbEncoding", None) or "ascii" + dbEncoding = getattr(connection, "dbEncoding", "ascii") value = value.encode(dbEncoding) if isinstance(value, str): return pickle.loads(value) Modified: SQLObject/branches/0.10/sqlobject/dbconnection.py =================================================================== --- SQLObject/branches/0.10/sqlobject/dbconnection.py 2008-11-02 21:53:49 UTC (rev 3639) +++ SQLObject/branches/0.10/sqlobject/dbconnection.py 2008-11-02 21:56:31 UTC (rev 3640) @@ -83,7 +83,7 @@ atexit.register(_closeConnection, weakref.ref(self)) def uri(self): - auth = getattr(self, 'user', None) or '' + auth = getattr(self, 'user', '') if auth: if self.password: auth = auth + ':' + self.password |
From: <sub...@co...> - 2008-11-02 21:53:55
|
Author: dan Date: 2008-11-02 14:53:49 -0700 (Sun, 02 Nov 2008) New Revision: 3639 Modified: SQLObject/trunk/sqlobject/col.py SQLObject/trunk/sqlobject/dbconnection.py Log: Simplified getattr expressions to be terse Modified: SQLObject/trunk/sqlobject/col.py =================================================================== --- SQLObject/trunk/sqlobject/col.py 2008-10-29 16:32:02 UTC (rev 3638) +++ SQLObject/trunk/sqlobject/col.py 2008-11-02 21:53:49 UTC (rev 3639) @@ -513,7 +513,7 @@ return None if isinstance(value, unicode): connection = state.soObject._connection - dbEncoding = getattr(connection, "dbEncoding", None) or "ascii" + dbEncoding = getattr(connection, "dbEncoding", "ascii") return value.encode(dbEncoding) return value @@ -1478,7 +1478,7 @@ return None if isinstance(value, unicode): connection = state.soObject._connection - dbEncoding = getattr(connection, "dbEncoding", None) or "ascii" + dbEncoding = getattr(connection, "dbEncoding", "ascii") value = value.encode(dbEncoding) if isinstance(value, str): return pickle.loads(value) Modified: SQLObject/trunk/sqlobject/dbconnection.py =================================================================== --- SQLObject/trunk/sqlobject/dbconnection.py 2008-10-29 16:32:02 UTC (rev 3638) +++ SQLObject/trunk/sqlobject/dbconnection.py 2008-11-02 21:53:49 UTC (rev 3639) @@ -83,7 +83,7 @@ atexit.register(_closeConnection, weakref.ref(self)) def uri(self): - auth = getattr(self, 'user', None) or '' + auth = getattr(self, 'user', '') if auth: if self.password: auth = auth + ':' + self.password |
From: SourceForge.net <no...@so...> - 2008-10-28 12:20:32
|
Bugs item #1398353, was opened at 2006-01-06 08:48 Message generated for change (Comment added) made by nobody You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1398353&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: SQLite Group: SQLObject release (specify) Status: Closed Resolution: Wont Fix Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: full path cannot work? SQLObject 0.7.0 Initial Comment: I tried the following in windows XP using SQLObject 0.7.0, the path for DB is: C:\\Documents and Settings\\guest\\My Documents\\test.db sDBPath = os.path.abspath('test.db') sqlhub.processConnection = connectionForURI('sqlite:%s' % sDBPath) it insists on having "/". -------- exception ----------------- File "c:\program files\python24\lib\site-packages\SQLObject-0.7.0-py2.4.egg\sqlobject\dbconnection.py", line 80, in _parseURI assert rest.startswith('/'), "URIs must start with scheme:/ -- you did not include a / (in %r)" % rest AssertionError: URIs must start with scheme:/ -- you did not include a / (in 'C:\\Documents and Settings\\tambrinc\\My Documents\\test.db') ------------------------------------ sqlhub.processConnection = connectionForURI('sqlite:/%s' % sDBPath) -------- exception ----------------- File "C:\Program Files\Python24\Lib\site-packages\sqlite\main.py", line 445, in __init__ self.db = _sqlite.connect(database, mode) _sqlite.DatabaseError: unable to open database file ------------------------------------ ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2008-10-28 12:20 Message: simple fix for win32: in dbconnection.py / class DBConnection / def _parseURI(uri): replace path = '/' + rest by path = rest ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2008-10-28 12:19 Message: simple fix for win32: in dbconnection.py / class DBConnection / def _parseURI(uri): replace path = '/' + rest by path = rest ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-01-11 17:04 Message: Logged In: YES user_id=4799 Yes, this is an URI. It must has forward, not backward slashes. To convert fullpath to URI I use the following code: cwd = os.getcwd() cwd_uri = cwd.replace(os.sep, '/') if os.name == 'nt': cwd_uri = '/' + cwd_uri.replace(':', '|') ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1398353&group_id=74338 |
From: SourceForge.net <no...@so...> - 2008-10-28 12:20:04
|
Bugs item #1398353, was opened at 2006-01-06 08:48 Message generated for change (Comment added) made by nobody You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1398353&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: SQLite Group: SQLObject release (specify) Status: Closed Resolution: Wont Fix Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: full path cannot work? SQLObject 0.7.0 Initial Comment: I tried the following in windows XP using SQLObject 0.7.0, the path for DB is: C:\\Documents and Settings\\guest\\My Documents\\test.db sDBPath = os.path.abspath('test.db') sqlhub.processConnection = connectionForURI('sqlite:%s' % sDBPath) it insists on having "/". -------- exception ----------------- File "c:\program files\python24\lib\site-packages\SQLObject-0.7.0-py2.4.egg\sqlobject\dbconnection.py", line 80, in _parseURI assert rest.startswith('/'), "URIs must start with scheme:/ -- you did not include a / (in %r)" % rest AssertionError: URIs must start with scheme:/ -- you did not include a / (in 'C:\\Documents and Settings\\tambrinc\\My Documents\\test.db') ------------------------------------ sqlhub.processConnection = connectionForURI('sqlite:/%s' % sDBPath) -------- exception ----------------- File "C:\Program Files\Python24\Lib\site-packages\sqlite\main.py", line 445, in __init__ self.db = _sqlite.connect(database, mode) _sqlite.DatabaseError: unable to open database file ------------------------------------ ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2008-10-28 12:19 Message: simple fix for win32: in dbconnection.py / class DBConnection / def _parseURI(uri): replace path = '/' + rest by path = rest ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-01-11 17:04 Message: Logged In: YES user_id=4799 Yes, this is an URI. It must has forward, not backward slashes. To convert fullpath to URI I use the following code: cwd = os.getcwd() cwd_uri = cwd.replace(os.sep, '/') if os.name == 'nt': cwd_uri = '/' + cwd_uri.replace(':', '|') ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1398353&group_id=74338 |
From: <sub...@co...> - 2008-10-02 21:06:18
|
Author: novalis Date: 2008-10-02 15:03:36 -0600 (Thu, 02 Oct 2008) New Revision: 3614 Modified: SQLObject/branches/0.10/sqlobject/inheritance/__init__.py SQLObject/branches/0.10/sqlobject/main.py SQLObject/branches/0.10/sqlobject/versioning/test/test_version.py Log: FIXED: previously, row update events were sent differently for o.set(a=...) vs o.a=... in inherited tables. Now events are consistent. (backport to 0.10) Modified: SQLObject/branches/0.10/sqlobject/inheritance/__init__.py =================================================================== --- SQLObject/branches/0.10/sqlobject/inheritance/__init__.py 2008-10-02 20:05:22 UTC (rev 3613) +++ SQLObject/branches/0.10/sqlobject/inheritance/__init__.py 2008-10-02 21:03:36 UTC (rev 3614) @@ -3,6 +3,7 @@ from sqlobject.col import StringCol, ForeignKey from sqlobject.main import sqlmeta, SQLObject, SelectResults, \ makeProperties, unmakeProperties, getterName, setterName +from sqlobject import events import iteration try: @@ -110,9 +111,16 @@ setattr(soClass, getterName(cname), eval( 'lambda self: self._parent.%s' % cname)) if not col.immutable: - setattr(soClass, setterName(cname), eval( - 'lambda self, val: setattr(self._parent, %s, val)' - % repr(cname))) + def make_setfunc(cname): + def setfunc(self, val): + if not self.sqlmeta._creating and not getattr(self.sqlmeta, "row_update_sig_suppress", False): + self.sqlmeta.send(events.RowUpdateSignal, self, {cname : val}) + + result = setattr(self._parent, cname, val) + return setfunc + + setfunc = make_setfunc(cname) + setattr(soClass, setterName(cname), setfunc) if childUpdate: makeProperties(soClass) return @@ -224,6 +232,12 @@ _inheritable = True SelectResultsClass = InheritableSelectResults + def set(self, **kw): + if self._parent: + SQLObject.set(self, _suppress_set_sig=True, **kw) + else: + SQLObject.set(self, **kw) + def __classinit__(cls, new_attrs): SQLObject.__classinit__(cls, new_attrs) # if we are a child class, add sqlbuilder fields from parents Modified: SQLObject/branches/0.10/sqlobject/main.py =================================================================== --- SQLObject/branches/0.10/sqlobject/main.py 2008-10-02 20:05:22 UTC (rev 3613) +++ SQLObject/branches/0.10/sqlobject/main.py 2008-10-02 21:03:36 UTC (rev 3614) @@ -1042,8 +1042,8 @@ if self.sqlmeta.cacheValues: setattr(self, instanceName(name), value) - def set(self, **kw): - if not self.sqlmeta._creating and not getattr(self.sqlmeta, "row_update_sig_suppress", False): + 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: self.sqlmeta.send(events.RowUpdateSignal, self, kw) # set() is used to update multiple values at once, # potentially with one SQL statement if possible. Modified: SQLObject/branches/0.10/sqlobject/versioning/test/test_version.py =================================================================== --- SQLObject/branches/0.10/sqlobject/versioning/test/test_version.py 2008-10-02 20:05:22 UTC (rev 3613) +++ SQLObject/branches/0.10/sqlobject/versioning/test/test_version.py 2008-10-02 21:03:36 UTC (rev 3614) @@ -4,7 +4,6 @@ # For Python 2.3: from sqlobject.events import sorted -from py.test import raises from sqlobject import * from sqlobject.inheritance import InheritableSQLObject from sqlobject.versioning import Versioning @@ -96,6 +95,7 @@ assert not hasattr(government, 'versions') monarchy = Monarchy(name='UK', monarch='king george iv') + assert len(list(monarchy.versions)) == 0 monarchy.set(name='queen elisabeth ii') assert len(list(monarchy.versions)) == 1 assert monarchy.versions[0].name == "UK" @@ -107,6 +107,8 @@ vchild.set(name='toon', weapon='dynamite') assert len(list(base.versions)) == num_base_versions assert len(list(vchild.versions)) == 1 + vchild.name = "newname" #test setting using setattr directly rather than .set + assert len(list(vchild.versions)) == 2 def test_restore(): setup() |
From: <sub...@co...> - 2008-10-02 21:05:37
|
Author: novalis Date: 2008-10-02 15:04:20 -0600 (Thu, 02 Oct 2008) New Revision: 3615 Modified: SQLObject/branches/0.9/sqlobject/inheritance/__init__.py SQLObject/branches/0.9/sqlobject/main.py SQLObject/branches/0.9/sqlobject/versioning/test/test_version.py Log: FIXED: previously, row update events were sent differently for o.set(a=...) vs o.a=... in inherited tables. Now events are consistent. (backport to 0.9) Modified: SQLObject/branches/0.9/sqlobject/inheritance/__init__.py =================================================================== --- SQLObject/branches/0.9/sqlobject/inheritance/__init__.py 2008-10-02 21:03:36 UTC (rev 3614) +++ SQLObject/branches/0.9/sqlobject/inheritance/__init__.py 2008-10-02 21:04:20 UTC (rev 3615) @@ -3,6 +3,7 @@ from sqlobject.col import StringCol, ForeignKey from sqlobject.main import sqlmeta, SQLObject, SelectResults, True, False, \ makeProperties, unmakeProperties, getterName, setterName +from sqlobject import events import iteration @@ -109,9 +110,16 @@ setattr(soClass, getterName(cname), eval( 'lambda self: self._parent.%s' % cname)) if not col.immutable: - setattr(soClass, setterName(cname), eval( - 'lambda self, val: setattr(self._parent, %s, val)' - % repr(cname))) + def make_setfunc(cname): + def setfunc(self, val): + if not self.sqlmeta._creating and not getattr(self.sqlmeta, "row_update_sig_suppress", False): + self.sqlmeta.send(events.RowUpdateSignal, self, {cname : val}) + + result = setattr(self._parent, cname, val) + return setfunc + + setfunc = make_setfunc(cname) + setattr(soClass, setterName(cname), setfunc) if childUpdate: makeProperties(soClass) return @@ -224,6 +232,12 @@ _inheritable = True SelectResultsClass = InheritableSelectResults + def set(self, **kw): + if self._parent: + SQLObject.set(self, _suppress_set_sig=True, **kw) + else: + SQLObject.set(self, **kw) + def __classinit__(cls, new_attrs): SQLObject.__classinit__(cls, new_attrs) # if we are a child class, add sqlbuilder fields from parents Modified: SQLObject/branches/0.9/sqlobject/main.py =================================================================== --- SQLObject/branches/0.9/sqlobject/main.py 2008-10-02 21:03:36 UTC (rev 3614) +++ SQLObject/branches/0.9/sqlobject/main.py 2008-10-02 21:04:20 UTC (rev 3615) @@ -1071,8 +1071,8 @@ if self.sqlmeta.cacheValues: setattr(self, instanceName(name), value) - def set(self, **kw): - if not self.sqlmeta._creating and not getattr(self.sqlmeta, "row_update_sig_suppress", False): + 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: self.sqlmeta.send(events.RowUpdateSignal, self, kw) # set() is used to update multiple values at once, # potentially with one SQL statement if possible. Modified: SQLObject/branches/0.9/sqlobject/versioning/test/test_version.py =================================================================== --- SQLObject/branches/0.9/sqlobject/versioning/test/test_version.py 2008-10-02 21:03:36 UTC (rev 3614) +++ SQLObject/branches/0.9/sqlobject/versioning/test/test_version.py 2008-10-02 21:04:20 UTC (rev 3615) @@ -4,7 +4,6 @@ # For Python 2.2 and 2.3: from sqlobject.events import sorted -from py.test import raises from sqlobject import * from sqlobject.inheritance import InheritableSQLObject from sqlobject.versioning import Versioning @@ -96,6 +95,7 @@ assert not hasattr(government, 'versions') monarchy = Monarchy(name='UK', monarch='king george iv') + assert len(list(monarchy.versions)) == 0 monarchy.set(name='queen elisabeth ii') assert len(list(monarchy.versions)) == 1 assert monarchy.versions[0].name == "UK" @@ -107,6 +107,8 @@ vchild.set(name='toon', weapon='dynamite') assert len(list(base.versions)) == num_base_versions assert len(list(vchild.versions)) == 1 + vchild.name = "newname" #test setting using setattr directly rather than .set + assert len(list(vchild.versions)) == 2 def test_restore(): setup() |
From: <sub...@co...> - 2008-10-02 18:41:48
|
Author: novalis Date: 2008-10-02 12:41:27 -0600 (Thu, 02 Oct 2008) New Revision: 3611 Modified: SQLObject/trunk/sqlobject/inheritance/__init__.py SQLObject/trunk/sqlobject/main.py SQLObject/trunk/sqlobject/versioning/test/test_version.py Log: FIXED: previously, row update events were sent differently for o.set(a=...) vs o.a=... in inherited tables. Now events are consistent Modified: SQLObject/trunk/sqlobject/inheritance/__init__.py =================================================================== --- SQLObject/trunk/sqlobject/inheritance/__init__.py 2008-10-02 17:23:46 UTC (rev 3610) +++ SQLObject/trunk/sqlobject/inheritance/__init__.py 2008-10-02 18:41:27 UTC (rev 3611) @@ -3,6 +3,7 @@ from sqlobject.col import StringCol, ForeignKey from sqlobject.main import sqlmeta, SQLObject, SelectResults, \ makeProperties, unmakeProperties, getterName, setterName +from sqlobject import events import iteration def tablesUsedSet(obj, db): @@ -104,9 +105,16 @@ setattr(soClass, getterName(cname), eval( 'lambda self: self._parent.%s' % cname)) if not col.immutable: - setattr(soClass, setterName(cname), eval( - 'lambda self, val: setattr(self._parent, %s, val)' - % repr(cname))) + def make_setfunc(cname): + def setfunc(self, val): + if not self.sqlmeta._creating and not getattr(self.sqlmeta, "row_update_sig_suppress", False): + self.sqlmeta.send(events.RowUpdateSignal, self, {cname : val}) + + result = setattr(self._parent, cname, val) + return setfunc + + setfunc = make_setfunc(cname) + setattr(soClass, setterName(cname), setfunc) if childUpdate: makeProperties(soClass) return @@ -218,6 +226,12 @@ _inheritable = True SelectResultsClass = InheritableSelectResults + def set(self, **kw): + if self._parent: + SQLObject.set(self, _suppress_set_sig=True, **kw) + else: + SQLObject.set(self, **kw) + def __classinit__(cls, new_attrs): SQLObject.__classinit__(cls, new_attrs) # if we are a child class, add sqlbuilder fields from parents Modified: SQLObject/trunk/sqlobject/main.py =================================================================== --- SQLObject/trunk/sqlobject/main.py 2008-10-02 17:23:46 UTC (rev 3610) +++ SQLObject/trunk/sqlobject/main.py 2008-10-02 18:41:27 UTC (rev 3611) @@ -1043,8 +1043,8 @@ if self.sqlmeta.cacheValues: setattr(self, instanceName(name), value) - def set(self, **kw): - if not self.sqlmeta._creating and not getattr(self.sqlmeta, "row_update_sig_suppress", False): + 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: self.sqlmeta.send(events.RowUpdateSignal, self, kw) # set() is used to update multiple values at once, # potentially with one SQL statement if possible. Modified: SQLObject/trunk/sqlobject/versioning/test/test_version.py =================================================================== --- SQLObject/trunk/sqlobject/versioning/test/test_version.py 2008-10-02 17:23:46 UTC (rev 3610) +++ SQLObject/trunk/sqlobject/versioning/test/test_version.py 2008-10-02 18:41:27 UTC (rev 3611) @@ -1,4 +1,3 @@ -from py.test import raises from sqlobject import * from sqlobject.inheritance import InheritableSQLObject from sqlobject.versioning import Versioning @@ -90,6 +89,7 @@ assert not hasattr(government, 'versions') monarchy = Monarchy(name='UK', monarch='king george iv') + assert len(list(monarchy.versions)) == 0 monarchy.set(name='queen elisabeth ii') assert len(list(monarchy.versions)) == 1 assert monarchy.versions[0].name == "UK" @@ -101,6 +101,8 @@ vchild.set(name='toon', weapon='dynamite') assert len(list(base.versions)) == num_base_versions assert len(list(vchild.versions)) == 1 + vchild.name = "newname" #test setting using setattr directly rather than .set + assert len(list(vchild.versions)) == 2 def test_restore(): setup() |
From: <sub...@co...> - 2008-09-13 13:36:35
|
Author: phd Date: 2008-09-13 07:36:31 -0600 (Sat, 13 Sep 2008) New Revision: 3579 Modified: SQLObject/trunk/docs/News.txt Log: Documented two bugfixes by Dan Pascu. Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2008-09-11 19:04:53 UTC (rev 3578) +++ SQLObject/trunk/docs/News.txt 2008-09-13 13:36:31 UTC (rev 3579) @@ -137,6 +137,13 @@ SQLObject 0.9.8 =============== +* Changed interpretation of strings in the DB URI for boolean parameters: + '0', 'no', 'off' and 'false' are now interpreted as False. + +* Fixed a bug with incorrect handling of calls like + connectionForURI(dburi, cache=False) when dburi already contains some + parameters in the URI. + * Convert decimal.to_eng_string() to str to work around a bug in Python 2.5.2; see http://mail.python.org/pipermail/python-dev/2008-March/078189.html |
From: <sub...@co...> - 2008-09-11 19:04:55
|
Author: phd Date: 2008-09-11 13:04:53 -0600 (Thu, 11 Sep 2008) New Revision: 3578 Modified: SQLObject/branches/0.10/docs/News.txt Log: Documented two bugfixes by Dan Pascu. Modified: SQLObject/branches/0.10/docs/News.txt =================================================================== --- SQLObject/branches/0.10/docs/News.txt 2008-09-11 19:04:36 UTC (rev 3577) +++ SQLObject/branches/0.10/docs/News.txt 2008-09-11 19:04:53 UTC (rev 3578) @@ -101,6 +101,13 @@ SQLObject 0.9.8 =============== +* Changed interpretation of strings in the DB URI for boolean parameters: + '0', 'no', 'off' and 'false' are now interpreted as False. + +* Fixed a bug with incorrect handling of calls like + connectionForURI(dburi, cache=False) when dburi already contains some + parameters in the URI. + * Convert decimal.to_eng_string() to str to work around a bug in Python 2.5.2; see http://mail.python.org/pipermail/python-dev/2008-March/078189.html |
From: <sub...@co...> - 2008-09-11 19:04:39
|
Author: phd Date: 2008-09-11 13:04:36 -0600 (Thu, 11 Sep 2008) New Revision: 3577 Modified: SQLObject/branches/0.9/docs/News.txt Log: Documented two bugfixes by Dan Pascu. Modified: SQLObject/branches/0.9/docs/News.txt =================================================================== --- SQLObject/branches/0.9/docs/News.txt 2008-09-10 16:13:50 UTC (rev 3576) +++ SQLObject/branches/0.9/docs/News.txt 2008-09-11 19:04:36 UTC (rev 3577) @@ -10,6 +10,13 @@ SQLObject 0.9.8 =============== +* Changed interpretation of strings in the DB URI for boolean parameters: + '0', 'no', 'off' and 'false' are now interpreted as False. + +* Fixed a bug with incorrect handling of calls like + connectionForURI(dburi, cache=False) when dburi already contains some + parameters in the URI. + * Convert decimal.to_eng_string() to str to work around a bug in Python 2.5.2; see http://mail.python.org/pipermail/python-dev/2008-March/078189.html |
From: <sub...@co...> - 2008-09-10 11:47:49
|
Author: dan Date: 2008-09-10 05:47:48 -0600 (Wed, 10 Sep 2008) New Revision: 3575 Modified: SQLObject/branches/0.9/sqlobject/dbconnection.py Log: Fixed incorrect handling of boolean arguments passed to connectionForURI or via dburi parameters (backport from trunk rev 3573) Modified: SQLObject/branches/0.9/sqlobject/dbconnection.py =================================================================== --- SQLObject/branches/0.9/sqlobject/dbconnection.py 2008-09-10 11:46:43 UTC (rev 3574) +++ SQLObject/branches/0.9/sqlobject/dbconnection.py 2008-09-10 11:47:48 UTC (rev 3575) @@ -54,6 +54,16 @@ logger = logging.getLogger(loggerName) return LogWriter(logger, loglevel) +class Boolean(object): + """A bool class that also understands some special string keywords (yes/no, true/false, on/off, 1/0)""" + _keywords = {'1': True, 'yes': True, 'true': True, 'on': True, + '0': False, 'no': False, 'false': False, 'off': False} + def __new__(cls, value): + try: + return Boolean._keywords[value.lower()] + except (AttributeError, KeyError): + return bool(value) + class DBConnection: def __init__(self, name=None, debug=False, debugOutput=False, @@ -61,16 +71,16 @@ debugThreading=False, registry=None, logger=None, loglevel=None): self.name = name - self.debug = debug - self.debugOutput = debugOutput - self.debugThreading = debugThreading + self.debug = Boolean(debug) + self.debugOutput = Boolean(debugOutput) + self.debugThreading = Boolean(debugThreading) self.debugWriter = makeDebugWriter(logger, loglevel) - self.cache = CacheSet(cache=cache) - self.doCache = cache + self.doCache = Boolean(cache) + self.cache = CacheSet(cache=self.doCache) self.style = style self._connectionNumbers = {} self._connectionCount = 1 - self.autoCommit = autoCommit + self.autoCommit = Boolean(autoCommit) self.registry = registry or None classregistry.registry(self.registry).addCallback( self.soClassAdded) |
From: <sub...@co...> - 2008-09-10 11:46:43
|
Author: dan Date: 2008-09-10 05:46:43 -0600 (Wed, 10 Sep 2008) New Revision: 3574 Modified: SQLObject/branches/0.10/sqlobject/dbconnection.py Log: Fixed incorrect handling of boolean arguments passed to connectionForURI or via dburi parameters (backport from trunk rev 3573) Modified: SQLObject/branches/0.10/sqlobject/dbconnection.py =================================================================== --- SQLObject/branches/0.10/sqlobject/dbconnection.py 2008-09-10 11:45:04 UTC (rev 3573) +++ SQLObject/branches/0.10/sqlobject/dbconnection.py 2008-09-10 11:46:43 UTC (rev 3574) @@ -49,6 +49,16 @@ logger = logging.getLogger(loggerName) return LogWriter(logger, loglevel) +class Boolean(object): + """A bool class that also understands some special string keywords (yes/no, true/false, on/off, 1/0)""" + _keywords = {'1': True, 'yes': True, 'true': True, 'on': True, + '0': False, 'no': False, 'false': False, 'off': False} + def __new__(cls, value): + try: + return Boolean._keywords[value.lower()] + except (AttributeError, KeyError): + return bool(value) + class DBConnection: def __init__(self, name=None, debug=False, debugOutput=False, @@ -56,16 +66,16 @@ debugThreading=False, registry=None, logger=None, loglevel=None): self.name = name - self.debug = debug - self.debugOutput = debugOutput - self.debugThreading = debugThreading + self.debug = Boolean(debug) + self.debugOutput = Boolean(debugOutput) + self.debugThreading = Boolean(debugThreading) self.debugWriter = makeDebugWriter(logger, loglevel) - self.cache = CacheSet(cache=cache) - self.doCache = cache + self.doCache = Boolean(cache) + self.cache = CacheSet(cache=self.doCache) self.style = style self._connectionNumbers = {} self._connectionCount = 1 - self.autoCommit = autoCommit + self.autoCommit = Boolean(autoCommit) self.registry = registry or None classregistry.registry(self.registry).addCallback( self.soClassAdded) |
From: <sub...@co...> - 2008-09-10 11:45:10
|
Author: dan Date: 2008-09-10 05:45:04 -0600 (Wed, 10 Sep 2008) New Revision: 3573 Modified: SQLObject/trunk/sqlobject/dbconnection.py Log: Fixed incorrect handling of boolean arguments passed to connectionForURI or via dburi parameters Modified: SQLObject/trunk/sqlobject/dbconnection.py =================================================================== --- SQLObject/trunk/sqlobject/dbconnection.py 2008-09-08 19:05:38 UTC (rev 3572) +++ SQLObject/trunk/sqlobject/dbconnection.py 2008-09-10 11:45:04 UTC (rev 3573) @@ -49,6 +49,16 @@ logger = logging.getLogger(loggerName) return LogWriter(logger, loglevel) +class Boolean(object): + """A bool class that also understands some special string keywords (yes/no, true/false, on/off, 1/0)""" + _keywords = {'1': True, 'yes': True, 'true': True, 'on': True, + '0': False, 'no': False, 'false': False, 'off': False} + def __new__(cls, value): + try: + return Boolean._keywords[value.lower()] + except (AttributeError, KeyError): + return bool(value) + class DBConnection: def __init__(self, name=None, debug=False, debugOutput=False, @@ -56,16 +66,16 @@ debugThreading=False, registry=None, logger=None, loglevel=None): self.name = name - self.debug = debug - self.debugOutput = debugOutput - self.debugThreading = debugThreading + self.debug = Boolean(debug) + self.debugOutput = Boolean(debugOutput) + self.debugThreading = Boolean(debugThreading) self.debugWriter = makeDebugWriter(logger, loglevel) - self.cache = CacheSet(cache=cache) - self.doCache = cache + self.doCache = Boolean(cache) + self.cache = CacheSet(cache=self.doCache) self.style = style self._connectionNumbers = {} self._connectionCount = 1 - self.autoCommit = autoCommit + self.autoCommit = Boolean(autoCommit) self.registry = registry or None classregistry.registry(self.registry).addCallback( self.soClassAdded) |
From: <sub...@co...> - 2008-09-07 12:30:20
|
Author: dan Date: 2008-09-07 06:30:14 -0600 (Sun, 07 Sep 2008) New Revision: 3571 Modified: SQLObject/branches/0.9/sqlobject/dbconnection.py Log: Fixed adding extra URI parameters from the function kwargs when the URI already contains some parameters (backported from trunk rev 3569) Modified: SQLObject/branches/0.9/sqlobject/dbconnection.py =================================================================== --- SQLObject/branches/0.9/sqlobject/dbconnection.py 2008-09-07 12:26:35 UTC (rev 3570) +++ SQLObject/branches/0.9/sqlobject/dbconnection.py 2008-09-07 12:30:14 UTC (rev 3571) @@ -1067,8 +1067,9 @@ def connectionForURI(self, uri, **args): if args: if '?' not in uri: - uri += '?' - uri += urllib.urlencode(args) + uri += '?' + urllib.urlencode(args) + else: + uri += '&' + urllib.urlencode(args) if self.cachedURIs.has_key(uri): return self.cachedURIs[uri] if uri.find(':') != -1: |
From: <sub...@co...> - 2008-09-07 12:26:43
|
Author: dan Date: 2008-09-07 06:26:35 -0600 (Sun, 07 Sep 2008) New Revision: 3570 Modified: SQLObject/branches/0.10/sqlobject/dbconnection.py Log: Fixed adding extra URI parameters from the function kwargs when the URI already contains some parameters (backported from trunk rev 3569) Modified: SQLObject/branches/0.10/sqlobject/dbconnection.py =================================================================== --- SQLObject/branches/0.10/sqlobject/dbconnection.py 2008-09-07 12:24:00 UTC (rev 3569) +++ SQLObject/branches/0.10/sqlobject/dbconnection.py 2008-09-07 12:26:35 UTC (rev 3570) @@ -913,8 +913,9 @@ def connectionForURI(self, uri, **args): if args: if '?' not in uri: - uri += '?' - uri += urllib.urlencode(args) + uri += '?' + urllib.urlencode(args) + else: + uri += '&' + urllib.urlencode(args) if self.cachedURIs.has_key(uri): return self.cachedURIs[uri] if uri.find(':') != -1: |
From: <sub...@co...> - 2008-09-07 12:24:04
|
Author: dan Date: 2008-09-07 06:24:00 -0600 (Sun, 07 Sep 2008) New Revision: 3569 Modified: SQLObject/trunk/sqlobject/dbconnection.py Log: Fixed adding extra URI parameters from the function kwargs when the URI already contains some parameters Modified: SQLObject/trunk/sqlobject/dbconnection.py =================================================================== --- SQLObject/trunk/sqlobject/dbconnection.py 2008-09-05 18:11:47 UTC (rev 3568) +++ SQLObject/trunk/sqlobject/dbconnection.py 2008-09-07 12:24:00 UTC (rev 3569) @@ -912,8 +912,9 @@ def connectionForURI(self, uri, **args): if args: if '?' not in uri: - uri += '?' - uri += urllib.urlencode(args) + uri += '?' + urllib.urlencode(args) + else: + uri += '&' + urllib.urlencode(args) if self.cachedURIs.has_key(uri): return self.cachedURIs[uri] if uri.find(':') != -1: |
From: SourceForge.net <no...@so...> - 2008-08-19 09:21:31
|
intermediateTable not used Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-SourceForge-Tracker-unixname: sqlobject X-SourceForge-Tracker-trackerid: 540672 X-SourceForge-Tracker-itemid: 2059325 X-SourceForge-Tracker-itemstatus: Open X-SourceForge-Tracker-itemassignee: nobody X-SourceForge-Tracker-itemupdate-reason: Tracker Item Submitted X-SourceForge-Tracker-itemupdate-username: Item Submitter Bugs item #2059325, was opened at 2008-08-19 11:21 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=2059325&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: DBM Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Klaus Warnke (kwarnke3) Assigned to: Nobody/Anonymous (nobody) Summary: SQLRelatedJoin: defaultOrder of intermediateTable not used Initial Comment: The SELECT build for a SQLRelatedJoin does not use the sqlmeta: defaultOrder from the intermediateTable. This is not urgent, because I can provide an orderBy in to the join constructor, but it would by nice if it works automatic. Btw: The documentation seems to be outdated, because the _defaultOrder class variable was replaced with class sqlmeta: defaultOrder I think. And what is about defaultOrderBy I have seen in a test_combining_joins.py? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=2059325&group_id=74338 |
From: <sub...@co...> - 2008-07-31 21:32:21
|
Author: phd Date: 2008-07-31 15:32:17 -0600 (Thu, 31 Jul 2008) New Revision: 3539 Modified: SQLObject/trunk/sqlobject/manager/command.py Log: Merged the revision 3537 from the branch 0.9: fixed a misspelling, removed trailing spaces. Modified: SQLObject/trunk/sqlobject/manager/command.py =================================================================== --- SQLObject/trunk/sqlobject/manager/command.py 2008-07-31 21:30:53 UTC (rev 3538) +++ SQLObject/trunk/sqlobject/manager/command.py 2008-07-31 21:32:17 UTC (rev 3539) @@ -1,12 +1,14 @@ #!/usr/bin/env python + +import fnmatch import optparse -import fnmatch +import os import re -import os import sys import textwrap +import time import warnings -import time + try: from paste.deploy import appconfig except ImportError: @@ -14,9 +16,9 @@ import sqlobject from sqlobject import col +from sqlobject.classregistry import findClass +from sqlobject.declarative import DeclarativeMeta from sqlobject.util import moduleloader -from sqlobject.declarative import DeclarativeMeta -from sqlobject.classregistry import findClass # It's not very unsafe to use tempnam like we are doing: warnings.filterwarnings( @@ -874,7 +876,7 @@ help = ('Record state of table definitions. The state of each ' 'table is written out to a separate file in a directory, ' 'and that directory forms a "version". A table is also ' - 'added to your datebase (%s) that reflects the version the ' + 'added to your database (%s) that reflects the version the ' 'database is currently at. Use the upgrade command to ' 'sync databases with code.' % SQLObjectVersionTable.sqlmeta.table) |
From: <sub...@co...> - 2008-07-31 21:30:55
|
Author: phd Date: 2008-07-31 15:30:53 -0600 (Thu, 31 Jul 2008) New Revision: 3538 Modified: SQLObject/branches/0.10/sqlobject/manager/command.py Log: Merged the revision 3537 from the branch 0.9: fixed a misspelling, removed trailing spaces. Modified: SQLObject/branches/0.10/sqlobject/manager/command.py =================================================================== --- SQLObject/branches/0.10/sqlobject/manager/command.py 2008-07-31 21:29:31 UTC (rev 3537) +++ SQLObject/branches/0.10/sqlobject/manager/command.py 2008-07-31 21:30:53 UTC (rev 3538) @@ -1,12 +1,14 @@ #!/usr/bin/env python + +import fnmatch import optparse -import fnmatch +import os import re -import os import sys import textwrap +import time import warnings -import time + try: from paste.deploy import appconfig except ImportError: @@ -14,9 +16,9 @@ import sqlobject from sqlobject import col +from sqlobject.classregistry import findClass +from sqlobject.declarative import DeclarativeMeta from sqlobject.util import moduleloader -from sqlobject.declarative import DeclarativeMeta -from sqlobject.classregistry import findClass # It's not very unsafe to use tempnam like we are doing: warnings.filterwarnings( @@ -193,7 +195,7 @@ # having to modify any core SQLObject component and namespace # contamination. # yemartin - 2006-08-08 - + class SQLObjectCircularReferenceError(Exception): pass def findReverseDependencies(cls): @@ -209,7 +211,7 @@ if other not in depended: depended.append(other) return depended - + # Cache to save already calculated dependency levels. dependency_levels = {} def calculateDependencyLevel(cls, dependency_stack=[]): @@ -237,7 +239,7 @@ level = 0 dependency_levels[cls] = level return level - + # Now simply calculate and sort by dependency levels: try: sorter = [] @@ -876,7 +878,7 @@ help = ('Record state of table definitions. The state of each ' 'table is written out to a separate file in a directory, ' 'and that directory forms a "version". A table is also ' - 'added to your datebase (%s) that reflects the version the ' + 'added to your database (%s) that reflects the version the ' 'database is currently at. Use the upgrade command to ' 'sync databases with code.' % SQLObjectVersionTable.sqlmeta.table) |
From: <sub...@co...> - 2008-07-31 21:29:35
|
Author: phd Date: 2008-07-31 15:29:31 -0600 (Thu, 31 Jul 2008) New Revision: 3537 Modified: SQLObject/branches/0.9/sqlobject/manager/command.py Log: Fixed a misspelling, removed trailing spaces. Modified: SQLObject/branches/0.9/sqlobject/manager/command.py =================================================================== --- SQLObject/branches/0.9/sqlobject/manager/command.py 2008-07-30 19:16:43 UTC (rev 3536) +++ SQLObject/branches/0.9/sqlobject/manager/command.py 2008-07-31 21:29:31 UTC (rev 3537) @@ -1,12 +1,14 @@ #!/usr/bin/env python + +import fnmatch import optparse -import fnmatch +import os import re -import os import sys import textwrap +import time import warnings -import time + try: from paste.deploy import appconfig except ImportError: @@ -14,9 +16,9 @@ import sqlobject from sqlobject import col +from sqlobject.classregistry import findClass +from sqlobject.declarative import DeclarativeMeta from sqlobject.util import moduleloader -from sqlobject.declarative import DeclarativeMeta -from sqlobject.classregistry import findClass # It's not very unsafe to use tempnam like we are doing: warnings.filterwarnings( @@ -193,7 +195,7 @@ # having to modify any core SQLObject component and namespace # contamination. # yemartin - 2006-08-08 - + class SQLObjectCircularReferenceError(Exception): pass def findReverseDependencies(cls): @@ -209,7 +211,7 @@ if other not in depended: depended.append(other) return depended - + # Cache to save already calculated dependency levels. dependency_levels = {} def calculateDependencyLevel(cls, dependency_stack=[]): @@ -237,7 +239,7 @@ level = 0 dependency_levels[cls] = level return level - + # Now simply calculate and sort by dependency levels: try: sorter = [] @@ -876,7 +878,7 @@ help = ('Record state of table definitions. The state of each ' 'table is written out to a separate file in a directory, ' 'and that directory forms a "version". A table is also ' - 'added to your datebase (%s) that reflects the version the ' + 'added to your database (%s) that reflects the version the ' 'database is currently at. Use the upgrade command to ' 'sync databases with code.' % SQLObjectVersionTable.sqlmeta.table) |
From: SourceForge.net <no...@so...> - 2008-07-24 16:09:46
|
Bugs item #2009801, was opened at 2008-07-03 19:16 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=2009801&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: SQLite Group: SQLObject release (specify) >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) >Assigned to: Oleg Broytmann (phd) Summary: sqlobject-admin fails to process sqlite database with enums Initial Comment: Seen in both 10.1 and 10.2, installed via setuptools. The problem occurs when running a command such as... ====== sqlobject-admin record --output-dir=sqlobject-history ====== ... using a sqlite database that has enum types. The symptoms are that an infinite loop is reached and executes until an out of memory exception occurs: ====== Creating version 2008-07-03 Making directory sqlobject-history/2008-07-03 Python(3304,0xa0237fa0) malloc: *** mmap(size=1140854784) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug Traceback (most recent call last): File "/usr/local/bin/sqlobject-admin", line 5, in <module> pkg_resources.run_script('SQLObject==0.10.2', 'sqlobject-admin') File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 442, in run_script self.require(requires)[0].run_script(script_name, ns) File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 1160, in run_script execfile(script_filename, namespace, namespace) File "/Library/Python/2.5/site-packages/SQLObject-0.10.2-py2.5.egg/EGG-INFO/scripts/sqlobject-admin", line 35, in <module> command.the_runner.run(sys.argv) File "/Library/Python/2.5/site-packages/SQLObject-0.10.2-py2.5.egg/sqlobject/manager/command.py", line 101, in run runner.run() File "/Library/Python/2.5/site-packages/SQLObject-0.10.2-py2.5.egg/sqlobject/manager/command.py", line 307, in run self.command() File "/Library/Python/2.5/site-packages/SQLObject-0.10.2-py2.5.egg/sqlobject/manager/command.py", line 1015, in command diffs = db_differences(cls, conn) File "/Library/Python/2.5/site-packages/SQLObject-0.10.2-py2.5.egg/sqlobject/manager/command.py", line 55, in db_differences soClass) File "/Library/Python/2.5/site-packages/SQLObject-0.10.2-py2.5.egg/sqlobject/sqlite/sqliteconnection.py", line 286, in columnsFromSchema return self._columnsFromSchemaParse(tableName, soClass) File "/Library/Python/2.5/site-packages/SQLObject-0.10.2-py2.5.egg/sqlobject/sqlite/sqliteconnection.py", line 313, in _columnsFromSchemaParse colData = colData[:st] + colData[en+1:] MemoryError ====== The problem is specifically in sqliteconnection.py, on or around line 313 with the following loop: ====== while colData.find('(') > -1: st = colData.find('(') en = colData.find(')') colData = colData[:st] + colData[en+1:] ====== When this code processes colData with the following value: ====== CREATE TABLE test_table ( id INTEGER PRIMARY KEY, test_enum VARCHAR (9) CHECK (test_enum in ('available', 'reserved', 'used')), test_string VARCHAR (64) UNIQUE ) ====== After an iteration or so, colData will have the following value (still valid): ====== id INTEGER PRIMARY KEY, test_enum VARCHAR CHECK (test_enum in ('available', 'reserved', 'used')), test_string VARCHAR (64) UNIQUE ====== Now comes the problem. During this iteration, st will get the index of the first open paren on the enum line, and en will get the index of the first close paren on the enum line. This is incorrect. The correct behavior is for en to get the index of the second close paren on the enum line. This incorrect behavior results in the following new value for colData: ====== id INTEGER PRIMARY KEY, test_enum VARCHAR CHECK ), test_string VARCHAR (64) UNIQUE ====== en from this point on continuously gets the index of that close paren left behind on the enum line, while st gets the index of the open paren on the following line... blowing up the file. At a minimum, doing en = colData.find(')', st) will prevent it from blowing up, although this isn't technically correct behavior, since it will still leave behind that close paren. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2008-07-24 20:09 Message: Logged In: YES user_id=4799 Originator: NO Fixed in the revisions 3525-3528 (branches 0.9, 0.10 and the trunk). Thank you! ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=2009801&group_id=74338 |
From: <sub...@co...> - 2008-07-24 16:09:19
|
Author: phd Date: 2008-07-24 10:09:16 -0600 (Thu, 24 Jul 2008) New Revision: 3528 Modified: SQLObject/trunk/docs/News.txt SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py Log: Fixed the bug 2009801: sqlobject-admin fails to process sqlite database with enums. Modified: SQLObject/trunk/docs/News.txt =================================================================== --- SQLObject/trunk/docs/News.txt 2008-07-24 16:08:28 UTC (rev 3527) +++ SQLObject/trunk/docs/News.txt 2008-07-24 16:09:16 UTC (rev 3528) @@ -142,6 +142,8 @@ * Added test_default_style.py. +* Fixed a minor bug in SQLiteConnection that fails to parse Enum columns. + SQLObject 0.9.7 =============== Modified: SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py =================================================================== --- SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py 2008-07-24 16:08:28 UTC (rev 3527) +++ SQLObject/trunk/sqlobject/sqlite/sqliteconnection.py 2008-07-24 16:09:16 UTC (rev 3528) @@ -309,9 +309,9 @@ raise ValueError('The table %s ws not found in the database. Load failed.' % tableName) colData = colData[0].split('(', 1)[1].strip()[:-2] while colData.find('(') > -1: - st = colData.find('(') - en = colData.find(')') - colData = colData[:st] + colData[en+1:] + start = colData.find('(') + end = colData.find(')', start) + colData = colData[:start] + colData[end+1:] results = [] for colDesc in colData.split(','): parts = colDesc.strip().split(' ', 2) |
From: <sub...@co...> - 2008-07-24 16:08:30
|
Author: phd Date: 2008-07-24 10:08:28 -0600 (Thu, 24 Jul 2008) New Revision: 3527 Modified: SQLObject/branches/0.10/docs/News.txt SQLObject/branches/0.10/sqlobject/sqlite/sqliteconnection.py Log: Fixed the bug 2009801: sqlobject-admin fails to process sqlite database with enums. Modified: SQLObject/branches/0.10/docs/News.txt =================================================================== --- SQLObject/branches/0.10/docs/News.txt 2008-07-24 16:07:16 UTC (rev 3526) +++ SQLObject/branches/0.10/docs/News.txt 2008-07-24 16:08:28 UTC (rev 3527) @@ -106,6 +106,8 @@ * Added test_default_style.py. +* Fixed a minor bug in SQLiteConnection that fails to parse Enum columns. + SQLObject 0.9.7 =============== Modified: SQLObject/branches/0.10/sqlobject/sqlite/sqliteconnection.py =================================================================== --- SQLObject/branches/0.10/sqlobject/sqlite/sqliteconnection.py 2008-07-24 16:07:16 UTC (rev 3526) +++ SQLObject/branches/0.10/sqlobject/sqlite/sqliteconnection.py 2008-07-24 16:08:28 UTC (rev 3527) @@ -308,9 +308,9 @@ raise ValueError('The table %s ws not found in the database. Load failed.' % tableName) colData = colData[0].split('(', 1)[1].strip()[:-2] while colData.find('(') > -1: - st = colData.find('(') - en = colData.find(')') - colData = colData[:st] + colData[en+1:] + start = colData.find('(') + end = colData.find(')', start) + colData = colData[:start] + colData[end+1:] results = [] for colDesc in colData.split(','): parts = colDesc.strip().split(' ', 2) |
From: <sub...@co...> - 2008-07-24 16:07:18
|
Author: phd Date: 2008-07-24 10:07:16 -0600 (Thu, 24 Jul 2008) New Revision: 3526 Modified: SQLObject/branches/0.9/docs/News.txt Log: Doc update. Modified: SQLObject/branches/0.9/docs/News.txt =================================================================== --- SQLObject/branches/0.9/docs/News.txt 2008-07-24 16:04:25 UTC (rev 3525) +++ SQLObject/branches/0.9/docs/News.txt 2008-07-24 16:07:16 UTC (rev 3526) @@ -15,6 +15,8 @@ * Added test_default_style.py. +* Fixed a minor bug in SQLiteConnection that fails to parse Enum columns. + SQLObject 0.9.7 =============== |