sqlobject-cvs Mailing List for SQLObject (Page 114)
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
(2) |
|
From: <sub...@co...> - 2006-11-13 15:41:36
|
Author: phd Date: 2006-11-13 08:41:40 -0700 (Mon, 13 Nov 2006) New Revision: 2082 Modified: SQLObject/branches/0.7-bugfix/docs/TODO.txt Log: TODO: Merge SQLObject.create*, .create*SQL methods with DBPI.create* methods. Modified: SQLObject/branches/0.7-bugfix/docs/TODO.txt =================================================================== --- SQLObject/branches/0.7-bugfix/docs/TODO.txt 2006-11-13 15:41:23 UTC (rev 2081) +++ SQLObject/branches/0.7-bugfix/docs/TODO.txt 2006-11-13 15:41:40 UTC (rev 2082) @@ -42,3 +42,5 @@ * A hierarchy of exceptions. SQLObject should translate exceptions from low-level drivers to a consistent set of high-level exceptions. + +* Merge SQLObject.create*, .create*SQL methods with DBPI.create* methods. |
|
From: <sub...@co...> - 2006-11-13 15:41:21
|
Author: phd Date: 2006-11-13 08:41:23 -0700 (Mon, 13 Nov 2006) New Revision: 2081 Modified: SQLObject/docs/TODO.txt Log: TODO: Merge SQLObject.create*, .create*SQL methods with DBPI.create* methods. Modified: SQLObject/docs/TODO.txt =================================================================== --- SQLObject/docs/TODO.txt 2006-11-10 17:37:49 UTC (rev 2080) +++ SQLObject/docs/TODO.txt 2006-11-13 15:41:23 UTC (rev 2081) @@ -39,6 +39,8 @@ * A hierarchy of exceptions. SQLObject should translate exceptions from low-level drivers to a consistent set of high-level exceptions. +* Merge SQLObject.create*, .create*SQL methods with DBPI.create* methods. + * Made SQLObject unicode-based instead of just unicode-aware. All internal processing should be done with unicode strings, conversion to/from ascii strings should happen for non-unicode DB API drivers. |
|
From: SourceForge.net <no...@so...> - 2006-11-11 14:42:02
|
Patches item #1578414, was opened at 2006-10-16 13:32 Message generated for change (Comment added) made by ptwobrussell You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1578414&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: Invalid Priority: 5 Private: No Submitted By: ptwobrussell (ptwobrussell) Assigned to: Oleg Broytmann (phd) Summary: exception called b/c pgdb.Binary('') fails Initial Comment: Patch is located inline below. Apparently, you need to specialize the check because no Binary() method exists as of pgdb v3.6+ (possibly earlier too, I don't know). dbconnection.orig is the original file and dbconnection.py is the updated file that now works --- dbconnection.py.orig 2006-10-16 14:09:01.000000000 -0400 +++ dbconnection.py 2006-10-16 14:10:58.000000000 -0400 @@ -213,7 +213,10 @@ self._pool = [] self._poolLock = threading.Lock() DBConnection.__init__(self, **kw) - self._binaryType = type(self.module.Binary('')) + if self.usePygresql: + self._binaryType = type(self.module.BINARY) + else: + self._binaryType = type(self.module.Binary('')) def _runWithConnection(self, meth, *args): conn = self.getConnection() ---------------------------------------------------------------------- >Comment By: ptwobrussell (ptwobrussell) Date: 2006-11-11 09:42 Message: Logged In: YES user_id=1622325 Ok, apparently I'm an idiot. At any rate, without the change above, I wasn't able to to use SQLObject. I don't know what this means in the grand scheme of things for how to fix the issue I ran across. I was just trying to be helpful and point out that something wasn't working properly and (naively) suggest the steps I took to fix it. ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-11-10 09:18 Message: Logged In: YES user_id=4799 First, the patch is invalid. self.usePygresql is defined only in PostgresConnection, hence that "if" will fail for any other connection class. Then, the absence of Binary() means Pygresql doesn't implement DB API 2.0 specification properly. Third, there are more calls to Binary() in the SQLObject. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1578414&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-11-11 14:37:12
|
Patches item #1578415, was opened at 2006-10-16 13:34 Message generated for change (Comment added) made by ptwobrussell You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1578415&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: Invalid Priority: 5 Private: No Submitted By: ptwobrussell (ptwobrussell) Assigned to: Oleg Broytmann (phd) Summary: exception called b/c of issue with millisecs in date string Initial Comment: A patch to fix an issue caused when pgdb returns a date/time string that contains milliseconds in it: col.py.orig is the original file. col.py is the updated file Patch is inline below: --- col.py.orig 2006-10-16 14:11:30.000000000 -0400 +++ col.py 2006-10-16 14:13:28.000000000 -0400 @@ -941,7 +941,8 @@ else: return datetime.time(value.hour, value.minute, int(value.second)) try: - stime = time.strptime(value, self.format) + #postgres might return a time value with milliseconds. strip it or else change the format string + stime = time.strptime(value[value.rfind('.')], self.format) except: raise validators.Invalid("expected an date/time string of the '%s' format in the DateTimeCol '%s', got %s %r instead" % \ (self.format, self.name, type(value), value), value, state) ---------------------------------------------------------------------- >Comment By: ptwobrussell (ptwobrussell) Date: 2006-11-11 09:37 Message: Logged In: YES user_id=1622325 Yea, basically, this approach just chops off the "." and everything after it. Sorry about that. Don't know how the ":" didn't make it through. I generated the patch from my working copy. Weird. ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-11-10 09:22 Message: Logged In: YES user_id=4799 value[value.rfind('.')]? There have to be a colon somewhere: value[:value.rfind('.')], I suppose? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1578415&group_id=74338 |
|
From: <sub...@co...> - 2006-11-10 15:37:13
|
Author: phd
Date: 2006-11-10 08:37:06 -0700 (Fri, 10 Nov 2006)
New Revision: 2075
Modified:
home/phd/SQLObject/paramstyles/sqlobject/col.py
home/phd/SQLObject/paramstyles/sqlobject/main.py
home/phd/SQLObject/paramstyles/sqlobject/sqlbuilder.py
home/phd/SQLObject/paramstyles/sqlobject/tests/test_delete.py
home/phd/SQLObject/paramstyles/sqlobject/tests/test_subqueries.py
Log:
Merged patches from the revisions 2065:2074 from the trunk
Modified: home/phd/SQLObject/paramstyles/sqlobject/col.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/col.py 2006-11-10 15:34:47 UTC (rev 2074)
+++ home/phd/SQLObject/paramstyles/sqlobject/col.py 2006-11-10 15:37:06 UTC (rev 2075)
@@ -59,10 +59,11 @@
MXDATETIME_IMPLEMENTATION = "mxDateTime"
if mxdatetime_available:
- DateTimeType = type(DateTime.now())
if hasattr(DateTime, "Time"):
+ DateTimeType = type(DateTime.now())
TimeType = type(DateTime.Time())
else: # Zope
+ DateTimeType = type(DateTime.DateTime())
TimeType = type(DateTime.DateTime.Time(DateTime.DateTime()))
if datetime_available:
Modified: home/phd/SQLObject/paramstyles/sqlobject/main.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/main.py 2006-11-10 15:34:47 UTC (rev 2074)
+++ home/phd/SQLObject/paramstyles/sqlobject/main.py 2006-11-10 15:37:06 UTC (rev 2075)
@@ -132,6 +132,11 @@
for klass in classregistry.registry(registry).allClasses():
if findDependantColumns(name, klass):
depends.append(klass)
+ else:
+ for join in klass.sqlmeta.joins:
+ if isinstance(join, joins.SORelatedJoin) and join.otherClassName == name:
+ depends.append(klass)
+ break
return depends
def findDependantColumns(name, klass):
@@ -1498,11 +1503,30 @@
def destroySelf(self):
self.sqlmeta.send(events.RowDestroySignal, self)
# Kills this object. Kills it dead!
+
+ klass = self.__class__
+
+ # Free related joins on the base class
+ for join in klass.sqlmeta.joins:
+ if isinstance(join, joins.SORelatedJoin):
+ q = "DELETE FROM %s WHERE %s=%d" % (join.intermediateTable, join.joinColumn, self.id)
+ self._connection.query(q)
+
depends = []
- klass = self.__class__
depends = self._SO_depends()
for k in depends:
+ # Free related joins
+ for join in k.sqlmeta.joins:
+ if isinstance(join, joins.SORelatedJoin) and join.otherClassName == klass.__name__:
+ q = "DELETE FROM %s WHERE %s=%d" % (join.intermediateTable, join.otherColumn, self.id)
+ self._connection.query(q)
+
cols = findDependantColumns(klass.__name__, k)
+
+ # Don't confuse the rest of the process
+ if len(cols) == 0:
+ continue
+
query = []
delete = setnull = restrict = False
for col in cols:
Modified: home/phd/SQLObject/paramstyles/sqlobject/sqlbuilder.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/sqlbuilder.py 2006-11-10 15:34:47 UTC (rev 2074)
+++ home/phd/SQLObject/paramstyles/sqlobject/sqlbuilder.py 2006-11-10 15:37:06 UTC (rev 2075)
@@ -493,7 +493,7 @@
class Select(SQLExpression):
def __init__(self, items, where=NoDefault, groupBy=NoDefault,
- having=NoDefault, orderBy=NoDefault, limit=NoDefault):
+ having=NoDefault, orderBy=NoDefault, limit=NoDefault, join=NoDefault):
if type(items) is not type([]) and type(items) is not type(()):
items = [items]
self.items = items
@@ -502,10 +502,17 @@
self.having = having
self.orderBy = orderBy
self.limit = limit
+ self.join = join
def __sqlrepr__(self, db):
select = "SELECT %s" % ", ".join([sqlrepr(v, db) for v in self.items])
+ join = []
+ if self.join is not NoDefault:
+ if isinstance(self.join, SQLJoin):
+ join.append(self.join)
+ else:
+ join.extend(self.join)
tables = {}
things = list(self.items)
if self.whereClause is not NoDefault:
@@ -513,9 +520,20 @@
for thing in things:
if isinstance(thing, SQLExpression):
tables.update(tablesUsedDict(thing))
+ for j in join:
+ if j.table1 in tables: del tables[j.table1]
+ if j.table2 in tables: del tables[j.table2]
tables = tables.keys()
if tables:
select += " FROM %s" % ", ".join(tables)
+ elif join:
+ select += " FROM "
+ for j in join:
+ if tables and j.table1:
+ sep = ", "
+ else:
+ sep = " "
+ select += sep + sqlrepr(j, db)
if self.whereClause is not NoDefault:
select += " WHERE %s" % sqlrepr(self.whereClause, db)
Modified: home/phd/SQLObject/paramstyles/sqlobject/tests/test_delete.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/tests/test_delete.py 2006-11-10 15:34:47 UTC (rev 2074)
+++ home/phd/SQLObject/paramstyles/sqlobject/tests/test_delete.py 2006-11-10 15:37:06 UTC (rev 2075)
@@ -26,3 +26,22 @@
value = NoCache(name='test')
value.destroySelf()
NoCache._connection.cache = old
+
+########################################
+## Delete from related joins
+########################################
+
+class Service(SQLObject):
+ groups = RelatedJoin("ServiceGroup")
+
+class ServiceGroup(SQLObject):
+ services = RelatedJoin("Service")
+
+def testDeleteRelatedJoins():
+ setupClass([Service, ServiceGroup])
+ service = Service()
+ service_group = ServiceGroup()
+ service.addServiceGroup(service_group)
+ service.destroySelf()
+ service_group = ServiceGroup.get(1)
+ assert len(service_group.services) == 0
Modified: home/phd/SQLObject/paramstyles/sqlobject/tests/test_subqueries.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/tests/test_subqueries.py 2006-11-10 15:34:47 UTC (rev 2074)
+++ home/phd/SQLObject/paramstyles/sqlobject/tests/test_subqueries.py 2006-11-10 15:37:06 UTC (rev 2075)
@@ -62,3 +62,16 @@
insert()
select = TestIn1.select(TestIn1.q.col1 == Select(TestIn2.q.col2, where=(TestIn2.q.col2 == "test")))
assert select.count() == 1
+
+def test_6syntax_join():
+ insert()
+ j = LEFTOUTERJOINOn(TestIn2, TestIn1, TestIn1.q.col1==TestIn2.q.col2)
+ select = TestIn1.select(TestIn1.q.col1 == Select(TestIn2.q.col2, where=(TestIn2.q.col2 == "test"), join=j))
+ assert str(select) == \
+ "SELECT test_in1.id, test_in1.col1 FROM test_in1 WHERE ((test_in1.col1) = (SELECT test_in2.col2 FROM test_in2 LEFT OUTER JOIN test_in1 ON ((test_in1.col1) = (test_in2.col2)) WHERE ((test_in2.col2) = ('test'))))"
+
+def test_6perform_join():
+ insert()
+ j = LEFTOUTERJOINOn(TestIn2, TestIn1, TestIn1.q.col1==TestIn2.q.col2)
+ select = TestIn1.select(TestIn1.q.col1 == Select(TestIn2.q.col2, where=(TestIn2.q.col2 == "test"), join=j))
+ assert select.count() == 1
|
|
From: SourceForge.net <no...@so...> - 2006-11-10 15:35:08
|
Bugs item #1493586, was opened at 2006-05-23 17:18 Message generated for change (Settings changed) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1493586&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Oleg Broytmann (phd) >Assigned to: Oleg Broytmann (phd) Summary: destroySelf() must remove the object from related joins Initial Comment: .destroySelf() must remove the object being destroyed from all related joins. Something like this: class Service(Base): groups = RelatedJoin("ServiceGroup") def destroySelf(self): for group in self.groups: self.removeServiceGroup(group) super(Service, self).destroySelf() class ServiceGroup(Base): services = RelatedJoin("Service") def destroySelf(self): for service in self.services: self.removeService(service) super(ServiceGroup, self).destroySelf() ---------------------------------------------------------------------- Comment By: Markus Niemistiemisto) Date: 2006-11-10 16:51 Message: Logged In: YES user_id=459586 A proposed fix in patch [1593174]: http://sourceforge.net/tracker/index.php?func=detail&aid=1593174&group_id=74338&atid=540674 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1493586&group_id=74338 |
|
From: <sub...@co...> - 2006-11-10 15:34:58
|
Author: phd
Date: 2006-11-10 08:34:47 -0700 (Fri, 10 Nov 2006)
New Revision: 2074
Modified:
SQLObject/branches/0.7-bugfix/docs/News.txt
SQLObject/branches/0.7-bugfix/sqlobject/main.py
SQLObject/branches/0.7-bugfix/sqlobject/tests/test_delete.py
Log:
The patch 1593174: Delete related join entries on destroySelf().
Modified: SQLObject/branches/0.7-bugfix/docs/News.txt
===================================================================
--- SQLObject/branches/0.7-bugfix/docs/News.txt 2006-11-10 15:34:28 UTC (rev 2073)
+++ SQLObject/branches/0.7-bugfix/docs/News.txt 2006-11-10 15:34:47 UTC (rev 2074)
@@ -15,6 +15,8 @@
* sqlbuilder.Select now supports JOINs exactly like SQLObject.select.
+* destroySelf() removes the object from related joins.
+
Bug Fixes
---------
Modified: SQLObject/branches/0.7-bugfix/sqlobject/main.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/main.py 2006-11-10 15:34:28 UTC (rev 2073)
+++ SQLObject/branches/0.7-bugfix/sqlobject/main.py 2006-11-10 15:34:47 UTC (rev 2074)
@@ -128,6 +128,11 @@
for klass in classregistry.registry(registry).allClasses():
if findDependantColumns(name, klass):
depends.append(klass)
+ else:
+ for join in klass.sqlmeta.joins:
+ if isinstance(join, joins.SORelatedJoin) and join.otherClassName == name:
+ depends.append(klass)
+ break
return depends
def findDependantColumns(name, klass):
@@ -1431,11 +1436,30 @@
def destroySelf(self):
# Kills this object. Kills it dead!
+
+ klass = self.__class__
+
+ # Free related joins on the base class
+ for join in klass.sqlmeta.joins:
+ if isinstance(join, joins.SORelatedJoin):
+ q = "DELETE FROM %s WHERE %s=%d" % (join.intermediateTable, join.joinColumn, self.id)
+ self._connection.query(q)
+
depends = []
- klass = self.__class__
depends = self._SO_depends()
for k in depends:
+ # Free related joins
+ for join in k.sqlmeta.joins:
+ if isinstance(join, joins.SORelatedJoin) and join.otherClassName == klass.__name__:
+ q = "DELETE FROM %s WHERE %s=%d" % (join.intermediateTable, join.otherColumn, self.id)
+ self._connection.query(q)
+
cols = findDependantColumns(klass.__name__, k)
+
+ # Don't confuse the rest of the process
+ if len(cols) == 0:
+ continue
+
query = []
delete = setnull = restrict = False
for col in cols:
Modified: SQLObject/branches/0.7-bugfix/sqlobject/tests/test_delete.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/tests/test_delete.py 2006-11-10 15:34:28 UTC (rev 2073)
+++ SQLObject/branches/0.7-bugfix/sqlobject/tests/test_delete.py 2006-11-10 15:34:47 UTC (rev 2074)
@@ -26,3 +26,22 @@
value = NoCache(name='test')
value.destroySelf()
NoCache._connection.cache = old
+
+########################################
+## Delete from related joins
+########################################
+
+class Service(SQLObject):
+ groups = RelatedJoin("ServiceGroup")
+
+class ServiceGroup(SQLObject):
+ services = RelatedJoin("Service")
+
+def testDeleteRelatedJoins():
+ setupClass([Service, ServiceGroup])
+ service = Service()
+ service_group = ServiceGroup()
+ service.addServiceGroup(service_group)
+ service.destroySelf()
+ service_group = ServiceGroup.get(1)
+ assert len(service_group.services) == 0
|
|
From: SourceForge.net <no...@so...> - 2006-11-10 15:34:34
|
Patches item #1593174, was opened at 2006-11-09 10:21 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1593174&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Accepted Priority: 5 Private: No Submitted By: Markus Niemistiemisto) >Assigned to: Oleg Broytmann (phd) Summary: Delete related join entries on destroySelf() Initial Comment: If you create a class with related joins and use them, the entries on the intermediate table won't be deleted along with the object itself. I have found this really annoying. Attached patch deletes these related join rows from all objects refering to the object being destoyed and from the joins of the object itself. The patch is against SQLObject subversion head as of 9th November 2006. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-11-10 18:34 Message: Logged In: YES user_id=4799 Applied and committed in the revisions 2072-2074. Many thanks! I added a test, see test_delete.py. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1593174&group_id=74338 |
|
From: <sub...@co...> - 2006-11-10 15:34:30
|
Author: phd Date: 2006-11-10 08:34:28 -0700 (Fri, 10 Nov 2006) New Revision: 2073 Modified: SQLObject/docs/News.txt Log: The patch 1593174: Delete related join entries on destroySelf(). Modified: SQLObject/docs/News.txt =================================================================== --- SQLObject/docs/News.txt 2006-11-10 15:34:16 UTC (rev 2072) +++ SQLObject/docs/News.txt 2006-11-10 15:34:28 UTC (rev 2073) @@ -102,6 +102,8 @@ * sqlbuilder.Select now supports JOINs exactly like SQLObject.select. +* destroySelf() removes the object from related joins. + Bug Fixes --------- |
|
From: <sub...@co...> - 2006-11-10 15:34:17
|
Author: phd
Date: 2006-11-10 08:34:16 -0700 (Fri, 10 Nov 2006)
New Revision: 2072
Modified:
SQLObject/trunk/sqlobject/main.py
SQLObject/trunk/sqlobject/tests/test_delete.py
Log:
The patch 1593174: Delete related join entries on destroySelf().
Modified: SQLObject/trunk/sqlobject/main.py
===================================================================
--- SQLObject/trunk/sqlobject/main.py 2006-11-10 15:07:54 UTC (rev 2071)
+++ SQLObject/trunk/sqlobject/main.py 2006-11-10 15:34:16 UTC (rev 2072)
@@ -132,6 +132,11 @@
for klass in classregistry.registry(registry).allClasses():
if findDependantColumns(name, klass):
depends.append(klass)
+ else:
+ for join in klass.sqlmeta.joins:
+ if isinstance(join, joins.SORelatedJoin) and join.otherClassName == name:
+ depends.append(klass)
+ break
return depends
def findDependantColumns(name, klass):
@@ -1498,11 +1503,30 @@
def destroySelf(self):
self.sqlmeta.send(events.RowDestroySignal, self)
# Kills this object. Kills it dead!
+
+ klass = self.__class__
+
+ # Free related joins on the base class
+ for join in klass.sqlmeta.joins:
+ if isinstance(join, joins.SORelatedJoin):
+ q = "DELETE FROM %s WHERE %s=%d" % (join.intermediateTable, join.joinColumn, self.id)
+ self._connection.query(q)
+
depends = []
- klass = self.__class__
depends = self._SO_depends()
for k in depends:
+ # Free related joins
+ for join in k.sqlmeta.joins:
+ if isinstance(join, joins.SORelatedJoin) and join.otherClassName == klass.__name__:
+ q = "DELETE FROM %s WHERE %s=%d" % (join.intermediateTable, join.otherColumn, self.id)
+ self._connection.query(q)
+
cols = findDependantColumns(klass.__name__, k)
+
+ # Don't confuse the rest of the process
+ if len(cols) == 0:
+ continue
+
query = []
delete = setnull = restrict = False
for col in cols:
Modified: SQLObject/trunk/sqlobject/tests/test_delete.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_delete.py 2006-11-10 15:07:54 UTC (rev 2071)
+++ SQLObject/trunk/sqlobject/tests/test_delete.py 2006-11-10 15:34:16 UTC (rev 2072)
@@ -26,3 +26,22 @@
value = NoCache(name='test')
value.destroySelf()
NoCache._connection.cache = old
+
+########################################
+## Delete from related joins
+########################################
+
+class Service(SQLObject):
+ groups = RelatedJoin("ServiceGroup")
+
+class ServiceGroup(SQLObject):
+ services = RelatedJoin("Service")
+
+def testDeleteRelatedJoins():
+ setupClass([Service, ServiceGroup])
+ service = Service()
+ service_group = ServiceGroup()
+ service.addServiceGroup(service_group)
+ service.destroySelf()
+ service_group = ServiceGroup.get(1)
+ assert len(service_group.services) == 0
|
|
From: SourceForge.net <no...@so...> - 2006-11-10 15:08:23
|
Patches item #1592104, was opened at 2006-11-07 19:44 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1592104&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Accepted Priority: 5 Private: No Submitted By: Luke Opperman (luke_opperman) >Assigned to: Oleg Broytmann (phd) Summary: sqlbuilder.Select with JOINs Initial Comment: Attacking the "dbconnection.queryForSelect / sresults.SelectResults don't use sqlbuilder.Select" issue a piece at a time, and I needed this for a simpler purpose: sqlbuilder.Select does not know how to handle sqlbuilder.SQLJoin instances. This diff adds the logic from dbconnection._fixTablesForJoins and dbconnection._addJoins to Select, taking a "join" parameter as SQLObject.select/sresults.SelectResults does. Trivial test added to the other tests of sqlbuilder.Select, not a realistic use of a SQLJoin however. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-11-10 18:08 Message: Logged In: YES user_id=4799 Very nice! Applied and committed in the revisions 2069-2071. Thank you! ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1592104&group_id=74338 |
|
From: <sub...@co...> - 2006-11-10 15:07:58
|
Author: phd
Date: 2006-11-10 08:07:54 -0700 (Fri, 10 Nov 2006)
New Revision: 2071
Modified:
SQLObject/branches/0.7-bugfix/docs/News.txt
SQLObject/branches/0.7-bugfix/sqlobject/sqlbuilder.py
SQLObject/branches/0.7-bugfix/sqlobject/tests/test_subqueries.py
Log:
The patch 1592104: sqlbuilder.Select with JOINs.
Modified: SQLObject/branches/0.7-bugfix/docs/News.txt
===================================================================
--- SQLObject/branches/0.7-bugfix/docs/News.txt 2006-11-10 15:07:35 UTC (rev 2070)
+++ SQLObject/branches/0.7-bugfix/docs/News.txt 2006-11-10 15:07:54 UTC (rev 2071)
@@ -10,6 +10,11 @@
SQLObject 0.7.2
===============
+Features & Interface
+--------------------
+
+* sqlbuilder.Select now supports JOINs exactly like SQLObject.select.
+
Bug Fixes
---------
Modified: SQLObject/branches/0.7-bugfix/sqlobject/sqlbuilder.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/sqlbuilder.py 2006-11-10 15:07:35 UTC (rev 2070)
+++ SQLObject/branches/0.7-bugfix/sqlobject/sqlbuilder.py 2006-11-10 15:07:54 UTC (rev 2071)
@@ -453,7 +453,7 @@
class Select(SQLExpression):
def __init__(self, items, where=NoDefault, groupBy=NoDefault,
- having=NoDefault, orderBy=NoDefault, limit=NoDefault):
+ having=NoDefault, orderBy=NoDefault, limit=NoDefault, join=NoDefault):
if type(items) is not type([]) and type(items) is not type(()):
items = [items]
self.items = items
@@ -462,10 +462,17 @@
self.having = having
self.orderBy = orderBy
self.limit = limit
+ self.join = join
def __sqlrepr__(self, db):
select = "SELECT %s" % ", ".join([sqlrepr(v, db) for v in self.items])
+ join = []
+ if self.join is not NoDefault:
+ if isinstance(self.join, SQLJoin):
+ join.append(self.join)
+ else:
+ join.extend(self.join)
tables = {}
things = list(self.items)
if self.whereClause is not NoDefault:
@@ -473,9 +480,20 @@
for thing in things:
if isinstance(thing, SQLExpression):
tables.update(tablesUsedDict(thing))
+ for j in join:
+ if j.table1 in tables: del tables[j.table1]
+ if j.table2 in tables: del tables[j.table2]
tables = tables.keys()
if tables:
select += " FROM %s" % ", ".join(tables)
+ elif join:
+ select += " FROM "
+ for j in join:
+ if tables and j.table1:
+ sep = ", "
+ else:
+ sep = " "
+ select += sep + sqlrepr(j, db)
if self.whereClause is not NoDefault:
select += " WHERE %s" % sqlrepr(self.whereClause, db)
Modified: SQLObject/branches/0.7-bugfix/sqlobject/tests/test_subqueries.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/tests/test_subqueries.py 2006-11-10 15:07:35 UTC (rev 2070)
+++ SQLObject/branches/0.7-bugfix/sqlobject/tests/test_subqueries.py 2006-11-10 15:07:54 UTC (rev 2071)
@@ -62,3 +62,16 @@
insert()
select = TestIn1.select(TestIn1.q.col1 == Select(TestIn2.q.col2, where=(TestIn2.q.col2 == "test")))
assert select.count() == 1
+
+def test_6syntax_join():
+ insert()
+ j = LEFTOUTERJOINOn(TestIn2, TestIn1, TestIn1.q.col1==TestIn2.q.col2)
+ select = TestIn1.select(TestIn1.q.col1 == Select(TestIn2.q.col2, where=(TestIn2.q.col2 == "test"), join=j))
+ assert str(select) == \
+ "SELECT test_in1.id, test_in1.col1 FROM test_in1 WHERE ((test_in1.col1) = (SELECT test_in2.col2 FROM test_in2 LEFT OUTER JOIN test_in1 ON ((test_in1.col1) = (test_in2.col2)) WHERE ((test_in2.col2) = ('test'))))"
+
+def test_6perform_join():
+ insert()
+ j = LEFTOUTERJOINOn(TestIn2, TestIn1, TestIn1.q.col1==TestIn2.q.col2)
+ select = TestIn1.select(TestIn1.q.col1 == Select(TestIn2.q.col2, where=(TestIn2.q.col2 == "test"), join=j))
+ assert select.count() == 1
|
|
From: <sub...@co...> - 2006-11-10 15:07:38
|
Author: phd Date: 2006-11-10 08:07:35 -0700 (Fri, 10 Nov 2006) New Revision: 2070 Modified: SQLObject/docs/News.txt Log: The patch 1592104: sqlbuilder.Select with JOINs. Modified: SQLObject/docs/News.txt =================================================================== --- SQLObject/docs/News.txt 2006-11-10 15:07:17 UTC (rev 2069) +++ SQLObject/docs/News.txt 2006-11-10 15:07:35 UTC (rev 2070) @@ -97,6 +97,14 @@ SQLObject 0.7.2 =============== +Features & Interface +-------------------- + +* sqlbuilder.Select now supports JOINs exactly like SQLObject.select. + +Bug Fixes +--------- + * Fixed a number of unicode-related problems with newer MySQLdb. * If the DB API driver returns timedelta instead of time (MySQLdb does |
|
From: <sub...@co...> - 2006-11-10 15:07:18
|
Author: phd
Date: 2006-11-10 08:07:17 -0700 (Fri, 10 Nov 2006)
New Revision: 2069
Modified:
SQLObject/trunk/sqlobject/sqlbuilder.py
SQLObject/trunk/sqlobject/tests/test_subqueries.py
Log:
The patch 1592104: sqlbuilder.Select with JOINs.
Modified: SQLObject/trunk/sqlobject/sqlbuilder.py
===================================================================
--- SQLObject/trunk/sqlobject/sqlbuilder.py 2006-11-10 14:42:45 UTC (rev 2068)
+++ SQLObject/trunk/sqlobject/sqlbuilder.py 2006-11-10 15:07:17 UTC (rev 2069)
@@ -456,7 +456,7 @@
class Select(SQLExpression):
def __init__(self, items, where=NoDefault, groupBy=NoDefault,
- having=NoDefault, orderBy=NoDefault, limit=NoDefault):
+ having=NoDefault, orderBy=NoDefault, limit=NoDefault, join=NoDefault):
if type(items) is not type([]) and type(items) is not type(()):
items = [items]
self.items = items
@@ -465,10 +465,17 @@
self.having = having
self.orderBy = orderBy
self.limit = limit
+ self.join = join
def __sqlrepr__(self, db):
select = "SELECT %s" % ", ".join([sqlrepr(v, db) for v in self.items])
+ join = []
+ if self.join is not NoDefault:
+ if isinstance(self.join, SQLJoin):
+ join.append(self.join)
+ else:
+ join.extend(self.join)
tables = {}
things = list(self.items)
if self.whereClause is not NoDefault:
@@ -476,9 +483,20 @@
for thing in things:
if isinstance(thing, SQLExpression):
tables.update(tablesUsedDict(thing))
+ for j in join:
+ if j.table1 in tables: del tables[j.table1]
+ if j.table2 in tables: del tables[j.table2]
tables = tables.keys()
if tables:
select += " FROM %s" % ", ".join(tables)
+ elif join:
+ select += " FROM "
+ for j in join:
+ if tables and j.table1:
+ sep = ", "
+ else:
+ sep = " "
+ select += sep + sqlrepr(j, db)
if self.whereClause is not NoDefault:
select += " WHERE %s" % sqlrepr(self.whereClause, db)
Modified: SQLObject/trunk/sqlobject/tests/test_subqueries.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_subqueries.py 2006-11-10 14:42:45 UTC (rev 2068)
+++ SQLObject/trunk/sqlobject/tests/test_subqueries.py 2006-11-10 15:07:17 UTC (rev 2069)
@@ -62,3 +62,16 @@
insert()
select = TestIn1.select(TestIn1.q.col1 == Select(TestIn2.q.col2, where=(TestIn2.q.col2 == "test")))
assert select.count() == 1
+
+def test_6syntax_join():
+ insert()
+ j = LEFTOUTERJOINOn(TestIn2, TestIn1, TestIn1.q.col1==TestIn2.q.col2)
+ select = TestIn1.select(TestIn1.q.col1 == Select(TestIn2.q.col2, where=(TestIn2.q.col2 == "test"), join=j))
+ assert str(select) == \
+ "SELECT test_in1.id, test_in1.col1 FROM test_in1 WHERE ((test_in1.col1) = (SELECT test_in2.col2 FROM test_in2 LEFT OUTER JOIN test_in1 ON ((test_in1.col1) = (test_in2.col2)) WHERE ((test_in2.col2) = ('test'))))"
+
+def test_6perform_join():
+ insert()
+ j = LEFTOUTERJOINOn(TestIn2, TestIn1, TestIn1.q.col1==TestIn2.q.col2)
+ select = TestIn1.select(TestIn1.q.col1 == Select(TestIn2.q.col2, where=(TestIn2.q.col2 == "test"), join=j))
+ assert select.count() == 1
|
|
From: SourceForge.net <no...@so...> - 2006-11-10 14:43:08
|
Patches item #1589289, was opened at 2006-11-02 17:12 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1589289&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Accepted Priority: 5 Private: No Submitted By: Jason R. Coombs (jaraco) >Assigned to: Oleg Broytmann (phd) Summary: Zope 2.9 DateTime library compatability Initial Comment: I'm using Python 2.4 with Zope 2.9.4. SQLObject fails to initialize with the following error: Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import sqlobject Traceback (most recent call last): File "<stdin>", line 1, in ? File "c:\program files\python\lib\site-packages\SQLObject-0.7.1-py2.4.egg\sqlo bject\__init__.py", line 1, in ? from main import * File "c:\program files\python\lib\site-packages\SQLObject-0.7.1-py2.4.egg\sqlo bject\main.py", line 37, in ? import dbconnection File "c:\program files\python\lib\site-packages\SQLObject-0.7.1-py2.4.egg\sqlo bject\dbconnection.py", line 18, in ? import col File "c:\program files\python\lib\site-packages\SQLObject-0.7.1-py2.4.egg\sqlo bject\col.py", line 62, in ? DateTimeType = type(DateTime.now()) AttributeError: 'module' object has no attribute 'now' The following patch addresses the issue. It appears to be in the same vein as patch 1483018. --- col.py 2006-11-02 09:04:28.186951200 -0500 +++ \col.py 2006-11-02 09:05:38.673858600 -0500 @@ -59,10 +59,11 @@ MXDATETIME_IMPLEMENTATION = "mxDateTime" if mxdatetime_available: - DateTimeType = type(DateTime.now()) if hasattr(DateTime, "Time"): + DateTimeType = type(DateTime.now()) TimeType = type(DateTime.Time()) else: # Zope + DateTimeType = type( DateTime.DateTime() ) TimeType = type(DateTime.DateTime.Time(DateTime.DateTime())) if datetime_available: ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-11-10 17:43 Message: Logged In: YES user_id=4799 Applied and committed in the revisions 2066-2068. Thank you! ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1589289&group_id=74338 |
|
From: <sub...@co...> - 2006-11-10 14:42:46
|
Author: phd
Date: 2006-11-10 07:42:45 -0700 (Fri, 10 Nov 2006)
New Revision: 2068
Modified:
SQLObject/branches/0.7-bugfix/docs/News.txt
SQLObject/branches/0.7-bugfix/sqlobject/col.py
Log:
The patch 1589289: Zope 2.9 DateTime library compatability.
Modified: SQLObject/branches/0.7-bugfix/docs/News.txt
===================================================================
--- SQLObject/branches/0.7-bugfix/docs/News.txt 2006-11-10 14:41:49 UTC (rev 2067)
+++ SQLObject/branches/0.7-bugfix/docs/News.txt 2006-11-10 14:42:45 UTC (rev 2068)
@@ -24,6 +24,8 @@
* Fixed a bug in InheritableSQLObject related to the order of tableRegistry
dictionary.
+* A bug fix that allows to use SQLObject with DateTime from Zope.
+
SQLObject 0.7.1
===============
Modified: SQLObject/branches/0.7-bugfix/sqlobject/col.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/col.py 2006-11-10 14:41:49 UTC (rev 2067)
+++ SQLObject/branches/0.7-bugfix/sqlobject/col.py 2006-11-10 14:42:45 UTC (rev 2068)
@@ -59,10 +59,11 @@
MXDATETIME_IMPLEMENTATION = "mxDateTime"
if mxdatetime_available:
- DateTimeType = type(DateTime.now())
if hasattr(DateTime, "Time"):
+ DateTimeType = type(DateTime.now())
TimeType = type(DateTime.Time())
else: # Zope
+ DateTimeType = type(DateTime.DateTime())
TimeType = type(DateTime.DateTime.Time(DateTime.DateTime()))
if datetime_available:
|
|
From: <sub...@co...> - 2006-11-10 14:41:51
|
Author: phd Date: 2006-11-10 07:41:49 -0700 (Fri, 10 Nov 2006) New Revision: 2067 Modified: SQLObject/docs/News.txt Log: The patch 1589289: Zope 2.9 DateTime library compatability. Modified: SQLObject/docs/News.txt =================================================================== --- SQLObject/docs/News.txt 2006-11-10 14:41:31 UTC (rev 2066) +++ SQLObject/docs/News.txt 2006-11-10 14:41:49 UTC (rev 2067) @@ -108,6 +108,8 @@ * Fixed a bug in InheritableSQLObject related to the order of tableRegistry dictionary. +* A bug fix that allows to use SQLObject with DateTime from Zope. + SQLObject 0.7.1 =============== |
|
From: <sub...@co...> - 2006-11-10 14:41:40
|
Author: phd
Date: 2006-11-10 07:41:31 -0700 (Fri, 10 Nov 2006)
New Revision: 2066
Modified:
SQLObject/trunk/sqlobject/col.py
Log:
The patch 1589289: Zope 2.9 DateTime library compatability.
Modified: SQLObject/trunk/sqlobject/col.py
===================================================================
--- SQLObject/trunk/sqlobject/col.py 2006-11-10 05:58:53 UTC (rev 2065)
+++ SQLObject/trunk/sqlobject/col.py 2006-11-10 14:41:31 UTC (rev 2066)
@@ -59,10 +59,11 @@
MXDATETIME_IMPLEMENTATION = "mxDateTime"
if mxdatetime_available:
- DateTimeType = type(DateTime.now())
if hasattr(DateTime, "Time"):
+ DateTimeType = type(DateTime.now())
TimeType = type(DateTime.Time())
else: # Zope
+ DateTimeType = type(DateTime.DateTime())
TimeType = type(DateTime.DateTime.Time(DateTime.DateTime()))
if datetime_available:
|
|
From: SourceForge.net <no...@so...> - 2006-11-10 14:22:31
|
Patches item #1578415, was opened at 2006-10-16 22:34 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1578415&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open >Resolution: Invalid Priority: 5 Private: No Submitted By: ptwobrussell (ptwobrussell) >Assigned to: Oleg Broytmann (phd) Summary: exception called b/c of issue with millisecs in date string Initial Comment: A patch to fix an issue caused when pgdb returns a date/time string that contains milliseconds in it: col.py.orig is the original file. col.py is the updated file Patch is inline below: --- col.py.orig 2006-10-16 14:11:30.000000000 -0400 +++ col.py 2006-10-16 14:13:28.000000000 -0400 @@ -941,7 +941,8 @@ else: return datetime.time(value.hour, value.minute, int(value.second)) try: - stime = time.strptime(value, self.format) + #postgres might return a time value with milliseconds. strip it or else change the format string + stime = time.strptime(value[value.rfind('.')], self.format) except: raise validators.Invalid("expected an date/time string of the '%s' format in the DateTimeCol '%s', got %s %r instead" % \ (self.format, self.name, type(value), value), value, state) ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-11-10 17:22 Message: Logged In: YES user_id=4799 value[value.rfind('.')]? There have to be a colon somewhere: value[:value.rfind('.')], I suppose? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1578415&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-11-10 14:18:18
|
Patches item #1578414, was opened at 2006-10-16 22:32 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1578414&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open >Resolution: Invalid Priority: 5 Private: No Submitted By: ptwobrussell (ptwobrussell) >Assigned to: Oleg Broytmann (phd) Summary: exception called b/c pgdb.Binary('') fails Initial Comment: Patch is located inline below. Apparently, you need to specialize the check because no Binary() method exists as of pgdb v3.6+ (possibly earlier too, I don't know). dbconnection.orig is the original file and dbconnection.py is the updated file that now works --- dbconnection.py.orig 2006-10-16 14:09:01.000000000 -0400 +++ dbconnection.py 2006-10-16 14:10:58.000000000 -0400 @@ -213,7 +213,10 @@ self._pool = [] self._poolLock = threading.Lock() DBConnection.__init__(self, **kw) - self._binaryType = type(self.module.Binary('')) + if self.usePygresql: + self._binaryType = type(self.module.BINARY) + else: + self._binaryType = type(self.module.Binary('')) def _runWithConnection(self, meth, *args): conn = self.getConnection() ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-11-10 17:18 Message: Logged In: YES user_id=4799 First, the patch is invalid. self.usePygresql is defined only in PostgresConnection, hence that "if" will fail for any other connection class. Then, the absence of Binary() means Pygresql doesn't implement DB API 2.0 specification properly. Third, there are more calls to Binary() in the SQLObject. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1578414&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-11-10 13:51:45
|
Bugs item #1493586, was opened at 2006-05-23 16:18 Message generated for change (Comment added) made by niemisto You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1493586&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Oleg Broytmann (phd) Assigned to: Nobody/Anonymous (nobody) Summary: destroySelf() must remove the object from related joins Initial Comment: .destroySelf() must remove the object being destroyed from all related joins. Something like this: class Service(Base): groups = RelatedJoin("ServiceGroup") def destroySelf(self): for group in self.groups: self.removeServiceGroup(group) super(Service, self).destroySelf() class ServiceGroup(Base): services = RelatedJoin("Service") def destroySelf(self): for service in self.services: self.removeService(service) super(ServiceGroup, self).destroySelf() ---------------------------------------------------------------------- Comment By: Markus Niemistiemisto) Date: 2006-11-10 15:51 Message: Logged In: YES user_id=459586 A proposed fix in patch [1593174]: http://sourceforge.net/tracker/index.php?func=detail&aid=1593174&group_id=74338&atid=540674 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1493586&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-11-09 07:21:42
|
Patches item #1593174, was opened at 2006-11-09 09:21 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1593174&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Markus Niemistiemisto) Assigned to: Nobody/Anonymous (nobody) Summary: Delete related join entries on destroySelf() Initial Comment: If you create a class with related joins and use them, the entries on the intermediate table won't be deleted along with the object itself. I have found this really annoying. Attached patch deletes these related join rows from all objects refering to the object being destoyed and from the joins of the object itself. The patch is against SQLObject subversion head as of 9th November 2006. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1593174&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-11-08 17:20:49
|
Bugs item #1592786, was opened at 2006-11-08 17:20 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=1592786&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: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Jayhem (jayhem) Assigned to: Nobody/Anonymous (nobody) Summary: so-sqlite data corruption during updates Initial Comment: I'm hitting a bug when using SO with turbogears 1.1b with an sqlite database. When I do several successive updates to a table (which are very slow btw), data gets corrupted in the interface, select() returns invalid objects, as if objects were pulled from a cache that was out of synch with the db. >From this point, successive select() without any updates in-between can return different values, randomly selecting one of the previsouly set values. I have created a simple test-case (on turbogears) Just launch it and change some values. Usually after 10-20 changes, the corruption appears. I have tried this same testcase with MySQL and do not hit this problem. Note that dev.cfg declares sqlobject.dburi="notrans_sqlite:///..." file: model.py ====================================================== from sqlobject import * from turbogears.database import PackageHub hub = PackageHub("bug") __connection__ = hub class Item(SQLObject): data = UnicodeCol(length=40) def loaddb(): hub.begin() Item.dropTable(ifExists=True, cascade=True) hub.commit() Item.createTable(ifNotExists=True) for i in range(20): Item(data = str(i)) hub.commit() loaddb() file: controllers.py ====================================================== import turbogears from turbogears.controllers import RootController, expose from model import Item class Root(RootController): @expose(template="bug.templates.index") def index(self): items = Item.select() return dict(items = items) @expose(template="bug.templates.index") def change(self, id): item = Item.get(id) item.data += str(id) items = Item.select() return dict(items = items) file: index.kid ====================================================== <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#" py:extends="'master.kid'"> <head> <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/> <title>Items</title> </head> <body> <ul py:for="i in items"> <li>${i.data} <a href="/change/${i.id}">[edit]</a></li> </ul> </body> </html> ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1592786&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-11-07 16:44:20
|
Patches item #1592104, was opened at 2006-11-07 10:44 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1592104&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Luke Opperman (luke_opperman) Assigned to: Nobody/Anonymous (nobody) Summary: sqlbuilder.Select with JOINs Initial Comment: Attacking the "dbconnection.queryForSelect / sresults.SelectResults don't use sqlbuilder.Select" issue a piece at a time, and I needed this for a simpler purpose: sqlbuilder.Select does not know how to handle sqlbuilder.SQLJoin instances. This diff adds the logic from dbconnection._fixTablesForJoins and dbconnection._addJoins to Select, taking a "join" parameter as SQLObject.select/sresults.SelectResults does. Trivial test added to the other tests of sqlbuilder.Select, not a realistic use of a SQLJoin however. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1592104&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-11-02 14:13:00
|
Patches item #1589289, was opened at 2006-11-02 07:12 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1589289&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Jason R. Coombs (jaraco) Assigned to: Nobody/Anonymous (nobody) Summary: Zope 2.9 DateTime library compatability Initial Comment: I'm using Python 2.4 with Zope 2.9.4. SQLObject fails to initialize with the following error: Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import sqlobject Traceback (most recent call last): File "<stdin>", line 1, in ? File "c:\program files\python\lib\site-packages\SQLObject-0.7.1-py2.4.egg\sqlo bject\__init__.py", line 1, in ? from main import * File "c:\program files\python\lib\site-packages\SQLObject-0.7.1-py2.4.egg\sqlo bject\main.py", line 37, in ? import dbconnection File "c:\program files\python\lib\site-packages\SQLObject-0.7.1-py2.4.egg\sqlo bject\dbconnection.py", line 18, in ? import col File "c:\program files\python\lib\site-packages\SQLObject-0.7.1-py2.4.egg\sqlo bject\col.py", line 62, in ? DateTimeType = type(DateTime.now()) AttributeError: 'module' object has no attribute 'now' The following patch addresses the issue. It appears to be in the same vein as patch 1483018. --- col.py 2006-11-02 09:04:28.186951200 -0500 +++ \col.py 2006-11-02 09:05:38.673858600 -0500 @@ -59,10 +59,11 @@ MXDATETIME_IMPLEMENTATION = "mxDateTime" if mxdatetime_available: - DateTimeType = type(DateTime.now()) if hasattr(DateTime, "Time"): + DateTimeType = type(DateTime.now()) TimeType = type(DateTime.Time()) else: # Zope + DateTimeType = type( DateTime.DateTime() ) TimeType = type(DateTime.DateTime.Time(DateTime.DateTime())) if datetime_available: ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1589289&group_id=74338 |