[CalendarServer-changes] [11053] CalendarServer/branches/users/glyph/sharedgroups-2

source_changes at macosforge.org source_changes at macosforge.org
Tue Apr 16 15:20:28 PDT 2013


Revision: 11053
          http://trac.calendarserver.org//changeset/11053
Author:   glyph at apple.com
Date:     2013-04-16 15:20:28 -0700 (Tue, 16 Apr 2013)
Log Message:
-----------
Up to 11000.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/method/put_addressbook_common.py
    CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/method/put_common.py
    CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/scheduling/caldav/delivery.py
    CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/scheduling/caldav/resource.py
    CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/scheduling/implicit.py
    CalendarServer/branches/users/glyph/sharedgroups-2/txdav/base/datastore/dbapiclient.py
    CalendarServer/branches/users/glyph/sharedgroups-2/txdav/common/datastore/sql_schema/old/oracle-dialect/v14.sql
    CalendarServer/branches/users/glyph/sharedgroups-2/txdav/common/datastore/sql_schema/old/oracle-dialect/v15.sql
    CalendarServer/branches/users/glyph/sharedgroups-2/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_13_to_14.sql

Property Changed:
----------------
    CalendarServer/branches/users/glyph/sharedgroups-2/


Property changes on: CalendarServer/branches/users/glyph/sharedgroups-2
___________________________________________________________________
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/trunk:9885-10990
   + /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:9885-11000

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/method/put_addressbook_common.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/method/put_addressbook_common.py	2013-04-16 22:19:46 UTC (rev 11052)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/method/put_addressbook_common.py	2013-04-16 22:20:28 UTC (rev 11053)
@@ -20,28 +20,29 @@
 
 __all__ = ["StoreAddressObjectResource"]
 
-import types
-
-from twisted.internet import reactor
-
-from txdav.common.icommondatastore import ReservationError
-
-from twisted.internet.defer import Deferred, inlineCallbacks
-from twisted.internet.defer import returnValue
+from twext.python.log import Logger
 from twext.web2 import responsecode
-from txdav.xml import element as davxml
 from twext.web2.dav.http import ErrorResponse
 from twext.web2.dav.util import joinURL, parentForURL
 from twext.web2.http import HTTPError
 from twext.web2.http import StatusResponse
 from twext.web2.stream import MemoryStream
 
+from twisted.internet import reactor
+from twisted.internet.defer import Deferred, inlineCallbacks
+from twisted.internet.defer import returnValue
+from twisted.python.failure import Failure
+
+from twistedcaldav import customxml
+from twistedcaldav.carddavxml import NoUIDConflict, carddav_namespace
 from twistedcaldav.config import config
-from twistedcaldav.carddavxml import NoUIDConflict, carddav_namespace
-from twistedcaldav import customxml
 from twistedcaldav.vcard import Component
-from twext.python.log import Logger
 
+from txdav.common.icommondatastore import ReservationError
+from txdav.xml import element as davxml
+
+import types
+
 log = Logger()
 
 class StoreAddressObjectResource(object):
@@ -485,12 +486,18 @@
 
             returnValue(response)
 
-        except Exception, err:
+        except Exception:
 
+            # Grab the current exception state here so we can use it in a re-raise - we need this because
+            # an inlineCallback might be called and that raises an exception when it returns, wiping out the
+            # original exception "context".
+            ex = Failure()
+
             if reservation:
                 yield reservation.unreserve()
 
-            raise err
+            # Return the original failure (exception) state
+            ex.raiseException()
 
 
     @inlineCallbacks
@@ -576,9 +583,15 @@
 
             returnValue(response)
 
-        except Exception, err:
+        except Exception:
 
+            # Grab the current exception state here so we can use it in a re-raise - we need this because
+            # an inlineCallback might be called and that raises an exception when it returns, wiping out the
+            # original exception "context".
+            ex = Failure()
+
             if reservation:
                 yield reservation.unreserve()
 
-            raise err
+            # Return the original failure (exception) state
+            ex.raiseException()

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/method/put_common.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/method/put_common.py	2013-04-16 22:19:46 UTC (rev 11052)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/method/put_common.py	2013-04-16 22:20:28 UTC (rev 11053)
@@ -21,42 +21,41 @@
 
 __all__ = ["StoreCalendarObjectResource"]
 
-import types
-import uuid
-from urlparse import urlparse, urlunparse
-
-from twisted.internet import reactor
-from twisted.internet.defer import Deferred, inlineCallbacks, succeed
-from twisted.internet.defer import returnValue
-from twisted.python import hashlib
-
+from twext.python.log import Logger
+from twext.web2 import responsecode
+from twext.web2.dav.http import ErrorResponse
 from twext.web2.dav.util import joinURL, parentForURL
-from twext.web2 import responsecode
-from txdav.xml import element as davxml
-
 from twext.web2.http import HTTPError
 from twext.web2.http import StatusResponse
 from twext.web2.iweb import IResponse
 from twext.web2.stream import MemoryStream
 
-from twext.python.log import Logger
-from twext.web2.dav.http import ErrorResponse
+from twisted.internet import reactor
+from twisted.internet.defer import Deferred, inlineCallbacks, succeed
+from twisted.internet.defer import returnValue
+from twisted.python import hashlib
+from twisted.python.failure import Failure
 
-from txdav.caldav.icalendarstore import AttachmentStoreValidManagedID
-from txdav.common.icommondatastore import ReservationError
-
+from twistedcaldav import customxml
+from twistedcaldav.caldavxml import caldav_namespace, NoUIDConflict, MaxInstances, MaxAttendeesPerInstance
 from twistedcaldav.config import config
-from twistedcaldav.caldavxml import caldav_namespace, NoUIDConflict, MaxInstances, MaxAttendeesPerInstance
-from twistedcaldav import customxml
 from twistedcaldav.customxml import calendarserver_namespace
 from twistedcaldav.datafilters.peruserdata import PerUserDataFilter
-
 from twistedcaldav.ical import Component, Property
 from twistedcaldav.instance import TooManyInstancesError, \
     InvalidOverriddenInstanceError
 from twistedcaldav.memcachelock import MemcacheLock, MemcacheLockTimeoutError
 from twistedcaldav.scheduling.implicit import ImplicitScheduler
 
+from txdav.caldav.icalendarstore import AttachmentStoreValidManagedID
+from txdav.common.icommondatastore import ReservationError
+from txdav.xml import element as davxml
+
+from urlparse import urlparse, urlunparse
+
+import types
+import uuid
+
 log = Logger()
 
 class StoreCalendarObjectResource(object):
@@ -1039,11 +1038,14 @@
                 # Cannot do implicit in sharee's shared calendar
                 isShareeResource = self.destinationparent.isShareeResource()
                 if isShareeResource:
-                    raise HTTPError(ErrorResponse(
-                        responsecode.FORBIDDEN,
-                        (calendarserver_namespace, "sharee-privilege-needed",),
-                        description="Sharee's cannot schedule"
-                    ))
+                    scheduler.setSchedulingNotAllowed(
+                        HTTPError,
+                        ErrorResponse(
+                            responsecode.FORBIDDEN,
+                            (calendarserver_namespace, "sharee-privilege-needed",),
+                            description="Sharee's cannot schedule",
+                        ),
+                    )
 
                 new_calendar = (yield scheduler.doImplicitScheduling(self.schedule_tag_match))
                 if new_calendar:
@@ -1334,6 +1336,11 @@
 
         except Exception, err:
 
+            # Grab the current exception state here so we can use it in a re-raise - we need this because
+            # an inlineCallback might be called and that raises an exception when it returns, wiping out the
+            # original exception "context".
+            ex = Failure()
+
             if reservation:
                 yield reservation.unreserve()
 
@@ -1356,7 +1363,8 @@
                     "Invalid Managed-ID parameter in calendar data",
                 ))
             else:
-                raise err
+                # Return the original failure (exception) state
+                ex.raiseException()
 
 
     @inlineCallbacks
@@ -1452,6 +1460,11 @@
 
         except Exception, err:
 
+            # Grab the current exception state here so we can use it in a re-raise - we need this because
+            # an inlineCallback might be called and that raises an exception when it returns, wiping out the
+            # original exception "context".
+            ex = Failure()
+
             if reservation:
                 yield reservation.unreserve()
 
@@ -1474,4 +1487,5 @@
                     "Invalid Managed-ID parameter in calendar data",
                 ))
             else:
-                raise err
+                # Return the original failure (exception) state
+                ex.raiseException()

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/scheduling/caldav/delivery.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/scheduling/caldav/delivery.py	2013-04-16 22:19:46 UTC (rev 11052)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/scheduling/caldav/delivery.py	2013-04-16 22:20:28 UTC (rev 11053)
@@ -114,6 +114,8 @@
                     yield recipient.inbox.checkPrivileges(self.scheduler.request, (caldavxml.ScheduleDeliver(),), principal=organizerPrincipal)
                 except AccessDeniedError:
                     log.err("Could not access Inbox for recipient: %s" % (recipient.cuaddr,))
+                    if log.willLogAtLevel("debug"):
+                        log.debug("Bare Exception: %s" % (Failure().getTraceback(),))
                     err = HTTPError(ErrorResponse(
                         responsecode.NOT_FOUND,
                         (caldav_namespace, "recipient-permissions"),
@@ -164,6 +166,8 @@
             ))
         except ImplicitProcessorException, e:
             log.err("Could not store data in Inbox : %s" % (recipient.inbox,))
+            if log.willLogAtLevel("debug"):
+                log.debug("%s: %s" % (e, Failure().getTraceback(),))
             err = HTTPError(ErrorResponse(
                 responsecode.FORBIDDEN,
                 (caldav_namespace, "recipient-permissions"),
@@ -189,6 +193,8 @@
             except:
                 # FIXME: Bare except
                 log.err("Could not store data in Inbox : %s" % (recipient.inbox,))
+                if log.willLogAtLevel("debug"):
+                    log.debug("Bare Exception: %s" % (Failure().getTraceback(),))
                 err = HTTPError(ErrorResponse(
                     responsecode.FORBIDDEN,
                     (caldav_namespace, "recipient-permissions"),
@@ -230,6 +236,8 @@
             ))
         except:
             log.err("Could not determine free busy information: %s" % (recipient.cuaddr,))
+            if log.willLogAtLevel("debug"):
+                log.debug("Bare Exception: %s" % (Failure().getTraceback(),))
             err = HTTPError(ErrorResponse(
                 responsecode.FORBIDDEN,
                 (caldav_namespace, "recipient-permissions"),

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/scheduling/caldav/resource.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/scheduling/caldav/resource.py	2013-04-16 22:19:46 UTC (rev 11052)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/scheduling/caldav/resource.py	2013-04-16 22:20:28 UTC (rev 11053)
@@ -40,6 +40,11 @@
 from twistedcaldav.caldavxml import caldav_namespace, Opaque, \
     CalendarFreeBusySet, ScheduleCalendarTransp
 from twistedcaldav.config import config
+# _schedulePrivilegeSet implicitly depends on config being initilialized. The
+# following line is wrong because _schedulePrivilegeSet won't actually use the
+# config file, it will pick up stdconfig whenver it is imported, so this works
+# around that for now.
+__import__("twistedcaldav.stdconfig") # FIXME
 from twistedcaldav.customxml import calendarserver_namespace
 from twistedcaldav.ical import allowedComponents
 from twistedcaldav.resource import CalDAVResource

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/scheduling/implicit.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/scheduling/implicit.py	2013-04-16 22:19:46 UTC (rev 11052)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/twistedcaldav/scheduling/implicit.py	2013-04-16 22:20:28 UTC (rev 11053)
@@ -35,6 +35,8 @@
 from twistedcaldav.scheduling.utils import getCalendarObjectForPrincipals
 from twistedcaldav.config import config
 
+import collections
+
 __all__ = [
     "ImplicitScheduler",
 ]
@@ -57,8 +59,34 @@
     def __init__(self):
 
         self.return_status = ImplicitScheduler.STATUS_OK
+        self.allowed_to_schedule = True
 
+    NotAllowedExceptionDetails = collections.namedtuple("NotAllowedExceptionDetails", ("type", "args", "kwargs",))
 
+    def setSchedulingNotAllowed(self, ex, *ex_args, **ex_kwargs):
+        """
+        Set indicator that scheduling is not actually allowed. Pass in exception details to raise.
+
+        @param ex: the exception class to raise
+        @type ex: C{class}
+        @param ex_args: the list of arguments for the exception
+        @type ex_args: C{list}
+        """
+
+        self.not_allowed = ImplicitScheduler.NotAllowedExceptionDetails(ex, ex_args, ex_kwargs)
+        self.allowed_to_schedule = False
+
+
+    def testSchedulingAllowed(self):
+        """
+        Called to raise an exception if scheduling is not allowed. This method should be called
+        any time a valid scheduling operation needs to occur.
+        """
+
+        if not self.allowed_to_schedule:
+            raise self.not_allowed.type(*self.not_allowed.args, **self.not_allowed.kwargs)
+
+
     @inlineCallbacks
     def testImplicitSchedulingPUT(self, request, resource, resource_uri, calendar, internal_request=False):
 
@@ -545,10 +573,6 @@
     @inlineCallbacks
     def doImplicitOrganizer(self):
 
-        # Do access control
-        if not self.internal_request:
-            yield self.doAccessControl(self.organizerPrincipal, True)
-
         self.oldcalendar = None
         self.changed_rids = None
         self.cancelledAttendees = ()
@@ -933,6 +957,13 @@
     @inlineCallbacks
     def scheduleWithAttendees(self):
 
+        # First make sure we are allowed to schedule
+        self.testSchedulingAllowed()
+
+        # Do access control
+        if not self.internal_request:
+            yield self.doAccessControl(self.organizerPrincipal, True)
+
         # First process cancelled attendees
         total = (yield self.processCancels())
 
@@ -1052,10 +1083,6 @@
     @inlineCallbacks
     def doImplicitAttendee(self):
 
-        # Do access control
-        if not self.internal_request:
-            yield self.doAccessControl(self.attendeePrincipal, False)
-
         # Check SCHEDULE-AGENT
         doScheduling = self.checkOrganizerScheduleAgent()
 
@@ -1283,8 +1310,16 @@
         return differ.attendeeMerge(self.attendee)
 
 
+    @inlineCallbacks
     def scheduleWithOrganizer(self, changedRids=None):
 
+        # First make sure we are allowed to schedule
+        self.testSchedulingAllowed()
+
+        # Do access control
+        if not self.internal_request:
+            yield self.doAccessControl(self.attendeePrincipal, False)
+
         if not hasattr(self.request, "extendedLogItems"):
             self.request.extendedLogItems = {}
         self.request.extendedLogItems["itip.reply"] = "reply"
@@ -1292,11 +1327,19 @@
         itipmsg = iTipGenerator.generateAttendeeReply(self.calendar, self.attendee, changedRids=changedRids)
 
         # Send scheduling message
-        return self.sendToOrganizer("REPLY", itipmsg)
+        yield self.sendToOrganizer("REPLY", itipmsg)
 
 
+    @inlineCallbacks
     def scheduleCancelWithOrganizer(self):
 
+        # First make sure we are allowed to schedule
+        self.testSchedulingAllowed()
+
+        # Do access control
+        if not self.internal_request:
+            yield self.doAccessControl(self.attendeePrincipal, False)
+
         if not hasattr(self.request, "extendedLogItems"):
             self.request.extendedLogItems = {}
         self.request.extendedLogItems["itip.reply"] = "cancel"
@@ -1304,7 +1347,7 @@
         itipmsg = iTipGenerator.generateAttendeeReply(self.calendar, self.attendee, force_decline=True)
 
         # Send scheduling message
-        return self.sendToOrganizer("CANCEL", itipmsg)
+        yield self.sendToOrganizer("CANCEL", itipmsg)
 
 
     def sendToOrganizer(self, action, itipmsg):

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/txdav/base/datastore/dbapiclient.py
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/txdav/base/datastore/dbapiclient.py	2013-04-16 22:19:46 UTC (rev 11052)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/txdav/base/datastore/dbapiclient.py	2013-04-16 22:20:28 UTC (rev 11053)
@@ -39,7 +39,7 @@
     # however, process-global; after the first call to connect(), all
     # subsequent connections inherit this encoding even if the environment
     # variable changes.) -glyph
-    os.environ['NLS_LANG'] = '.UTF8'
+    os.environ['NLS_LANG'] = '.AL32UTF8'
     import cx_Oracle
 except ImportError:
     cx_Oracle = None

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/txdav/common/datastore/sql_schema/old/oracle-dialect/v14.sql
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/txdav/common/datastore/sql_schema/old/oracle-dialect/v14.sql	2013-04-16 22:19:46 UTC (rev 11052)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/txdav/common/datastore/sql_schema/old/oracle-dialect/v14.sql	2013-04-16 22:20:28 UTC (rev 11053)
@@ -54,7 +54,7 @@
 create table CALENDAR_BIND (
     "CALENDAR_HOME_RESOURCE_ID" integer not null references CALENDAR_HOME,
     "CALENDAR_RESOURCE_ID" integer not null references CALENDAR on delete cascade,
-    "CALENDAR_RESOURCE_NAME" nvarchar2(255) not null,
+    "CALENDAR_RESOURCE_NAME" nvarchar2(255),
     "BIND_MODE" integer not null,
     "BIND_STATUS" integer not null,
     "MESSAGE" nclob, 
@@ -203,7 +203,7 @@
 create table ADDRESSBOOK_BIND (
     "ADDRESSBOOK_HOME_RESOURCE_ID" integer not null references ADDRESSBOOK_HOME,
     "ADDRESSBOOK_RESOURCE_ID" integer not null references ADDRESSBOOK on delete cascade,
-    "ADDRESSBOOK_RESOURCE_NAME" nvarchar2(255) not null,
+    "ADDRESSBOOK_RESOURCE_NAME" nvarchar2(255),
     "BIND_MODE" integer not null,
     "BIND_STATUS" integer not null,
     "MESSAGE" nclob, 
@@ -268,7 +268,6 @@
 insert into CALENDARSERVER (NAME, VALUE) values ('VERSION', '14');
 insert into CALENDARSERVER (NAME, VALUE) values ('CALENDAR-DATAVERSION', '3');
 insert into CALENDARSERVER (NAME, VALUE) values ('ADDRESSBOOK-DATAVERSION', '1');
-
 create index NOTIFICATION_NOTIFICA_f891f5f9 on NOTIFICATION (
     NOTIFICATION_HOME_RESOURCE_ID
 );

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/txdav/common/datastore/sql_schema/old/oracle-dialect/v15.sql
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/txdav/common/datastore/sql_schema/old/oracle-dialect/v15.sql	2013-04-16 22:19:46 UTC (rev 11052)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/txdav/common/datastore/sql_schema/old/oracle-dialect/v15.sql	2013-04-16 22:20:28 UTC (rev 11053)
@@ -58,7 +58,7 @@
 create table CALENDAR_BIND (
     "CALENDAR_HOME_RESOURCE_ID" integer not null references CALENDAR_HOME,
     "CALENDAR_RESOURCE_ID" integer not null references CALENDAR on delete cascade,
-    "CALENDAR_RESOURCE_NAME" nvarchar2(255) not null,
+    "CALENDAR_RESOURCE_NAME" nvarchar2(255),
     "BIND_MODE" integer not null,
     "BIND_STATUS" integer not null,
     "MESSAGE" nclob, 
@@ -207,7 +207,7 @@
 create table ADDRESSBOOK_BIND (
     "ADDRESSBOOK_HOME_RESOURCE_ID" integer not null references ADDRESSBOOK_HOME,
     "ADDRESSBOOK_RESOURCE_ID" integer not null references ADDRESSBOOK on delete cascade,
-    "ADDRESSBOOK_RESOURCE_NAME" nvarchar2(255) not null,
+    "ADDRESSBOOK_RESOURCE_NAME" nvarchar2(255),
     "BIND_MODE" integer not null,
     "BIND_STATUS" integer not null,
     "MESSAGE" nclob, 
@@ -272,7 +272,6 @@
 insert into CALENDARSERVER (NAME, VALUE) values ('VERSION', '15');
 insert into CALENDARSERVER (NAME, VALUE) values ('CALENDAR-DATAVERSION', '3');
 insert into CALENDARSERVER (NAME, VALUE) values ('ADDRESSBOOK-DATAVERSION', '1');
-
 create index NOTIFICATION_NOTIFICA_f891f5f9 on NOTIFICATION (
     NOTIFICATION_HOME_RESOURCE_ID
 );

Modified: CalendarServer/branches/users/glyph/sharedgroups-2/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_13_to_14.sql
===================================================================
--- CalendarServer/branches/users/glyph/sharedgroups-2/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_13_to_14.sql	2013-04-16 22:19:46 UTC (rev 11052)
+++ CalendarServer/branches/users/glyph/sharedgroups-2/txdav/common/datastore/sql_schema/upgrades/oracle-dialect/upgrade_from_13_to_14.sql	2013-04-16 22:20:28 UTC (rev 11053)
@@ -26,15 +26,11 @@
  drop column SEEN_BY_OWNER;
 alter table CALENDAR_BIND
  drop column SEEN_BY_SHAREE;
-alter table CALENDAR_BIND
- modify (CALENDAR_RESOURCE_NAME not null);
  
 alter table ADDRESSBOOK_BIND
  drop column SEEN_BY_OWNER;
 alter table ADDRESSBOOK_BIND
  drop column SEEN_BY_SHAREE;
-alter table ADDRESSBOOK_BIND
- modify (ADDRESSBOOK_RESOURCE_NAME not null);
 
 -- Now update the version
 -- No data upgrades
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130416/655eaf9e/attachment-0001.html>


More information about the calendarserver-changes mailing list