[CalendarServer-changes] [10993] CalendarServer/trunk/twistedcaldav/method
source_changes at macosforge.org
source_changes at macosforge.org
Wed Apr 3 13:21:07 PDT 2013
Revision: 10993
http://trac.calendarserver.org//changeset/10993
Author: cdaboo at apple.com
Date: 2013-04-03 13:21:07 -0700 (Wed, 03 Apr 2013)
Log Message:
-----------
Re-do traceback preservation changes to use Failure().
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/method/put_addressbook_common.py
CalendarServer/trunk/twistedcaldav/method/put_common.py
Modified: CalendarServer/trunk/twistedcaldav/method/put_addressbook_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/put_addressbook_common.py 2013-04-03 19:19:55 UTC (rev 10992)
+++ CalendarServer/trunk/twistedcaldav/method/put_addressbook_common.py 2013-04-03 20:21:07 UTC (rev 10993)
@@ -20,29 +20,29 @@
__all__ = ["StoreAddressObjectResource"]
-import sys
-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):
@@ -491,13 +491,13 @@
# 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 = sys.exc_info()
+ ex = Failure()
if reservation:
yield reservation.unreserve()
- # Re-raise using original exception state
- raise ex[0], ex[1], ex[2]
+ # Return the original failure (exception) state
+ ex.raiseException()
@inlineCallbacks
@@ -588,10 +588,10 @@
# 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 = sys.exc_info()
+ ex = Failure()
if reservation:
yield reservation.unreserve()
- # Re-raise using original exception state
- raise ex[0], ex[1], ex[2]
+ # Return the original failure (exception) state
+ ex.raiseException()
Modified: CalendarServer/trunk/twistedcaldav/method/put_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/put_common.py 2013-04-03 19:19:55 UTC (rev 10992)
+++ CalendarServer/trunk/twistedcaldav/method/put_common.py 2013-04-03 20:21:07 UTC (rev 10993)
@@ -21,43 +21,41 @@
__all__ = ["StoreCalendarObjectResource"]
-import sys
-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.web2.dav.util import joinURL, parentForURL
+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.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.config import config
-from twistedcaldav.caldavxml import caldav_namespace, NoUIDConflict, MaxInstances, MaxAttendeesPerInstance
from twistedcaldav import customxml
+from twistedcaldav.caldavxml import caldav_namespace, NoUIDConflict, MaxInstances, MaxAttendeesPerInstance
+from twistedcaldav.config import config
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):
@@ -1338,7 +1336,7 @@
# 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 = sys.exc_info()
+ ex = Failure()
if reservation:
yield reservation.unreserve()
@@ -1362,8 +1360,8 @@
"Invalid Managed-ID parameter in calendar data",
))
else:
- # Re-raise using original exception state
- raise ex[0], ex[1], ex[2]
+ # Return the original failure (exception) state
+ ex.raiseException()
@inlineCallbacks
@@ -1462,7 +1460,7 @@
# 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 = sys.exc_info()
+ ex = Failure()
if reservation:
yield reservation.unreserve()
@@ -1486,5 +1484,5 @@
"Invalid Managed-ID parameter in calendar data",
))
else:
- # Re-raise using original exception state
- raise ex[0], ex[1], ex[2]
+ # Return the original failure (exception) state
+ ex.raiseException()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130403/d3e45598/attachment-0001.html>
More information about the calendarserver-changes
mailing list