[CalendarServer-changes] [10849] CalendarServer/branches/users/gaya/sharedgroups/txdav
source_changes at macosforge.org
source_changes at macosforge.org
Tue Mar 5 11:48:27 PST 2013
Revision: 10849
http://trac.calendarserver.org//changeset/10849
Author: gaya at apple.com
Date: 2013-03-05 11:48:27 -0800 (Tue, 05 Mar 2013)
Log Message:
-----------
Remove unused xxx_TABLEs
Modified Paths:
--------------
CalendarServer/branches/users/gaya/sharedgroups/txdav/caldav/datastore/sql.py
CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py
CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/sql.py
CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/sql_tables.py
CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/test/test_sql.py
Modified: CalendarServer/branches/users/gaya/sharedgroups/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups/txdav/caldav/datastore/sql.py 2013-03-05 19:44:04 UTC (rev 10848)
+++ CalendarServer/branches/users/gaya/sharedgroups/txdav/caldav/datastore/sql.py 2013-03-05 19:48:27 UTC (rev 10849)
@@ -68,13 +68,9 @@
CommonObjectResource, ECALENDARTYPE
from txdav.common.datastore.sql_legacy import PostgresLegacyIndexEmulator, \
PostgresLegacyInboxIndexEmulator
-from txdav.common.datastore.sql_tables import CALENDAR_TABLE, \
- CALENDAR_BIND_TABLE, CALENDAR_OBJECT_REVISIONS_TABLE, CALENDAR_OBJECT_TABLE, \
- _ATTACHMENTS_MODE_NONE, _ATTACHMENTS_MODE_WRITE, \
- CALENDAR_HOME_TABLE, CALENDAR_HOME_METADATA_TABLE, \
- CALENDAR_AND_CALENDAR_BIND, CALENDAR_OBJECT_REVISIONS_AND_BIND_TABLE, \
- CALENDAR_OBJECT_AND_BIND_TABLE, schema, _BIND_MODE_OWN, \
- _ATTACHMENTS_MODE_READ
+from txdav.common.datastore.sql_tables import _ATTACHMENTS_MODE_NONE, \
+ _ATTACHMENTS_MODE_READ, _ATTACHMENTS_MODE_WRITE, \
+ _BIND_MODE_OWN, schema
from txdav.common.icommondatastore import IndexedSearchException, \
InternalDataStoreError, HomeChildNameAlreadyExistsError, \
HomeChildNameNotAllowedError
Modified: CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py 2013-03-05 19:44:04 UTC (rev 10848)
+++ CalendarServer/branches/users/gaya/sharedgroups/txdav/carddav/datastore/sql.py 2013-03-05 19:48:27 UTC (rev 10849)
@@ -50,14 +50,8 @@
from txdav.common.datastore.sql import CommonHome, CommonHomeChild, \
CommonObjectResource, EADDRESSBOOKTYPE, SharingMixIn
from txdav.common.datastore.sql_legacy import PostgresLegacyABIndexEmulator
-from txdav.common.datastore.sql_tables import \
- ADDRESSBOOK_HOME_BIND_TABLE, ADDRESSBOOK_OBJECT_REVISIONS_TABLE, \
- ADDRESSBOOK_OBJECT_TABLE, ADDRESSBOOK_HOME_TABLE, \
- ADDRESSBOOK_HOME_METADATA_TABLE, ADDRESSBOOK_HOME_AND_ADDRESSBOOK_HOME_BIND, \
- ADDRESSBOOK_OBJECT_AND_BIND_TABLE, \
- ADDRESSBOOK_OBJECT_REVISIONS_AND_BIND_TABLE, \
- _ABO_KIND_PERSON, _ABO_KIND_GROUP, _ABO_KIND_RESOURCE, \
- _ABO_KIND_LOCATION, schema, \
+from txdav.common.datastore.sql_tables import _ABO_KIND_PERSON, \
+ _ABO_KIND_GROUP, _ABO_KIND_RESOURCE, _ABO_KIND_LOCATION, schema, \
_BIND_MODE_OWN, _BIND_MODE_WRITE, _BIND_STATUS_ACCEPTED, \
_BIND_STATUS_DECLINED, _BIND_STATUS_INVITED
from txdav.common.icommondatastore import HomeChildNameNotAllowedError, \
@@ -1165,7 +1159,6 @@
implements(IAddressBookObject)
- _objectTable = ADDRESSBOOK_OBJECT_TABLE
_objectSchema = schema.ADDRESSBOOK_OBJECT
_bindSchema = schema.GROUP_ADDRESSBOOK_HOME_BIND
Modified: CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/sql.py 2013-03-05 19:44:04 UTC (rev 10848)
+++ CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/sql.py 2013-03-05 19:48:27 UTC (rev 10849)
@@ -59,8 +59,7 @@
from txdav.common.datastore.common import HomeChildBase
from txdav.common.datastore.sql_tables import schema
from txdav.common.datastore.sql_tables import _BIND_MODE_OWN, \
- _BIND_STATUS_ACCEPTED, _BIND_STATUS_DECLINED, \
- NOTIFICATION_OBJECT_REVISIONS_TABLE
+ _BIND_STATUS_ACCEPTED, _BIND_STATUS_DECLINED
from txdav.common.icommondatastore import HomeChildNameNotAllowedError, \
HomeChildNameAlreadyExistsError, NoSuchHomeChildError, \
ObjectResourceNameNotAllowedError, ObjectResourceNameAlreadyExistsError, \
@@ -4250,7 +4249,6 @@
"_resourceID",
)
- _revisionsTable = NOTIFICATION_OBJECT_REVISIONS_TABLE
_revisionsSchema = schema.NOTIFICATION_OBJECT_REVISIONS
_homeSchema = schema.NOTIFICATION_HOME
Modified: CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/sql_tables.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/sql_tables.py 2013-03-05 19:44:04 UTC (rev 10848)
+++ CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/sql_tables.py 2013-03-05 19:48:27 UTC (rev 10849)
@@ -190,41 +190,6 @@
_ABO_KIND_RESOURCE = _addressBookObjectKind('resource')
_ABO_KIND_LOCATION = _addressBookObjectKind('location')
-
-
-# Compatibility tables for string formatting:
-CALENDAR_HOME_TABLE = _S(schema.CALENDAR_HOME)
-CALENDAR_HOME_METADATA_TABLE = _S(schema.CALENDAR_HOME_METADATA)
-ADDRESSBOOK_HOME_TABLE = _S(schema.ADDRESSBOOK_HOME)
-ADDRESSBOOK_HOME_METADATA_TABLE = _S(schema.ADDRESSBOOK_HOME_METADATA)
-NOTIFICATION_HOME_TABLE = _S(schema.NOTIFICATION_HOME)
-CALENDAR_TABLE = _S(schema.CALENDAR)
-CALENDAR_BIND_TABLE = _S(schema.CALENDAR_BIND)
-ADDRESSBOOK_HOME_BIND_TABLE = _S(schema.ADDRESSBOOK_HOME_BIND)
-CALENDAR_OBJECT_REVISIONS_TABLE = _S(schema.CALENDAR_OBJECT_REVISIONS)
-ADDRESSBOOK_OBJECT_REVISIONS_TABLE = _S(schema.ADDRESSBOOK_OBJECT_REVISIONS)
-NOTIFICATION_OBJECT_REVISIONS_TABLE = _S(schema.NOTIFICATION_OBJECT_REVISIONS)
-CALENDAR_OBJECT_TABLE = _S(schema.CALENDAR_OBJECT)
-ADDRESSBOOK_OBJECT_TABLE = _S(schema.ADDRESSBOOK_OBJECT)
-
-# Some combined tables used in join-string-formatting.
-CALENDAR_AND_CALENDAR_BIND = _combine(CHILD=CALENDAR_TABLE,
- BIND=CALENDAR_BIND_TABLE)
-CALENDAR_OBJECT_AND_BIND_TABLE = _combine(OBJECT=CALENDAR_OBJECT_TABLE,
- BIND=CALENDAR_BIND_TABLE)
-CALENDAR_OBJECT_REVISIONS_AND_BIND_TABLE = _combine(
- REV=CALENDAR_OBJECT_REVISIONS_TABLE,
- BIND=CALENDAR_BIND_TABLE)
-ADDRESSBOOK_HOME_AND_ADDRESSBOOK_HOME_BIND = _combine(CHILD=ADDRESSBOOK_HOME_TABLE,
- BIND=ADDRESSBOOK_HOME_BIND_TABLE)
-ADDRESSBOOK_OBJECT_AND_BIND_TABLE = _combine(OBJECT=ADDRESSBOOK_OBJECT_TABLE,
- BIND=ADDRESSBOOK_HOME_BIND_TABLE)
-ADDRESSBOOK_OBJECT_REVISIONS_AND_BIND_TABLE = _combine(
- REV=ADDRESSBOOK_OBJECT_REVISIONS_TABLE,
- BIND=ADDRESSBOOK_HOME_BIND_TABLE)
-
-
-
class SchemaBroken(Exception):
"""
The schema is broken and cannot be translated.
Modified: CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/test/test_sql.py
===================================================================
--- CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/test/test_sql.py 2013-03-05 19:44:04 UTC (rev 10848)
+++ CalendarServer/branches/users/gaya/sharedgroups/txdav/common/datastore/test/test_sql.py 2013-03-05 19:48:27 UTC (rev 10849)
@@ -26,10 +26,9 @@
from twisted.trial.unittest import TestCase
from twisted.internet.defer import Deferred
-from txdav.common.datastore.sql import log, CommonStoreTransactionMonitor,\
+from txdav.common.datastore.sql import log, CommonStoreTransactionMonitor, \
CommonHome, CommonHomeChild, ECALENDARTYPE
-from txdav.common.datastore.sql_tables import schema, CALENDAR_BIND_TABLE,\
- CALENDAR_OBJECT_REVISIONS_TABLE
+from txdav.common.datastore.sql_tables import schema
from txdav.common.datastore.test.util import CommonCommonTests, buildStore
from txdav.common.icommondatastore import AllRetriesFailed
from twext.enterprise.dal.syntax import Insert
@@ -61,7 +60,7 @@
"""
txn.execSQL works with all logging options on.
"""
-
+
# Patch config to turn on logging then rebuild the store
self.patch(self._sqlStore, "logLabels", True)
self.patch(self._sqlStore, "logStats", True)
@@ -70,7 +69,7 @@
txn = self.transactionUnderTest()
cs = schema.CALENDARSERVER
version = (yield Select(
- [cs.VALUE,],
+ [cs.VALUE, ],
From=cs,
Where=cs.NAME == 'VERSION',
).on(txn))
@@ -82,20 +81,20 @@
"""
CommonStoreTransactionMonitor logs waiting transactions.
"""
-
+
c = Clock()
self.patch(CommonStoreTransactionMonitor, "callLater", c.callLater)
# Patch config to turn on log waits then rebuild the store
self.patch(self._sqlStore, "logTransactionWaits", 1)
-
+
ctr = [0]
def counter(_ignore):
ctr[0] += 1
self.patch(log, "error", counter)
- txn = self.transactionUnderTest()
-
+ txn = self.transactionUnderTest()
+
c.advance(2)
self.assertNotEqual(ctr[0], 0)
txn.abort()
@@ -105,13 +104,13 @@
"""
CommonStoreTransactionMonitor terminates long transactions.
"""
-
+
c = Clock()
self.patch(CommonStoreTransactionMonitor, "callLater", c.callLater)
# Patch config to turn on transaction timeouts then rebuild the store
self.patch(self._sqlStore, "timeoutTransactions", 1)
-
+
ctr = [0]
def counter(_ignore):
ctr[0] += 1
@@ -128,14 +127,14 @@
"""
CommonStoreTransactionMonitor logs waiting transactions and terminates long transactions.
"""
-
+
c = Clock()
self.patch(CommonStoreTransactionMonitor, "callLater", c.callLater)
# Patch config to turn on log waits then rebuild the store
self.patch(self._sqlStore, "logTransactionWaits", 1)
self.patch(self._sqlStore, "timeoutTransactions", 2)
-
+
ctr = [0, 0]
def counter(logStr):
if "wait" in logStr:
@@ -145,7 +144,7 @@
self.patch(log, "error", counter)
txn = self.transactionUnderTest()
-
+
c.advance(2)
self.assertNotEqual(ctr[0], 0)
self.assertNotEqual(ctr[1], 0)
@@ -156,7 +155,7 @@
"""
txn.subtransaction runs loop once.
"""
-
+
txn = self.transactionUnderTest()
ctr = [0]
@@ -164,11 +163,11 @@
ctr[0] += 1
cs = schema.CALENDARSERVER
return Select(
- [cs.VALUE,],
+ [cs.VALUE, ],
From=cs,
Where=cs.NAME == 'VERSION',
).on(subtxn)
-
+
(yield txn.subtransaction(_test, retries=0))[0][0]
self.assertEqual(ctr[0], 1)
@@ -178,7 +177,7 @@
"""
txn.subtransaction runs loop twice when one failure.
"""
-
+
txn = self.transactionUnderTest()
ctr = [0]
@@ -188,11 +187,11 @@
raise ValueError
cs = schema.CALENDARSERVER
return Select(
- [cs.VALUE,],
+ [cs.VALUE, ],
From=cs,
Where=cs.NAME == 'VERSION',
).on(subtxn)
-
+
(yield txn.subtransaction(_test, retries=1))[0][0]
self.assertEqual(ctr[0], 2)
@@ -202,7 +201,7 @@
"""
txn.subtransaction runs loop once when one failure and no retries.
"""
-
+
txn = self.transactionUnderTest()
ctr = [0]
@@ -211,11 +210,11 @@
raise ValueError
cs = schema.CALENDARSERVER
return Select(
- [cs.VALUE,],
+ [cs.VALUE, ],
From=cs,
Where=cs.NAME == 'VERSION',
).on(subtxn)
-
+
try:
(yield txn.subtransaction(_test, retries=0))[0][0]
except AllRetriesFailed:
@@ -231,7 +230,7 @@
txn.subtransaction runs loop three times when all fail and two retries
requested.
"""
-
+
txn = self.transactionUnderTest()
ctr = [0]
@@ -240,11 +239,11 @@
raise ValueError
cs = schema.CALENDARSERVER
return Select(
- [cs.VALUE,],
+ [cs.VALUE, ],
From=cs,
Where=cs.NAME == 'VERSION',
).on(subtxn)
-
+
try:
(yield txn.subtransaction(_test, retries=2))[0][0]
except AllRetriesFailed:
@@ -286,26 +285,23 @@
"""
CommonHomeChild._changeRevision actions.
"""
-
+
class TestCommonHome(CommonHome):
- _bindTable = CALENDAR_BIND_TABLE
- _revisionsTable = CALENDAR_OBJECT_REVISIONS_TABLE
-
+ pass
+
class TestCommonHomeChild(CommonHomeChild):
_homeChildSchema = schema.CALENDAR
_homeChildMetaDataSchema = schema.CALENDAR_METADATA
_bindSchema = schema.CALENDAR_BIND
_revisionsSchema = schema.CALENDAR_OBJECT_REVISIONS
- _bindTable = CALENDAR_BIND_TABLE
- _revisionsTable = CALENDAR_OBJECT_REVISIONS_TABLE
-
+
def resourceType(self):
return davxml.ResourceType.calendar
-
+
txn = self.transactionUnderTest()
home = yield txn.homeWithUID(ECALENDARTYPE, "uid", create=True)
homeChild = yield TestCommonHomeChild.create(home, "B")
-
+
# insert test
token = yield homeChild.syncToken()
yield homeChild._changeRevision("insert", "C")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130305/0c992020/attachment-0001.html>
More information about the calendarserver-changes
mailing list