[CalendarServer-changes] [3293] CalendarServer/trunk/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Thu Oct 30 19:17:12 PDT 2008
Revision: 3293
http://trac.macosforge.org/projects/calendarserver/changeset/3293
Author: cdaboo at apple.com
Date: 2008-10-30 19:17:12 -0700 (Thu, 30 Oct 2008)
Log Message:
-----------
Proper fix for Py 2.6 issue with unwanted commit. Unit tests pass now.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/index.py
CalendarServer/trunk/twistedcaldav/sql.py
Modified: CalendarServer/trunk/twistedcaldav/index.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/index.py 2008-10-31 01:02:56 UTC (rev 3292)
+++ CalendarServer/trunk/twistedcaldav/index.py 2008-10-31 02:17:12 UTC (rev 3293)
@@ -666,7 +666,7 @@
# Create database where the RESOURCE table has unique UID column.
self._db_init_data_tables_base(q, True)
- def _db_recreate(self):
+ def _db_recreate(self, do_commit=True):
"""
Re-create the database tables from existing calendar data.
"""
@@ -701,7 +701,8 @@
stream.close()
# Do commit outside of the loop for better performance
- self._db_commit()
+ if do_commit:
+ self._db_commit()
class IndexSchedule (CalendarIndex):
"""
@@ -777,7 +778,7 @@
# Create database where the RESOURCE table has a UID column that is not unique.
self._db_init_data_tables_base(q, False)
- def _db_recreate(self):
+ def _db_recreate(self, do_commit=True):
"""
Re-create the database tables from existing calendar data.
"""
@@ -813,4 +814,5 @@
stream.close()
# Do commit outside of the loop for better performance
- self._db_commit()
+ if do_commit:
+ self._db_commit()
Modified: CalendarServer/trunk/twistedcaldav/sql.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/sql.py 2008-10-31 01:02:56 UTC (rev 3292)
+++ CalendarServer/trunk/twistedcaldav/sql.py 2008-10-31 02:17:12 UTC (rev 3293)
@@ -171,8 +171,10 @@
if not self._test_schema_table(q):
self._db_init_schema_table(q)
self._db_init_data_tables(q)
- self._db_recreate()
+ self._db_recreate(False)
+ q.execute("commit")
+
self._db_connection.isolation_level = old_isolation
def _db_init_schema_table(self, q):
@@ -213,13 +215,14 @@
"""
raise NotImplementedError
- def _db_recreate(self):
+ def _db_recreate(self, do_commit=True):
"""
Recreate the database tables.
"""
# Always commit at the end of this method as we have an open transaction from previous methods.
- self._db_commit()
+ if do_commit:
+ self._db_commit()
def _db_upgrade(self, old_version):
"""
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081030/2594f6c9/attachment-0001.html>
More information about the calendarserver-changes
mailing list