[CalendarServer-changes] [10873] CalendarServer/branches/users/sagen/testing
source_changes at macosforge.org
source_changes at macosforge.org
Fri Mar 8 10:13:06 PST 2013
Revision: 10873
http://trac.calendarserver.org//changeset/10873
Author: sagen at apple.com
Date: 2013-03-08 10:13:06 -0800 (Fri, 08 Mar 2013)
Log Message:
-----------
Pull up changes from trunk
Modified Paths:
--------------
CalendarServer/branches/users/sagen/testing/calendarserver/tap/util.py
CalendarServer/branches/users/sagen/testing/conf/caldavd-apple.plist
CalendarServer/branches/users/sagen/testing/twext/internet/decorate.py
CalendarServer/branches/users/sagen/testing/twistedcaldav/caldavxml.py
CalendarServer/branches/users/sagen/testing/twistedcaldav/ical.py
CalendarServer/branches/users/sagen/testing/twistedcaldav/scheduling/caldav/delivery.py
CalendarServer/branches/users/sagen/testing/twistedcaldav/scheduling/implicit.py
CalendarServer/branches/users/sagen/testing/twistedcaldav/stdconfig.py
CalendarServer/branches/users/sagen/testing/txdav/base/datastore/subpostgres.py
CalendarServer/branches/users/sagen/testing/txdav/caldav/datastore/file.py
CalendarServer/branches/users/sagen/testing/txdav/caldav/datastore/sql.py
CalendarServer/branches/users/sagen/testing/txdav/common/datastore/sql.py
Property Changed:
----------------
CalendarServer/branches/users/sagen/testing/
Property changes on: CalendarServer/branches/users/sagen/testing
___________________________________________________________________
Modified: svn:mergeinfo
- /CalendarServer/branches/config-separation:4379-4443
/CalendarServer/branches/egg-info-351:4589-4625
/CalendarServer/branches/generic-sqlstore:6167-6191
/CalendarServer/branches/new-store:5594-5934
/CalendarServer/branches/new-store-no-caldavfile:5911-5935
/CalendarServer/branches/new-store-no-caldavfile-2:5936-5981
/CalendarServer/branches/release/CalendarServer-4.3-dev:10180-10190,10192
/CalendarServer/branches/users/cdaboo/batchupload-6699:6700-7198
/CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692:5693-5702
/CalendarServer/branches/users/cdaboo/component-set-fixes:8130-8346
/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627:3628-3644
/CalendarServer/branches/users/cdaboo/implicituidrace:8137-8141
/CalendarServer/branches/users/cdaboo/ischedule-dkim:9747-9979
/CalendarServer/branches/users/cdaboo/managed-attachments:9985-10145
/CalendarServer/branches/users/cdaboo/more-sharing-5591:5592-5601
/CalendarServer/branches/users/cdaboo/partition-4464:4465-4957
/CalendarServer/branches/users/cdaboo/pods:7297-7377
/CalendarServer/branches/users/cdaboo/pycalendar:7085-7206
/CalendarServer/branches/users/cdaboo/pycard:7227-7237
/CalendarServer/branches/users/cdaboo/queued-attendee-refreshes:7740-8287
/CalendarServer/branches/users/cdaboo/relative-config-paths-5070:5071-5105
/CalendarServer/branches/users/cdaboo/shared-calendars-5187:5188-5440
/CalendarServer/branches/users/cdaboo/timezones:7443-7699
/CalendarServer/branches/users/cdaboo/txn-debugging:8730-8743
/CalendarServer/branches/users/glyph/always-abort-txn-on-error:9958-9969
/CalendarServer/branches/users/glyph/case-insensitive-uid:8772-8805
/CalendarServer/branches/users/glyph/conn-limit:6574-6577
/CalendarServer/branches/users/glyph/contacts-server-merge:4971-5080
/CalendarServer/branches/users/glyph/dalify:6932-7023
/CalendarServer/branches/users/glyph/db-reconnect:6824-6876
/CalendarServer/branches/users/glyph/deploybuild:7563-7572
/CalendarServer/branches/users/glyph/digest-auth-redux:10624-10635
/CalendarServer/branches/users/glyph/disable-quota:7718-7727
/CalendarServer/branches/users/glyph/dont-start-postgres:6592-6614
/CalendarServer/branches/users/glyph/imip-and-admin-html:7866-7984
/CalendarServer/branches/users/glyph/ipv6-client:9054-9105
/CalendarServer/branches/users/glyph/linux-tests:6893-6900
/CalendarServer/branches/users/glyph/migrate-merge:8690-8713
/CalendarServer/branches/users/glyph/misc-portability-fixes:7365-7374
/CalendarServer/branches/users/glyph/more-deferreds-6:6322-6368
/CalendarServer/branches/users/glyph/more-deferreds-7:6369-6445
/CalendarServer/branches/users/glyph/multiget-delete:8321-8330
/CalendarServer/branches/users/glyph/new-export:7444-7485
/CalendarServer/branches/users/glyph/one-home-list-api:10048-10073
/CalendarServer/branches/users/glyph/oracle:7106-7155
/CalendarServer/branches/users/glyph/oracle-nulls:7340-7351
/CalendarServer/branches/users/glyph/other-html:8062-8091
/CalendarServer/branches/users/glyph/parallel-sim:8240-8251
/CalendarServer/branches/users/glyph/parallel-upgrade:8376-8400
/CalendarServer/branches/users/glyph/parallel-upgrade_to_1:8571-8583
/CalendarServer/branches/users/glyph/q:9560-9688
/CalendarServer/branches/users/glyph/queue-locking-and-timing:10204-10289
/CalendarServer/branches/users/glyph/quota:7604-7637
/CalendarServer/branches/users/glyph/sendfdport:5388-5424
/CalendarServer/branches/users/glyph/shared-pool-fixes:8436-8443
/CalendarServer/branches/users/glyph/shared-pool-take2:8155-8174
/CalendarServer/branches/users/glyph/sharedpool:6490-6550
/CalendarServer/branches/users/glyph/sharing-api:9192-9205
/CalendarServer/branches/users/glyph/skip-lonely-vtimezones:8524-8535
/CalendarServer/branches/users/glyph/sql-store:5929-6073
/CalendarServer/branches/users/glyph/subtransactions:7248-7258
/CalendarServer/branches/users/glyph/table-alias:8651-8664
/CalendarServer/branches/users/glyph/uidexport:7673-7676
/CalendarServer/branches/users/glyph/unshare-when-access-revoked:10562-10595
/CalendarServer/branches/users/glyph/use-system-twisted:5084-5149
/CalendarServer/branches/users/glyph/uuid-normalize:9268-9296
/CalendarServer/branches/users/glyph/xattrs-from-files:7757-7769
/CalendarServer/branches/users/sagen/applepush:8126-8184
/CalendarServer/branches/users/sagen/inboxitems:7380-7381
/CalendarServer/branches/users/sagen/locations-resources:5032-5051
/CalendarServer/branches/users/sagen/locations-resources-2:5052-5061
/CalendarServer/branches/users/sagen/purge_old_events:6735-6746
/CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
/CalendarServer/branches/users/sagen/resources-2:5084-5093
/CalendarServer/branches/users/sagen/testing:10827-10851,10853-10855
/CalendarServer/branches/users/wsanchez/transations:5515-5593
+ /CalendarServer/branches/config-separation:4379-4443
/CalendarServer/branches/egg-info-351:4589-4625
/CalendarServer/branches/generic-sqlstore:6167-6191
/CalendarServer/branches/new-store:5594-5934
/CalendarServer/branches/new-store-no-caldavfile:5911-5935
/CalendarServer/branches/new-store-no-caldavfile-2:5936-5981
/CalendarServer/branches/release/CalendarServer-4.3-dev:10180-10190,10192
/CalendarServer/branches/users/cdaboo/batchupload-6699:6700-7198
/CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692:5693-5702
/CalendarServer/branches/users/cdaboo/component-set-fixes:8130-8346
/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627:3628-3644
/CalendarServer/branches/users/cdaboo/implicituidrace:8137-8141
/CalendarServer/branches/users/cdaboo/ischedule-dkim:9747-9979
/CalendarServer/branches/users/cdaboo/managed-attachments:9985-10145
/CalendarServer/branches/users/cdaboo/more-sharing-5591:5592-5601
/CalendarServer/branches/users/cdaboo/partition-4464:4465-4957
/CalendarServer/branches/users/cdaboo/pods:7297-7377
/CalendarServer/branches/users/cdaboo/pycalendar:7085-7206
/CalendarServer/branches/users/cdaboo/pycard:7227-7237
/CalendarServer/branches/users/cdaboo/queued-attendee-refreshes:7740-8287
/CalendarServer/branches/users/cdaboo/relative-config-paths-5070:5071-5105
/CalendarServer/branches/users/cdaboo/shared-calendars-5187:5188-5440
/CalendarServer/branches/users/cdaboo/timezones:7443-7699
/CalendarServer/branches/users/cdaboo/txn-debugging:8730-8743
/CalendarServer/branches/users/glyph/always-abort-txn-on-error:9958-9969
/CalendarServer/branches/users/glyph/case-insensitive-uid:8772-8805
/CalendarServer/branches/users/glyph/conn-limit:6574-6577
/CalendarServer/branches/users/glyph/contacts-server-merge:4971-5080
/CalendarServer/branches/users/glyph/dalify:6932-7023
/CalendarServer/branches/users/glyph/db-reconnect:6824-6876
/CalendarServer/branches/users/glyph/deploybuild:7563-7572
/CalendarServer/branches/users/glyph/digest-auth-redux:10624-10635
/CalendarServer/branches/users/glyph/disable-quota:7718-7727
/CalendarServer/branches/users/glyph/dont-start-postgres:6592-6614
/CalendarServer/branches/users/glyph/imip-and-admin-html:7866-7984
/CalendarServer/branches/users/glyph/ipv6-client:9054-9105
/CalendarServer/branches/users/glyph/linux-tests:6893-6900
/CalendarServer/branches/users/glyph/migrate-merge:8690-8713
/CalendarServer/branches/users/glyph/misc-portability-fixes:7365-7374
/CalendarServer/branches/users/glyph/more-deferreds-6:6322-6368
/CalendarServer/branches/users/glyph/more-deferreds-7:6369-6445
/CalendarServer/branches/users/glyph/multiget-delete:8321-8330
/CalendarServer/branches/users/glyph/new-export:7444-7485
/CalendarServer/branches/users/glyph/one-home-list-api:10048-10073
/CalendarServer/branches/users/glyph/oracle:7106-7155
/CalendarServer/branches/users/glyph/oracle-nulls:7340-7351
/CalendarServer/branches/users/glyph/other-html:8062-8091
/CalendarServer/branches/users/glyph/parallel-sim:8240-8251
/CalendarServer/branches/users/glyph/parallel-upgrade:8376-8400
/CalendarServer/branches/users/glyph/parallel-upgrade_to_1:8571-8583
/CalendarServer/branches/users/glyph/q:9560-9688
/CalendarServer/branches/users/glyph/queue-locking-and-timing:10204-10289
/CalendarServer/branches/users/glyph/quota:7604-7637
/CalendarServer/branches/users/glyph/sendfdport:5388-5424
/CalendarServer/branches/users/glyph/shared-pool-fixes:8436-8443
/CalendarServer/branches/users/glyph/shared-pool-take2:8155-8174
/CalendarServer/branches/users/glyph/sharedpool:6490-6550
/CalendarServer/branches/users/glyph/sharing-api:9192-9205
/CalendarServer/branches/users/glyph/skip-lonely-vtimezones:8524-8535
/CalendarServer/branches/users/glyph/sql-store:5929-6073
/CalendarServer/branches/users/glyph/subtransactions:7248-7258
/CalendarServer/branches/users/glyph/table-alias:8651-8664
/CalendarServer/branches/users/glyph/uidexport:7673-7676
/CalendarServer/branches/users/glyph/unshare-when-access-revoked:10562-10595
/CalendarServer/branches/users/glyph/use-system-twisted:5084-5149
/CalendarServer/branches/users/glyph/uuid-normalize:9268-9296
/CalendarServer/branches/users/glyph/xattrs-from-files:7757-7769
/CalendarServer/branches/users/sagen/applepush:8126-8184
/CalendarServer/branches/users/sagen/inboxitems:7380-7381
/CalendarServer/branches/users/sagen/locations-resources:5032-5051
/CalendarServer/branches/users/sagen/locations-resources-2:5052-5061
/CalendarServer/branches/users/sagen/purge_old_events:6735-6746
/CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
/CalendarServer/branches/users/sagen/resources-2:5084-5093
/CalendarServer/branches/users/sagen/testing:10827-10851,10853-10855
/CalendarServer/branches/users/wsanchez/transations:5515-5593
/CalendarServer/trunk:10857-10872
Modified: CalendarServer/branches/users/sagen/testing/calendarserver/tap/util.py
===================================================================
--- CalendarServer/branches/users/sagen/testing/calendarserver/tap/util.py 2013-03-08 01:35:36 UTC (rev 10872)
+++ CalendarServer/branches/users/sagen/testing/calendarserver/tap/util.py 2013-03-08 18:13:06 UTC (rev 10873)
@@ -132,7 +132,9 @@
options=config.Postgres.Options,
uid=uid, gid=gid,
spawnedDBUser=config.SpawnedDBUser,
- importFileName=config.DBImportFile
+ importFileName=config.DBImportFile,
+ pgCtl=config.Postgres.Ctl,
+ initDB=config.Postgres.Init,
)
Modified: CalendarServer/branches/users/sagen/testing/conf/caldavd-apple.plist
===================================================================
--- CalendarServer/branches/users/sagen/testing/conf/caldavd-apple.plist 2013-03-08 01:35:36 UTC (rev 10872)
+++ CalendarServer/branches/users/sagen/testing/conf/caldavd-apple.plist 2013-03-08 18:13:06 UTC (rev 10873)
@@ -101,6 +101,11 @@
<string></string>
<key>DBImportFile</key>
<string>/Library/Server/Calendar and Contacts/DataDump.sql</string>
+ <key>Postgres</key>
+ <dict>
+ <key>Ctl</key>
+ <string>xpg_ctl</string>
+ </dict>
<!-- Data root -->
<key>DataRoot</key>
Modified: CalendarServer/branches/users/sagen/testing/twext/internet/decorate.py
===================================================================
--- CalendarServer/branches/users/sagen/testing/twext/internet/decorate.py 2013-03-08 01:35:36 UTC (rev 10872)
+++ CalendarServer/branches/users/sagen/testing/twext/internet/decorate.py 2013-03-08 18:13:06 UTC (rev 10873)
@@ -27,10 +27,29 @@
from twisted.internet.defer import Deferred, succeed
+class Memoizable(object):
+ """
+ A class that stores itself in the memo dictionary.
+ """
+ def memoMe(self, key, memo):
+ """
+ Add this object to the memo dictionary in whatever fashion is appropriate.
+
+ @param key: key used for lookup
+ @type key: C{object} (typically C{str} or C{int})
+ @param memo: the dict to store to
+ @type memo: C{dict}
+ """
+ raise NotImplementedError
+
+
+
def memoizedKey(keyArgument, memoAttribute, deferredResult=True):
"""
- Decorator which memoizes the result of a method on that method's instance.
+ Decorator which memoizes the result of a method on that method's instance. If the instance is derived from
+ class Memoizable, then the memoMe method is used to store the result, otherwise it is stored directly in
+ the dict.
@param keyArgument: The name of the "key" argument.
@type keyArgument: C{str}
@@ -75,6 +94,7 @@
(argname, args, kw, argpos)
)
+
def decorate(thunk):
# cheater move to try to get the right argspec from inlineCallbacks.
# This could probably be more robust, but the 'cell_contents' thing
@@ -103,7 +123,9 @@
if isinstance(result, Deferred):
def memoResult(finalResult):
- if finalResult is not None:
+ if isinstance(finalResult, Memoizable):
+ finalResult.memoMe(key, memo)
+ elif finalResult is not None:
memo[key] = finalResult
return finalResult
result.addCallback(memoResult)
Modified: CalendarServer/branches/users/sagen/testing/twistedcaldav/caldavxml.py
===================================================================
--- CalendarServer/branches/users/sagen/testing/twistedcaldav/caldavxml.py 2013-03-08 01:35:36 UTC (rev 10872)
+++ CalendarServer/branches/users/sagen/testing/twistedcaldav/caldavxml.py 2013-03-08 18:13:06 UTC (rev 10873)
@@ -1110,21 +1110,6 @@
@registerElement
-class Originator (CalDAVElement):
- """
- A property on resources in schedule Inbox and Outbox indicating the Originator used
- for the SCHEDULE operation.
- (CalDAV-schedule, section x.x.x)
- """
- name = "originator"
- hidden = True
- protected = True
-
- allowed_children = {(dav_namespace, "href"): (0, 1)} # NB Minimum is zero because this is a property name
-
-
-
- at registerElement
class Recipient (CalDAVElement):
"""
A property on resources in schedule Inbox indicating the Recipients targeted
Modified: CalendarServer/branches/users/sagen/testing/twistedcaldav/ical.py
===================================================================
--- CalendarServer/branches/users/sagen/testing/twistedcaldav/ical.py 2013-03-08 01:35:36 UTC (rev 10872)
+++ CalendarServer/branches/users/sagen/testing/twistedcaldav/ical.py 2013-03-08 18:13:06 UTC (rev 10873)
@@ -1281,7 +1281,7 @@
is added as STATUS:CANCELLED and the EXDATE removed.
@param rid: recurrence-id value
- @type rid: L{PyCalendarDateTime}
+ @type rid: L{PyCalendarDateTime} or C{str}
@param allowCancelled: whether to allow a STATUS:CANCELLED override
@type allowCancelled: C{bool}
@@ -1296,6 +1296,9 @@
if master is None:
return None
+ if isinstance(rid, str):
+ rid = PyCalendarDateTime.parseText(rid) if rid else None
+
# TODO: Check that the recurrence-id is a valid instance
# For now we just check that there is no matching EXDATE
didCancel = False
Modified: CalendarServer/branches/users/sagen/testing/twistedcaldav/scheduling/caldav/delivery.py
===================================================================
--- CalendarServer/branches/users/sagen/testing/twistedcaldav/scheduling/caldav/delivery.py 2013-03-08 01:35:36 UTC (rev 10872)
+++ CalendarServer/branches/users/sagen/testing/twistedcaldav/scheduling/caldav/delivery.py 2013-03-08 18:13:06 UTC (rev 10873)
@@ -197,12 +197,6 @@
responses.add(recipient.cuaddr, Failure(exc_value=err), reqstatus=iTIPRequestStatus.NO_AUTHORITY)
returnValue(False)
else:
- # Store CALDAV:originator property
- child.writeDeadProperty(caldavxml.Originator(davxml.HRef(self.scheduler.originator.cuaddr)))
-
- # Store CALDAV:recipient property
- child.writeDeadProperty(caldavxml.Recipient(davxml.HRef(recipient.cuaddr)))
-
# Store CS:schedule-changes property if present
if changes:
child.writeDeadProperty(changes)
Modified: CalendarServer/branches/users/sagen/testing/twistedcaldav/scheduling/implicit.py
===================================================================
--- CalendarServer/branches/users/sagen/testing/twistedcaldav/scheduling/implicit.py 2013-03-08 01:35:36 UTC (rev 10872)
+++ CalendarServer/branches/users/sagen/testing/twistedcaldav/scheduling/implicit.py 2013-03-08 18:13:06 UTC (rev 10873)
@@ -597,6 +597,9 @@
for rid in self.needs_action_rids:
comp = self.calendar.overriddenComponent(rid)
+ if comp is None:
+ comp = self.calendar.deriveInstance(rid)
+ self.calendar.addComponent(comp)
for attendee in comp.getAllAttendeeProperties():
if attendee.hasParameter("PARTSTAT"):
Modified: CalendarServer/branches/users/sagen/testing/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/branches/users/sagen/testing/twistedcaldav/stdconfig.py 2013-03-08 01:35:36 UTC (rev 10872)
+++ CalendarServer/branches/users/sagen/testing/twistedcaldav/stdconfig.py 2013-03-08 18:13:06 UTC (rev 10873)
@@ -908,6 +908,11 @@
"Options": [
"-c standard_conforming_strings=on",
],
+ "Ctl": "pg_ctl", # Iff the DBType is '', and we're spawning postgres
+ # ourselves, where is the pg_ctl tool to spawn it with?
+ "Init": "initdb", # Iff the DBType is '', and we're spawning postgres
+ # ourselves, where is the initdb tool to create its
+ # database cluster with?
},
"QueryCaching" : {
Modified: CalendarServer/branches/users/sagen/testing/txdav/base/datastore/subpostgres.py
===================================================================
--- CalendarServer/branches/users/sagen/testing/txdav/base/datastore/subpostgres.py 2013-03-08 01:35:36 UTC (rev 10872)
+++ CalendarServer/branches/users/sagen/testing/txdav/base/datastore/subpostgres.py 2013-03-08 18:13:06 UTC (rev 10873)
@@ -166,7 +166,9 @@
testMode=False,
uid=None, gid=None,
spawnedDBUser="caldav",
- importFileName=None):
+ importFileName=None,
+ pgCtl="pg_ctl",
+ initDB="initdb"):
"""
Initialize a L{PostgresService} pointed at a data store directory.
@@ -235,8 +237,21 @@
self.schema = schema
self.monitor = None
self.openConnections = []
+ self._pgCtl = pgCtl
+ self._initdb = initDB
+ def pgCtl(self):
+ """
+ Locate the path to pg_ctl.
+ """
+ return which(self._pgCtl)[0]
+
+
+ def initdb(self):
+ return which(self._initdb)[0]
+
+
def activateDelayedShutdown(self):
"""
Call this when starting database initialization code to protect against
@@ -369,7 +384,7 @@
Start the database and initialize the subservice.
"""
monitor = _PostgresMonitor(self)
- pg_ctl = which("pg_ctl")[0]
+ pgCtl = self.pgCtl()
# check consistency of initdb and postgres?
options = []
@@ -386,9 +401,9 @@
options.extend(self.options)
reactor.spawnProcess(
- monitor, pg_ctl,
+ monitor, pgCtl,
[
- pg_ctl,
+ pgCtl,
"start",
"-l", self.logFile,
"-w",
@@ -422,7 +437,7 @@
env.update(PGDATA=clusterDir.path,
PGHOST=self.host,
PGUSER=self.spawnedDBUser)
- initdb = which("initdb")[0]
+ initdb = self.initdb()
if self.socketDir:
if not self.socketDir.isdir():
self.socketDir.createDirectory()
@@ -470,9 +485,9 @@
# database. (This also happens in command-line tools.)
if self.shouldStopDatabase:
monitor = _PostgresMonitor()
- pg_ctl = which("pg_ctl")[0]
- reactor.spawnProcess(monitor, pg_ctl,
- [pg_ctl, '-l', 'logfile', 'stop'],
+ pgCtl = self.pgCtl()
+ reactor.spawnProcess(monitor, pgCtl,
+ [pgCtl, '-l', 'logfile', 'stop'],
self.env,
uid=self.uid, gid=self.gid,
)
Modified: CalendarServer/branches/users/sagen/testing/txdav/caldav/datastore/file.py
===================================================================
--- CalendarServer/branches/users/sagen/testing/txdav/caldav/datastore/file.py 2013-03-08 01:35:36 UTC (rev 10872)
+++ CalendarServer/branches/users/sagen/testing/txdav/caldav/datastore/file.py 2013-03-08 18:13:06 UTC (rev 10873)
@@ -742,8 +742,6 @@
PropertyName.fromElement(caldavxml.ScheduleTag),
PropertyName.fromElement(customxml.TwistedScheduleMatchETags),
PropertyName.fromElement(customxml.TwistedCalendarHasPrivateCommentsProperty),
- PropertyName.fromElement(caldavxml.Originator),
- PropertyName.fromElement(caldavxml.Recipient),
PropertyName.fromElement(customxml.ScheduleChanges),
),
)
Modified: CalendarServer/branches/users/sagen/testing/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/sagen/testing/txdav/caldav/datastore/sql.py 2013-03-08 01:35:36 UTC (rev 10872)
+++ CalendarServer/branches/users/sagen/testing/txdav/caldav/datastore/sql.py 2013-03-08 18:13:06 UTC (rev 10873)
@@ -1239,11 +1239,11 @@
).on(txn)
if instanceIndexingRequired and doInstanceIndexing:
- yield self._addInstances(component, instances, truncateLowerLimit, txn)
+ yield self._addInstances(component, instances, truncateLowerLimit, isInboxItem, txn)
@inlineCallbacks
- def _addInstances(self, component, instances, truncateLowerLimit, txn):
+ def _addInstances(self, component, instances, truncateLowerLimit, isInboxItem, txn):
"""
Add the set of supplied instances to the store.
@@ -1253,6 +1253,8 @@
@type instances: L{InstanceList}
@param truncateLowerLimit: the lower limit for instances
@type truncateLowerLimit: L{PyCalendarDateTime}
+ @param isInboxItem: indicates if an inbox item
+ @type isInboxItem: C{bool}
@param txn: transaction to use
@type txn: L{Transaction}
"""
@@ -1274,14 +1276,14 @@
lowerLimitApplied = True
continue
- yield self._addInstanceDetails(component, instance.rid, start, end, floating, transp, fbtype, txn)
+ yield self._addInstanceDetails(component, instance.rid, start, end, floating, transp, fbtype, isInboxItem, txn)
# For truncated items we insert a tomb stone lower bound so that a time-range
# query with just an end bound will match
if lowerLimitApplied or instances.lowerLimit and len(instances.instances) == 0:
start = PyCalendarDateTime(1901, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
end = PyCalendarDateTime(1901, 1, 1, 1, 0, 0, tzid=PyCalendarTimezone(utc=True))
- yield self._addInstanceDetails(component, None, start, end, False, True, "UNKNOWN", txn)
+ yield self._addInstanceDetails(component, None, start, end, False, True, "UNKNOWN", isInboxItem, txn)
# Special - for unbounded recurrence we insert a value for "infinity"
# that will allow an open-ended time-range to always match it.
@@ -1290,11 +1292,11 @@
if component.isRecurringUnbounded() or instances.limit and len(instances.instances) == 0:
start = PyCalendarDateTime(2100, 1, 1, 0, 0, 0, tzid=PyCalendarTimezone(utc=True))
end = PyCalendarDateTime(2100, 1, 1, 1, 0, 0, tzid=PyCalendarTimezone(utc=True))
- yield self._addInstanceDetails(component, None, start, end, False, True, "UNKNOWN", txn)
+ yield self._addInstanceDetails(component, None, start, end, False, True, "UNKNOWN", isInboxItem, txn)
@inlineCallbacks
- def _addInstanceDetails(self, component, rid, start, end, floating, transp, fbtype, txn):
+ def _addInstanceDetails(self, component, rid, start, end, floating, transp, fbtype, isInboxItem, txn):
tr = schema.TIME_RANGE
tpy = schema.TRANSPARENCY
@@ -1308,16 +1310,19 @@
tr.FBTYPE : icalfbtype_to_indexfbtype.get(fbtype, icalfbtype_to_indexfbtype["FREE"]),
tr.TRANSPARENT : transp,
}, Return=tr.INSTANCE_ID).on(txn))[0][0]
- peruserdata = component.perUserTransparency(rid)
- for useruid, usertransp in peruserdata:
- if usertransp != transp:
- (yield Insert({
- tpy.TIME_RANGE_INSTANCE_ID : instanceid,
- tpy.USER_ID : useruid,
- tpy.TRANSPARENT : usertransp,
- }).on(txn))
+ # Don't do transparency for inbox items - we never do freebusy on inbox
+ if not isInboxItem:
+ peruserdata = component.perUserTransparency(rid)
+ for useruid, usertransp in peruserdata:
+ if usertransp != transp:
+ (yield Insert({
+ tpy.TIME_RANGE_INSTANCE_ID : instanceid,
+ tpy.USER_ID : useruid,
+ tpy.TRANSPARENT : usertransp,
+ }).on(txn))
+
@inlineCallbacks
def component(self):
"""
@@ -1966,8 +1971,6 @@
(
),
(
- PropertyName.fromElement(caldavxml.Originator),
- PropertyName.fromElement(caldavxml.Recipient),
PropertyName.fromElement(customxml.ScheduleChanges),
),
)
Modified: CalendarServer/branches/users/sagen/testing/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/sagen/testing/txdav/common/datastore/sql.py 2013-03-08 01:35:36 UTC (rev 10872)
+++ CalendarServer/branches/users/sagen/testing/txdav/common/datastore/sql.py 2013-03-08 18:13:06 UTC (rev 10873)
@@ -50,7 +50,7 @@
from txdav.base.datastore.util import QueryCacher
-from twext.internet.decorate import memoizedKey
+from twext.internet.decorate import memoizedKey, Memoizable
from txdav.caldav.icalendarstore import ICalendarTransaction, ICalendarStore
@@ -741,6 +741,7 @@
imip.ICALUID: Parameter("icaluid"),
})
+
@inlineCallbacks
def imipCreateToken(self, organizer, attendee, icaluid, token=None):
if not (organizer and attendee and icaluid):
@@ -760,17 +761,20 @@
# Lookup IMIP organizer+attendee+icaluid for token
+
@classproperty
def _selectIMIPTokenByTokenQuery(cls): #@NoSelf
imip = schema.IMIP_TOKENS
return Select([imip.ORGANIZER, imip.ATTENDEE, imip.ICALUID], From=imip,
Where=(imip.TOKEN == Parameter("token")))
+
def imipLookupByToken(self, token):
return self._selectIMIPTokenByTokenQuery.on(self, token=token)
# Lookup IMIP token for organizer+attendee+icaluid
+
@classproperty
def _selectIMIPTokenQuery(cls): #@NoSelf
imip = schema.IMIP_TOKENS
@@ -778,10 +782,12 @@
Where=(imip.ORGANIZER == Parameter("organizer")).And(
imip.ATTENDEE == Parameter("attendee")).And(
imip.ICALUID == Parameter("icaluid")))
+
+
@classproperty
def _updateIMIPTokenQuery(cls): #@NoSelf
imip = schema.IMIP_TOKENS
- return Update({imip.ACCESSED: utcNowSQL,},
+ return Update({imip.ACCESSED: utcNowSQL, },
Where=(imip.ORGANIZER == Parameter("organizer")).And(
imip.ATTENDEE == Parameter("attendee")).And(
imip.ICALUID == Parameter("icaluid")))
@@ -800,25 +806,27 @@
token = None
returnValue(token)
+
# Remove IMIP token
-
@classproperty
def _removeIMIPTokenQuery(cls): #@NoSelf
imip = schema.IMIP_TOKENS
return Delete(From=imip,
Where=(imip.TOKEN == Parameter("token")))
+
def imipRemoveToken(self, token):
return self._removeIMIPTokenQuery.on(self, token=token)
+
# Purge old IMIP tokens
-
@classproperty
def _purgeOldIMIPTokensQuery(cls): #@NoSelf
imip = schema.IMIP_TOKENS
return Delete(From=imip,
Where=(imip.ACCESSED < Parameter("olderThan")))
+
def purgeOldIMIPTokens(self, olderThan):
"""
@type olderThan: datetime
@@ -1616,6 +1624,7 @@
results = (yield self._childClass.loadAllObjects(self))
for result in results:
self._children[result.name()] = result
+ self._children[result._resourceID] = result
self._childrenLoaded = True
returnValue(results)
@@ -1628,7 +1637,7 @@
"""
if self._childrenLoaded:
- return succeed(self._children.keys())
+ return succeed([k for k in self._children.keys() if isinstance(k, str)])
else:
return self._childClass.listObjects(self)
@@ -2430,7 +2439,7 @@
-class CommonHomeChild(LoggingMixIn, FancyEqMixin, _SharedSyncLogic, HomeChildBase):
+class CommonHomeChild(LoggingMixIn, FancyEqMixin, Memoizable, _SharedSyncLogic, HomeChildBase):
"""
Common ancestor class of AddressBooks and Calendars.
"""
@@ -2483,6 +2492,19 @@
self._index = None # Derived classes need to set this
+ def memoMe(self, key, memo):
+ """
+ Add this object to the memo dictionary in whatever fashion is appropriate.
+
+ @param key: key used for lookup
+ @type key: C{object} (typically C{str} or C{int})
+ @param memo: the dict to store to
+ @type memo: C{dict}
+ """
+ memo[self._name] = self
+ memo[self._resourceID] = self
+
+
@classproperty
def _childNamesForHomeID(cls): #@NoSelf
bind = cls._bindSchema
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130308/2504ab6d/attachment-0001.html>
More information about the calendarserver-changes
mailing list