<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[12272] CalendarServer/branches/release/CalendarServer-5.2-dev</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/12272">12272</a></dd>
<dt>Author</dt> <dd>wsanchez@apple.com</dd>
<dt>Date</dt> <dd>2014-01-08 14:13:14 -0800 (Wed, 08 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Pulled u0 <a href="http://trac.calendarserver.org//changeset/12036">r12036</a> from trunk.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServerbranchesreleaseCalendarServer52devtwextenterpriselockingpy">CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/locking.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer52devtwextenterprisetesttest_lockingpy">CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/test/test_locking.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer52devtwistedcaldavstorebridgepy">CalendarServer/branches/release/CalendarServer-5.2-dev/twistedcaldav/storebridge.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer52devtwistedcaldavtesttest_wrappingpy">CalendarServer/branches/release/CalendarServer-5.2-dev/twistedcaldav/test/test_wrapping.py</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#CalendarServerbranchesreleaseCalendarServer52dev">CalendarServer/branches/release/CalendarServer-5.2-dev/</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServerbranchesreleaseCalendarServer52dev"></a>
<div class="propset"><h4>Property changes: CalendarServer/branches/release/CalendarServer-5.2-dev</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4>Modified: svn:mergeinfo</h4></div>
<span class="cx">/CalendarServer/branches/config-separation:4379-4443
</span><span class="cx">/CalendarServer/branches/egg-info-351:4589-4625
</span><span class="cx">/CalendarServer/branches/generic-sqlstore:6167-6191
</span><span class="cx">/CalendarServer/branches/new-store:5594-5934
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile:5911-5935
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile-2:5936-5981
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-4.3-dev:10180-10190,10192
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-5.1-dev:11846
</span><span class="cx">/CalendarServer/branches/users/cdaboo/batchupload-6699:6700-7198
</span><span class="cx">/CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692:5693-5702
</span><span class="cx">/CalendarServer/branches/users/cdaboo/component-set-fixes:8130-8346
</span><span class="cx">/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627:3628-3644
</span><span class="cx">/CalendarServer/branches/users/cdaboo/fix-no-ischedule:11607-11871
</span><span class="cx">/CalendarServer/branches/users/cdaboo/implicituidrace:8137-8141
</span><span class="cx">/CalendarServer/branches/users/cdaboo/ischedule-dkim:9747-9979
</span><span class="cx">/CalendarServer/branches/users/cdaboo/managed-attachments:9985-10145
</span><span class="cx">/CalendarServer/branches/users/cdaboo/more-sharing-5591:5592-5601
</span><span class="cx">/CalendarServer/branches/users/cdaboo/partition-4464:4465-4957
</span><span class="cx">/CalendarServer/branches/users/cdaboo/performance-tweaks:11824-11836
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pods:7297-7377
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycalendar:7085-7206
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycard:7227-7237
</span><span class="cx">/CalendarServer/branches/users/cdaboo/queued-attendee-refreshes:7740-8287
</span><span class="cx">/CalendarServer/branches/users/cdaboo/relative-config-paths-5070:5071-5105
</span><span class="cx">/CalendarServer/branches/users/cdaboo/shared-calendars-5187:5188-5440
</span><span class="cx">/CalendarServer/branches/users/cdaboo/store-scheduling:10876-11129
</span><span class="cx">/CalendarServer/branches/users/cdaboo/timezones:7443-7699
</span><span class="cx">/CalendarServer/branches/users/cdaboo/txn-debugging:8730-8743
</span><span class="cx">/CalendarServer/branches/users/gaya/sharedgroups-3:11088-11204
</span><span class="cx">/CalendarServer/branches/users/glyph/always-abort-txn-on-error:9958-9969
</span><span class="cx">/CalendarServer/branches/users/glyph/case-insensitive-uid:8772-8805
</span><span class="cx">/CalendarServer/branches/users/glyph/conn-limit:6574-6577
</span><span class="cx">/CalendarServer/branches/users/glyph/contacts-server-merge:4971-5080
</span><span class="cx">/CalendarServer/branches/users/glyph/dalify:6932-7023
</span><span class="cx">/CalendarServer/branches/users/glyph/db-reconnect:6824-6876
</span><span class="cx">/CalendarServer/branches/users/glyph/deploybuild:7563-7572
</span><span class="cx">/CalendarServer/branches/users/glyph/digest-auth-redux:10624-10635
</span><span class="cx">/CalendarServer/branches/users/glyph/disable-quota:7718-7727
</span><span class="cx">/CalendarServer/branches/users/glyph/dont-start-postgres:6592-6614
</span><span class="cx">/CalendarServer/branches/users/glyph/enforce-max-requests:11640-11643
</span><span class="cx">/CalendarServer/branches/users/glyph/hang-fix:11465-11491
</span><span class="cx">/CalendarServer/branches/users/glyph/imip-and-admin-html:7866-7984
</span><span class="cx">/CalendarServer/branches/users/glyph/ipv6-client:9054-9105
</span><span class="cx">/CalendarServer/branches/users/glyph/launchd-wrapper-bis:11413-11436
</span><span class="cx">/CalendarServer/branches/users/glyph/linux-tests:6893-6900
</span><span class="cx">/CalendarServer/branches/users/glyph/log-cleanups:11691-11731
</span><span class="cx">/CalendarServer/branches/users/glyph/migrate-merge:8690-8713
</span><span class="cx">/CalendarServer/branches/users/glyph/misc-portability-fixes:7365-7374
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-6:6322-6368
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-7:6369-6445
</span><span class="cx">/CalendarServer/branches/users/glyph/multiget-delete:8321-8330
</span><span class="cx">/CalendarServer/branches/users/glyph/new-export:7444-7485
</span><span class="cx">/CalendarServer/branches/users/glyph/one-home-list-api:10048-10073
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle:7106-7155
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle-nulls:7340-7351
</span><span class="cx">/CalendarServer/branches/users/glyph/other-html:8062-8091
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-sim:8240-8251
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade:8376-8400
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade_to_1:8571-8583
</span><span class="cx">/CalendarServer/branches/users/glyph/q:9560-9688
</span><span class="cx">/CalendarServer/branches/users/glyph/queue-locking-and-timing:10204-10289
</span><span class="cx">/CalendarServer/branches/users/glyph/quota:7604-7637
</span><span class="cx">/CalendarServer/branches/users/glyph/sendfdport:5388-5424
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-fixes:8436-8443
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-take2:8155-8174
</span><span class="cx">/CalendarServer/branches/users/glyph/sharedpool:6490-6550
</span><span class="cx">/CalendarServer/branches/users/glyph/sharing-api:9192-9205
</span><span class="cx">/CalendarServer/branches/users/glyph/skip-lonely-vtimezones:8524-8535
</span><span class="cx">/CalendarServer/branches/users/glyph/sql-store:5929-6073
</span><span class="cx">/CalendarServer/branches/users/glyph/start-service-start-loop:11060-11065
</span><span class="cx">/CalendarServer/branches/users/glyph/subtransactions:7248-7258
</span><span class="cx">/CalendarServer/branches/users/glyph/table-alias:8651-8664
</span><span class="cx">/CalendarServer/branches/users/glyph/uidexport:7673-7676
</span><span class="cx">/CalendarServer/branches/users/glyph/unshare-when-access-revoked:10562-10595
</span><span class="cx">/CalendarServer/branches/users/glyph/use-system-twisted:5084-5149
</span><span class="cx">/CalendarServer/branches/users/glyph/uuid-normalize:9268-9296
</span><span class="cx">/CalendarServer/branches/users/glyph/warning-cleanups:11347-11357
</span><span class="cx">/CalendarServer/branches/users/glyph/whenNotProposed:11881-11897
</span><span class="cx">/CalendarServer/branches/users/glyph/xattrs-from-files:7757-7769
</span><span class="cx">/CalendarServer/branches/users/sagen/applepush:8126-8184
</span><span class="cx">/CalendarServer/branches/users/sagen/inboxitems:7380-7381
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources:5032-5051
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources-2:5052-5061
</span><span class="cx">/CalendarServer/branches/users/sagen/purge_old_events:6735-6746
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
</span><span class="cx">/CalendarServer/branches/users/sagen/resources-2:5084-5093
</span><span class="cx">/CalendarServer/branches/users/sagen/testing:10827-10851,10853-10855
</span><span class="cx">/CalendarServer/branches/users/wsanchez/transations:5515-5593
</span><span class="cx">/CalendarServer/trunk:11898,11991,12021,12028,12031,12036,12241,12262-12263
</span><span class="cx">   + /CalDAVTester/trunk:11193-11198
</span><span class="cx">/CalendarServer/branches/config-separation:4379-4443
</span><span class="cx">/CalendarServer/branches/egg-info-351:4589-4625
</span><span class="cx">/CalendarServer/branches/generic-sqlstore:6167-6191
</span><span class="cx">/CalendarServer/branches/new-store:5594-5934
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile:5911-5935
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile-2:5936-5981
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-4.3-dev:10180-10190,10192
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-5.1-dev:11846
</span><span class="cx">/CalendarServer/branches/users/cdaboo/batchupload-6699:6700-7198
</span><span class="cx">/CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692:5693-5702
</span><span class="cx">/CalendarServer/branches/users/cdaboo/component-set-fixes:8130-8346
</span><span class="cx">/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627:3628-3644
</span><span class="cx">/CalendarServer/branches/users/cdaboo/fix-no-ischedule:11607-11871
</span><span class="cx">/CalendarServer/branches/users/cdaboo/implicituidrace:8137-8141
</span><span class="cx">/CalendarServer/branches/users/cdaboo/ischedule-dkim:9747-9979
</span><span class="cx">/CalendarServer/branches/users/cdaboo/managed-attachments:9985-10145
</span><span class="cx">/CalendarServer/branches/users/cdaboo/more-sharing-5591:5592-5601
</span><span class="cx">/CalendarServer/branches/users/cdaboo/partition-4464:4465-4957
</span><span class="cx">/CalendarServer/branches/users/cdaboo/performance-tweaks:11824-11836
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pods:7297-7377
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycalendar:7085-7206
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycard:7227-7237
</span><span class="cx">/CalendarServer/branches/users/cdaboo/queued-attendee-refreshes:7740-8287
</span><span class="cx">/CalendarServer/branches/users/cdaboo/relative-config-paths-5070:5071-5105
</span><span class="cx">/CalendarServer/branches/users/cdaboo/shared-calendars-5187:5188-5440
</span><span class="cx">/CalendarServer/branches/users/cdaboo/store-scheduling:10876-11129
</span><span class="cx">/CalendarServer/branches/users/cdaboo/timezones:7443-7699
</span><span class="cx">/CalendarServer/branches/users/cdaboo/txn-debugging:8730-8743
</span><span class="cx">/CalendarServer/branches/users/gaya/sharedgroups-3:11088-11204
</span><span class="cx">/CalendarServer/branches/users/glyph/always-abort-txn-on-error:9958-9969
</span><span class="cx">/CalendarServer/branches/users/glyph/case-insensitive-uid:8772-8805
</span><span class="cx">/CalendarServer/branches/users/glyph/conn-limit:6574-6577
</span><span class="cx">/CalendarServer/branches/users/glyph/contacts-server-merge:4971-5080
</span><span class="cx">/CalendarServer/branches/users/glyph/dalify:6932-7023
</span><span class="cx">/CalendarServer/branches/users/glyph/db-reconnect:6824-6876
</span><span class="cx">/CalendarServer/branches/users/glyph/deploybuild:7563-7572
</span><span class="cx">/CalendarServer/branches/users/glyph/digest-auth-redux:10624-10635
</span><span class="cx">/CalendarServer/branches/users/glyph/disable-quota:7718-7727
</span><span class="cx">/CalendarServer/branches/users/glyph/dont-start-postgres:6592-6614
</span><span class="cx">/CalendarServer/branches/users/glyph/enforce-max-requests:11640-11643
</span><span class="cx">/CalendarServer/branches/users/glyph/hang-fix:11465-11491
</span><span class="cx">/CalendarServer/branches/users/glyph/imip-and-admin-html:7866-7984
</span><span class="cx">/CalendarServer/branches/users/glyph/ipv6-client:9054-9105
</span><span class="cx">/CalendarServer/branches/users/glyph/launchd-wrapper-bis:11413-11436
</span><span class="cx">/CalendarServer/branches/users/glyph/linux-tests:6893-6900
</span><span class="cx">/CalendarServer/branches/users/glyph/log-cleanups:11691-11731
</span><span class="cx">/CalendarServer/branches/users/glyph/migrate-merge:8690-8713
</span><span class="cx">/CalendarServer/branches/users/glyph/misc-portability-fixes:7365-7374
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-6:6322-6368
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-7:6369-6445
</span><span class="cx">/CalendarServer/branches/users/glyph/multiget-delete:8321-8330
</span><span class="cx">/CalendarServer/branches/users/glyph/new-export:7444-7485
</span><span class="cx">/CalendarServer/branches/users/glyph/one-home-list-api:10048-10073
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle:7106-7155
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle-nulls:7340-7351
</span><span class="cx">/CalendarServer/branches/users/glyph/other-html:8062-8091
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-sim:8240-8251
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade:8376-8400
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade_to_1:8571-8583
</span><span class="cx">/CalendarServer/branches/users/glyph/q:9560-9688
</span><span class="cx">/CalendarServer/branches/users/glyph/queue-locking-and-timing:10204-10289
</span><span class="cx">/CalendarServer/branches/users/glyph/quota:7604-7637
</span><span class="cx">/CalendarServer/branches/users/glyph/sendfdport:5388-5424
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-fixes:8436-8443
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-take2:8155-8174
</span><span class="cx">/CalendarServer/branches/users/glyph/sharedpool:6490-6550
</span><span class="cx">/CalendarServer/branches/users/glyph/sharing-api:9192-9205
</span><span class="cx">/CalendarServer/branches/users/glyph/skip-lonely-vtimezones:8524-8535
</span><span class="cx">/CalendarServer/branches/users/glyph/sql-store:5929-6073
</span><span class="cx">/CalendarServer/branches/users/glyph/start-service-start-loop:11060-11065
</span><span class="cx">/CalendarServer/branches/users/glyph/subtransactions:7248-7258
</span><span class="cx">/CalendarServer/branches/users/glyph/table-alias:8651-8664
</span><span class="cx">/CalendarServer/branches/users/glyph/uidexport:7673-7676
</span><span class="cx">/CalendarServer/branches/users/glyph/unshare-when-access-revoked:10562-10595
</span><span class="cx">/CalendarServer/branches/users/glyph/use-system-twisted:5084-5149
</span><span class="cx">/CalendarServer/branches/users/glyph/uuid-normalize:9268-9296
</span><span class="cx">/CalendarServer/branches/users/glyph/warning-cleanups:11347-11357
</span><span class="cx">/CalendarServer/branches/users/glyph/whenNotProposed:11881-11897
</span><span class="cx">/CalendarServer/branches/users/glyph/xattrs-from-files:7757-7769
</span><span class="cx">/CalendarServer/branches/users/sagen/applepush:8126-8184
</span><span class="cx">/CalendarServer/branches/users/sagen/inboxitems:7380-7381
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources:5032-5051
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources-2:5052-5061
</span><span class="cx">/CalendarServer/branches/users/sagen/purge_old_events:6735-6746
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
</span><span class="cx">/CalendarServer/branches/users/sagen/resources-2:5084-5093
</span><span class="cx">/CalendarServer/branches/users/sagen/testing:10827-10851,10853-10855
</span><span class="cx">/CalendarServer/branches/users/wsanchez/transations:5515-5593
</span><span class="cx">/CalendarServer/trunk:11898,11991,12021,12028,12030-12031,12036,12241,12262-12263
</span><a id="CalendarServerbranchesreleaseCalendarServer52devtwextenterpriselockingpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/locking.py (12271 => 12272)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/locking.py        2014-01-08 21:53:27 UTC (rev 12271)
+++ CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/locking.py        2014-01-08 22:13:14 UTC (rev 12272)
</span><span class="lines">@@ -35,6 +35,13 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+class LockTimeout(Exception):
+    &quot;&quot;&quot;
+    The lock you were trying to lock was already locked causing a timeout.
+    &quot;&quot;&quot;
+
+
+
</ins><span class="cx"> def makeLockSchema(inSchema):
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     Create a self-contained schema just for L{Locker} use, in C{inSchema}.
</span><span class="lines">@@ -57,7 +64,6 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> class NamedLock(Record, fromTable(LockSchema.NAMED_LOCK)):
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     An L{AcquiredLock} lock against a shared data store that the current
</span><span class="lines">@@ -79,7 +85,9 @@
</span><span class="cx">         def autoRelease(self):
</span><span class="cx">             txn.preCommit(lambda: self.release(True))
</span><span class="cx">             return self
</span><del>-        return cls.create(txn, lockName=name).addCallback(autoRelease)
</del><ins>+        def lockFailed(f):
+            raise LockTimeout(name)
+        return cls.create(txn, lockName=name).addCallback(autoRelease).addErrback(lockFailed)
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     def release(self, ignoreAlreadyUnlocked=False):
</span><span class="lines">@@ -98,6 +106,3 @@
</span><span class="cx">             unlocked.
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         return self.delete()
</span><del>-
-
-
</del></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer52devtwextenterprisetesttest_lockingpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/test/test_locking.py (12271 => 12272)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/test/test_locking.py        2014-01-08 21:53:27 UTC (rev 12271)
+++ CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/test/test_locking.py        2014-01-08 22:13:14 UTC (rev 12272)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx"> from twisted.trial.unittest import TestCase
</span><span class="cx"> 
</span><span class="cx"> from twext.enterprise.fixtures import buildConnectionPool
</span><del>-from twext.enterprise.locking import NamedLock
</del><ins>+from twext.enterprise.locking import NamedLock, LockTimeout
</ins><span class="cx"> from twext.enterprise.dal.syntax import Select
</span><span class="cx"> from twext.enterprise.locking import LockSchema
</span><span class="cx"> 
</span><span class="lines">@@ -76,3 +76,17 @@
</span><span class="cx">         txn2 = self.pool.connection()
</span><span class="cx">         rows = yield Select(From=LockSchema.NAMED_LOCK).on(txn2)
</span><span class="cx">         self.assertEquals(rows, [])
</span><ins>+
+
+    @inlineCallbacks
+    def test_timeout(self):
+        &quot;&quot;&quot;
+        Trying to acquire second lock times out.
+        &quot;&quot;&quot;
+        txn1 = self.pool.connection()
+        yield NamedLock.acquire(txn1, u&quot;a test lock&quot;)
+
+        txn2 = self.pool.connection()
+        yield self.assertFailure(NamedLock.acquire(txn2, u&quot;a test lock&quot;), LockTimeout)
+        yield txn2.abort()
+        self.flushLoggedErrors()
</ins></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer52devtwistedcaldavstorebridgepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.2-dev/twistedcaldav/storebridge.py (12271 => 12272)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.2-dev/twistedcaldav/storebridge.py        2014-01-08 21:53:27 UTC (rev 12271)
+++ CalendarServer/branches/release/CalendarServer-5.2-dev/twistedcaldav/storebridge.py        2014-01-08 22:13:14 UTC (rev 12272)
</span><span class="lines">@@ -17,7 +17,9 @@
</span><span class="cx"> 
</span><span class="cx"> from pycalendar.datetime import PyCalendarDateTime
</span><span class="cx"> 
</span><ins>+from twext.enterprise.locking import LockTimeout
</ins><span class="cx"> from twext.python.log import Logger
</span><ins>+from twext.web2 import responsecode, http_headers, http
</ins><span class="cx"> from twext.web2.dav.http import ErrorResponse, ResponseQueue, MultiStatusResponse
</span><span class="cx"> from twext.web2.dav.noneprops import NonePropertyStore
</span><span class="cx"> from twext.web2.dav.resource import TwistedACLInheritable, AccessDeniedError, \
</span><span class="lines">@@ -26,6 +28,7 @@
</span><span class="cx"> from twext.web2.filter.location import addLocation
</span><span class="cx"> from twext.web2.http import HTTPError, StatusResponse, Response
</span><span class="cx"> from twext.web2.http_headers import ETag, MimeType, MimeDisposition
</span><ins>+from twext.web2.iweb import IResponse
</ins><span class="cx"> from twext.web2.responsecode import \
</span><span class="cx">     FORBIDDEN, NO_CONTENT, NOT_FOUND, CREATED, CONFLICT, PRECONDITION_FAILED, \
</span><span class="cx">     BAD_REQUEST, OK, INSUFFICIENT_STORAGE_SPACE, SERVICE_UNAVAILABLE
</span><span class="lines">@@ -41,14 +44,20 @@
</span><span class="cx">     MaxInstances, NoUIDConflict
</span><span class="cx"> from twistedcaldav.carddavxml import carddav_namespace, NoUIDConflict as NovCardUIDConflict
</span><span class="cx"> from twistedcaldav.config import config
</span><ins>+from twistedcaldav.customxml import calendarserver_namespace
</ins><span class="cx"> from twistedcaldav.directory.wiki import WikiDirectoryService, getWikiAccess
</span><span class="cx"> from twistedcaldav.ical import Component as VCalendar, Property as VProperty, \
</span><span class="cx">     InvalidICalendarDataError, iCalendarProductID, allowedComponents, Component
</span><ins>+from twistedcaldav.instance import InvalidOverriddenInstanceError, \
+    TooManyInstancesError
</ins><span class="cx"> from twistedcaldav.memcachelock import MemcacheLockTimeoutError
</span><span class="cx"> from twistedcaldav.notifications import NotificationCollectionResource, NotificationResource
</span><span class="cx"> from twistedcaldav.resource import CalDAVResource, GlobalAddressBookResource, \
</span><span class="cx">     DefaultAlarmPropertyMixin
</span><span class="cx"> from twistedcaldav.scheduling_store.caldav.resource import ScheduleInboxResource
</span><ins>+from twistedcaldav.sharing import invitationBindStatusToXMLMap, \
+    invitationBindModeToXMLMap
+from twistedcaldav.util import bestAcceptType
</ins><span class="cx"> from twistedcaldav.vcard import Component as VCard, InvalidVCardDataError
</span><span class="cx"> 
</span><span class="cx"> from txdav.base.propertystore.base import PropertyName
</span><span class="lines">@@ -74,16 +83,10 @@
</span><span class="cx"> from txdav.xml.base import dav_namespace, WebDAVUnknownElement, encodeXMLName
</span><span class="cx"> 
</span><span class="cx"> from urlparse import urlsplit
</span><ins>+import collections
</ins><span class="cx"> import hashlib
</span><span class="cx"> import time
</span><span class="cx"> import uuid
</span><del>-from twext.web2 import responsecode, http_headers, http
-from twext.web2.iweb import IResponse
-from twistedcaldav.customxml import calendarserver_namespace
-from twistedcaldav.instance import InvalidOverriddenInstanceError, \
-    TooManyInstancesError
-import collections
-
</del><span class="cx"> &quot;&quot;&quot;
</span><span class="cx"> Wrappers to translate between the APIs in L{txdav.caldav.icalendarstore} and
</span><span class="cx"> L{txdav.carddav.iaddressbookstore} and those in L{twistedcaldav}.
</span><span class="lines">@@ -2258,11 +2261,53 @@
</span><span class="cx">         returnValue(response)
</span><span class="cx"> 
</span><span class="cx">     # The following are used to map store exceptions into HTTP error responses
</span><del>-    StoreExceptionsStatusErrors = set()
</del><span class="cx">     StoreExceptionsErrors = {}
</span><del>-    StoreMoveExceptionsStatusErrors = set()
</del><span class="cx">     StoreMoveExceptionsErrors = {}
</span><ins>+    StoreRemoveExceptionsErrors = {}
</ins><span class="cx"> 
</span><ins>+    @classmethod
+    def _storeExceptionStatus(cls, err, arg):
+        &quot;&quot;&quot;
+        Raise a status error.
+
+        @param err: the actual exception that caused the error
+        @type err: L{Exception}
+        @param arg: description of error or C{None}
+        @type arg: C{str} or C{None}
+        &quot;&quot;&quot;
+        raise HTTPError(StatusResponse(responsecode.FORBIDDEN, arg if arg is not None else str(err)))
+
+
+    @classmethod
+    def _storeExceptionError(cls, err, arg):
+        &quot;&quot;&quot;
+        Raise a DAV:error error with the supplied error element.
+
+        @param err: the actual exception that caused the error
+        @type err: L{Exception}
+        @param arg: the error element
+        @type arg: C{tuple}
+        &quot;&quot;&quot;
+        raise HTTPError(ErrorResponse(
+            responsecode.FORBIDDEN,
+            arg,
+            str(err),
+        ))
+
+
+    @classmethod
+    def _storeExceptionUnavailable(cls, err, arg):
+        &quot;&quot;&quot;
+        Raise a service unavailable error.
+
+        @param err: the actual exception that caused the error
+        @type err: L{Exception}
+        @param arg: description of error or C{None}
+        @type arg: C{str} or C{None}
+        &quot;&quot;&quot;
+        raise HTTPError(StatusResponse(responsecode.SERVICE_UNAVAILABLE, arg if arg is not None else str(err)))
+
+
</ins><span class="cx">     @requiresPermissions(fromParent=[davxml.Unbind()])
</span><span class="cx">     def http_DELETE(self, request):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="lines">@@ -2354,15 +2399,9 @@
</span><span class="cx">             # Grab the current exception state here so we can use it in a re-raise - we need this because
</span><span class="cx">             # an inlineCallback might be called and that raises an exception when it returns, wiping out the
</span><span class="cx">             # original exception &quot;context&quot;.
</span><del>-            if type(err) in self.StoreMoveExceptionsStatusErrors:
-                raise HTTPError(StatusResponse(responsecode.FORBIDDEN, str(err)))
-
-            elif type(err) in self.StoreMoveExceptionsErrors:
-                raise HTTPError(ErrorResponse(
-                    responsecode.FORBIDDEN,
-                    self.StoreMoveExceptionsErrors[type(err)],
-                    str(err),
-                ))
</del><ins>+            if type(err) in self.StoreMoveExceptionsErrors:
+                error, arg = self.StoreMoveExceptionsErrors[type(err)]
+                error(err, arg)
</ins><span class="cx">             else:
</span><span class="cx">                 # Return the original failure (exception) state
</span><span class="cx">                 raise
</span><span class="lines">@@ -2405,15 +2444,9 @@
</span><span class="cx"> 
</span><span class="cx">         # Map store exception to HTTP errors
</span><span class="cx">         except Exception as err:
</span><del>-            if type(err) in self.StoreExceptionsStatusErrors:
-                raise HTTPError(StatusResponse(responsecode.FORBIDDEN, str(err)))
-
-            elif type(err) in self.StoreExceptionsErrors:
-                raise HTTPError(ErrorResponse(
-                    responsecode.FORBIDDEN,
-                    self.StoreExceptionsErrors[type(err)],
-                    str(err),
-                ))
</del><ins>+            if type(err) in self.StoreExceptionsErrors:
+                error, arg = self.StoreExceptionsErrors[type(err)]
+                error(err, arg)
</ins><span class="cx">             else:
</span><span class="cx">                 raise
</span><span class="cx"> 
</span><span class="lines">@@ -2458,6 +2491,14 @@
</span><span class="cx">         except NoSuchObjectResourceError:
</span><span class="cx">             raise HTTPError(NOT_FOUND)
</span><span class="cx"> 
</span><ins>+        # Map store exception to HTTP errors
+        except Exception as err:
+            if type(err) in self.StoreExceptionsErrors:
+                error, arg = self.StoreExceptionsErrors[type(err)]
+                error(err, arg)
+            else:
+                raise
+
</ins><span class="cx">         # Re-initialize to get stuff setup again now we have no object
</span><span class="cx">         self._initializeWithObject(None, self._newStoreParent)
</span><span class="cx"> 
</span><span class="lines">@@ -2590,51 +2631,51 @@
</span><span class="cx">         else:
</span><span class="cx">             return False
</span><span class="cx"> 
</span><del>-    StoreExceptionsStatusErrors = set((
-        ObjectResourceNameNotAllowedError,
-        ObjectResourceNameAlreadyExistsError,
-    ))
-
</del><span class="cx">     StoreExceptionsErrors = {
</span><del>-        TooManyObjectResourcesError: customxml.MaxResources(),
-        ObjectResourceTooBigError: (caldav_namespace, &quot;max-resource-size&quot;),
-        InvalidObjectResourceError: (caldav_namespace, &quot;valid-calendar-data&quot;),
-        InvalidComponentForStoreError: (caldav_namespace, &quot;valid-calendar-object-resource&quot;),
-        InvalidComponentTypeError: (caldav_namespace, &quot;supported-component&quot;),
-        TooManyAttendeesError: MaxAttendeesPerInstance.fromString(str(config.MaxAttendeesPerInstance)),
-        InvalidCalendarAccessError: (calendarserver_namespace, &quot;valid-access-restriction&quot;),
-        ValidOrganizerError: (calendarserver_namespace, &quot;valid-organizer&quot;),
-        UIDExistsError: NoUIDConflict(),
-        UIDExistsElsewhereError: (caldav_namespace, &quot;unique-scheduling-object-resource&quot;),
-        InvalidUIDError: NoUIDConflict(),
-        InvalidPerUserDataMerge: (caldav_namespace, &quot;valid-calendar-data&quot;),
-        AttendeeAllowedError: (caldav_namespace, &quot;attendee-allowed&quot;),
-        InvalidOverriddenInstanceError: (caldav_namespace, &quot;valid-calendar-data&quot;),
-        TooManyInstancesError: MaxInstances.fromString(str(config.MaxAllowedInstances)),
-        AttachmentStoreValidManagedID: (caldav_namespace, &quot;valid-managed-id&quot;),
-        ShareeAllowedError: (calendarserver_namespace, &quot;sharee-privilege-needed&quot;,),
-        DuplicatePrivateCommentsError: (calendarserver_namespace, &quot;no-duplicate-private-comments&quot;,),
</del><ins>+        ObjectResourceNameNotAllowedError: (_CommonObjectResource._storeExceptionStatus, None,),
+        ObjectResourceNameAlreadyExistsError: (_CommonObjectResource._storeExceptionStatus, None,),
+        TooManyObjectResourcesError: (_CommonObjectResource._storeExceptionError, customxml.MaxResources(),),
+        ObjectResourceTooBigError: (_CommonObjectResource._storeExceptionError, (caldav_namespace, &quot;max-resource-size&quot;),),
+        InvalidObjectResourceError: (_CommonObjectResource._storeExceptionError, (caldav_namespace, &quot;valid-calendar-data&quot;),),
+        InvalidComponentForStoreError: (_CommonObjectResource._storeExceptionError, (caldav_namespace, &quot;valid-calendar-object-resource&quot;),),
+        InvalidComponentTypeError: (_CommonObjectResource._storeExceptionError, (caldav_namespace, &quot;supported-component&quot;),),
+        TooManyAttendeesError: (_CommonObjectResource._storeExceptionError, MaxAttendeesPerInstance.fromString(str(config.MaxAttendeesPerInstance)),),
+        InvalidCalendarAccessError: (_CommonObjectResource._storeExceptionError, (calendarserver_namespace, &quot;valid-access-restriction&quot;),),
+        ValidOrganizerError: (_CommonObjectResource._storeExceptionError, (calendarserver_namespace, &quot;valid-organizer&quot;),),
+        UIDExistsError: (_CommonObjectResource._storeExceptionError, NoUIDConflict(),),
+        UIDExistsElsewhereError: (_CommonObjectResource._storeExceptionError, (caldav_namespace, &quot;unique-scheduling-object-resource&quot;),),
+        InvalidUIDError: (_CommonObjectResource._storeExceptionError, NoUIDConflict(),),
+        InvalidPerUserDataMerge: (_CommonObjectResource._storeExceptionError, (caldav_namespace, &quot;valid-calendar-data&quot;),),
+        AttendeeAllowedError: (_CommonObjectResource._storeExceptionError, (caldav_namespace, &quot;attendee-allowed&quot;),),
+        InvalidOverriddenInstanceError: (_CommonObjectResource._storeExceptionError, (caldav_namespace, &quot;valid-calendar-data&quot;),),
+        TooManyInstancesError: (_CommonObjectResource._storeExceptionError, MaxInstances.fromString(str(config.MaxAllowedInstances)),),
+        AttachmentStoreValidManagedID: (_CommonObjectResource._storeExceptionError, (caldav_namespace, &quot;valid-managed-id&quot;),),
+        ShareeAllowedError: (_CommonObjectResource._storeExceptionError, (calendarserver_namespace, &quot;sharee-privilege-needed&quot;,),),
+        DuplicatePrivateCommentsError: (_CommonObjectResource._storeExceptionError, (calendarserver_namespace, &quot;no-duplicate-private-comments&quot;,),),
+        LockTimeout: (_CommonObjectResource._storeExceptionUnavailable, &quot;Lock timed out.&quot;,),
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    StoreMoveExceptionsStatusErrors = set((
-        ObjectResourceNameNotAllowedError,
-        ObjectResourceNameAlreadyExistsError,
-    ))
-
</del><span class="cx">     StoreMoveExceptionsErrors = {
</span><del>-        TooManyObjectResourcesError: customxml.MaxResources(),
-        InvalidResourceMove: (calendarserver_namespace, &quot;valid-move&quot;),
-        InvalidComponentTypeError: (caldav_namespace, &quot;supported-component&quot;),
</del><ins>+        ObjectResourceNameNotAllowedError: (_CommonObjectResource._storeExceptionStatus, None,),
+        ObjectResourceNameAlreadyExistsError: (_CommonObjectResource._storeExceptionStatus, None,),
+        TooManyObjectResourcesError: (_CommonObjectResource._storeExceptionError, customxml.MaxResources(),),
+        InvalidResourceMove: (_CommonObjectResource._storeExceptionError, (calendarserver_namespace, &quot;valid-move&quot;),),
+        InvalidComponentTypeError: (_CommonObjectResource._storeExceptionError, (caldav_namespace, &quot;supported-component&quot;),),
+        LockTimeout: (_CommonObjectResource._storeExceptionUnavailable, &quot;Lock timed out.&quot;,),
</ins><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    StoreRemoveExceptionsErrors = {
+        LockTimeout: (_CommonObjectResource._storeExceptionUnavailable, &quot;Lock timed out.&quot;,),
+    }
+
</ins><span class="cx">     StoreAttachmentValidErrors = set((
</span><span class="cx">         AttachmentStoreFailed,
</span><span class="cx">         InvalidAttachmentOperation,
</span><span class="cx">     ))
</span><span class="cx"> 
</span><span class="cx">     StoreAttachmentExceptionsErrors = {
</span><del>-        AttachmentStoreValidManagedID: (caldav_namespace, &quot;valid-managed-id-parameter&quot;,),
-        AttachmentRemoveFailed: (caldav_namespace, &quot;valid-attachment-remove&quot;,),
</del><ins>+        AttachmentStoreValidManagedID: (_CommonObjectResource._storeExceptionError, (caldav_namespace, &quot;valid-managed-id-parameter&quot;,),),
+        AttachmentRemoveFailed: (_CommonObjectResource._storeExceptionError, (caldav_namespace, &quot;valid-attachment-remove&quot;,),),
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -2947,28 +2988,15 @@
</span><span class="cx">         except Exception as err:
</span><span class="cx"> 
</span><span class="cx">             if type(err) in self.StoreAttachmentValidErrors:
</span><del>-                raise HTTPError(ErrorResponse(
-                    responsecode.FORBIDDEN,
-                    (caldav_namespace, valid_preconditions[action],),
-                    str(err),
-                ))
</del><ins>+                self._storeExceptionError(err, (caldav_namespace, valid_preconditions[action],))
</ins><span class="cx"> 
</span><span class="cx">             elif type(err) in self.StoreAttachmentExceptionsErrors:
</span><del>-                raise HTTPError(ErrorResponse(
-                    responsecode.FORBIDDEN,
-                    self.StoreAttachmentExceptionsErrors[type(err)],
-                    str(err),
-                ))
</del><ins>+                error, arg = self.StoreAttachmentExceptionsErrors[type(err)]
+                error(err, arg)
</ins><span class="cx"> 
</span><del>-            elif type(err) in self.StoreExceptionsStatusErrors:
-                raise HTTPError(StatusResponse(responsecode.FORBIDDEN, str(err)))
-
</del><span class="cx">             elif type(err) in self.StoreExceptionsErrors:
</span><del>-                raise HTTPError(ErrorResponse(
-                    responsecode.FORBIDDEN,
-                    self.StoreExceptionsErrors[type(err)],
-                    str(err),
-                ))
</del><ins>+                error, arg = self.StoreExceptionsErrors[type(err)]
+                error(err, arg)
</ins><span class="cx"> 
</span><span class="cx">             else:
</span><span class="cx">                 raise
</span><span class="lines">@@ -3274,32 +3302,32 @@
</span><span class="cx"> 
</span><span class="cx">     vCard = _CommonObjectResource.component
</span><span class="cx"> 
</span><del>-    StoreExceptionsStatusErrors = set((
-        ObjectResourceNameNotAllowedError,
-        ObjectResourceNameAlreadyExistsError,
-    ))
-
</del><span class="cx">     StoreExceptionsErrors = {
</span><del>-        TooManyObjectResourcesError: customxml.MaxResources(),
-        ObjectResourceTooBigError: (carddav_namespace, &quot;max-resource-size&quot;),
-        InvalidObjectResourceError: (carddav_namespace, &quot;valid-address-data&quot;),
-        InvalidComponentForStoreError: (carddav_namespace, &quot;valid-addressbook-object-resource&quot;),
-        UIDExistsError: NovCardUIDConflict(),
-        InvalidUIDError: NovCardUIDConflict(),
-        InvalidPerUserDataMerge: (carddav_namespace, &quot;valid-address-data&quot;),
</del><ins>+        ObjectResourceNameNotAllowedError: (_CommonObjectResource._storeExceptionStatus, None,),
+        ObjectResourceNameAlreadyExistsError: (_CommonObjectResource._storeExceptionStatus, None,),
+        TooManyObjectResourcesError: (_CommonObjectResource._storeExceptionError, customxml.MaxResources(),),
+        ObjectResourceTooBigError: (_CommonObjectResource._storeExceptionError, (carddav_namespace, &quot;max-resource-size&quot;),),
+        InvalidObjectResourceError: (_CommonObjectResource._storeExceptionError, (carddav_namespace, &quot;valid-address-data&quot;),),
+        InvalidComponentForStoreError: (_CommonObjectResource._storeExceptionError, (carddav_namespace, &quot;valid-addressbook-object-resource&quot;),),
+        UIDExistsError: (_CommonObjectResource._storeExceptionError, NovCardUIDConflict(),),
+        InvalidUIDError: (_CommonObjectResource._storeExceptionError, NovCardUIDConflict(),),
+        InvalidPerUserDataMerge: (_CommonObjectResource._storeExceptionError, (carddav_namespace, &quot;valid-address-data&quot;),),
+        LockTimeout: (_CommonObjectResource._storeExceptionUnavailable, &quot;Lock timed out.&quot;,),
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    StoreMoveExceptionsStatusErrors = set((
-        ObjectResourceNameNotAllowedError,
-        ObjectResourceNameAlreadyExistsError,
-    ))
-
</del><span class="cx">     StoreMoveExceptionsErrors = {
</span><del>-        TooManyObjectResourcesError: customxml.MaxResources(),
-        InvalidResourceMove: (calendarserver_namespace, &quot;valid-move&quot;),
</del><ins>+        ObjectResourceNameNotAllowedError: (_CommonObjectResource._storeExceptionStatus, None,),
+        ObjectResourceNameAlreadyExistsError: (_CommonObjectResource._storeExceptionStatus, None,),
+        TooManyObjectResourcesError: (_CommonObjectResource._storeExceptionError, customxml.MaxResources(),),
+        InvalidResourceMove: (_CommonObjectResource._storeExceptionError, (calendarserver_namespace, &quot;valid-move&quot;),),
+        LockTimeout: (_CommonObjectResource._storeExceptionUnavailable, &quot;Lock timed out.&quot;,),
</ins><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    StoreRemoveExceptionsErrors = {
+        LockTimeout: (_CommonObjectResource._storeExceptionUnavailable, &quot;Lock timed out.&quot;,),
+    }
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx">     def resourceType(self):
</span><span class="cx">         if self.isShared():
</span><span class="cx">             return customxml.ResourceType.sharedownergroup
</span></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer52devtwistedcaldavtesttest_wrappingpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.2-dev/twistedcaldav/test/test_wrapping.py (12271 => 12272)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.2-dev/twistedcaldav/test/test_wrapping.py        2014-01-08 21:53:27 UTC (rev 12271)
+++ CalendarServer/branches/release/CalendarServer-5.2-dev/twistedcaldav/test/test_wrapping.py        2014-01-08 22:13:14 UTC (rev 12272)
</span><span class="lines">@@ -19,41 +19,37 @@
</span><span class="cx"> &quot;&quot;&quot;
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+from twext.enterprise.ienterprise import AlreadyFinishedError
+from twext.enterprise.locking import NamedLock
+from twext.web2 import responsecode
+from twext.web2.http import HTTPError
+from twext.web2.http_headers import Headers, MimeType
+from twext.web2.responsecode import INSUFFICIENT_STORAGE_SPACE
</ins><span class="cx"> from twext.web2.responsecode import UNAUTHORIZED
</span><del>-from twext.web2.http_headers import Headers
-from twext.enterprise.ienterprise import AlreadyFinishedError
</del><ins>+from twext.web2.stream import MemoryStream
</ins><span class="cx"> 
</span><del>-from txdav.xml import element as davxml
-from twistedcaldav.config import config
-
</del><span class="cx"> from twisted.internet.defer import inlineCallbacks, returnValue
</span><ins>+from twisted.internet.defer import maybeDeferred
</ins><span class="cx"> 
</span><ins>+from twistedcaldav.config import config
+from twistedcaldav.directory.test.test_xmlfile import XMLFileBase
</ins><span class="cx"> from twistedcaldav.ical import Component as VComponent
</span><del>-from twistedcaldav.vcard import Component as VCComponent
-
</del><span class="cx"> from twistedcaldav.storebridge import DropboxCollection, \
</span><span class="cx">     CalendarCollectionResource
</span><del>-
</del><span class="cx"> from twistedcaldav.test.util import StoreTestCase, SimpleStoreRequest
</span><ins>+from twistedcaldav.vcard import Component as VCComponent
</ins><span class="cx"> 
</span><del>-from txdav.idav import IDataStore
</del><ins>+from txdav.caldav.datastore.file import Calendar
</ins><span class="cx"> from txdav.caldav.datastore.test.test_file import test_event_text
</span><del>-
</del><ins>+from txdav.caldav.icalendarstore import ICalendarHome
</ins><span class="cx"> from txdav.carddav.datastore.test.test_file import vcard4_text
</span><del>-
</del><ins>+from txdav.carddav.iaddressbookstore import IAddressBookHome
</ins><span class="cx"> from txdav.common.datastore.test.util import assertProvides
</span><del>-
-
-from twext.web2.http import HTTPError
-from twext.web2.responsecode import INSUFFICIENT_STORAGE_SPACE
-from twext.web2.stream import MemoryStream
</del><span class="cx"> from txdav.common.datastore.test.util import deriveQuota
</span><del>-from twistedcaldav.directory.test.test_xmlfile import XMLFileBase
-from txdav.caldav.icalendarstore import ICalendarHome
-from txdav.carddav.iaddressbookstore import IAddressBookHome
</del><ins>+from txdav.idav import IDataStore
+from txdav.xml import element as davxml
</ins><span class="cx"> 
</span><del>-from twisted.internet.defer import maybeDeferred
-from txdav.caldav.datastore.file import Calendar
</del><ins>+import hashlib
</ins><span class="cx"> 
</span><span class="cx"> def _todo(f, why):
</span><span class="cx">     f.todo = why
</span><span class="lines">@@ -560,3 +556,90 @@
</span><span class="cx">         self.requestUnderTest = None
</span><span class="cx">         yield self.assertCalendarEmpty(wsanchez)
</span><span class="cx">         yield self.assertCalendarEmpty(cdaboo)
</span><ins>+
+
+
+class TimeoutTests(StoreTestCase):
+    &quot;&quot;&quot;
+    Tests for L{twistedcaldav.storebridge} lock timeouts.
+    &quot;&quot;&quot;
+
+    @inlineCallbacks
+    def test_timeoutOnPUT(self):
+        &quot;&quot;&quot;
+        PUT gets a 503 on a lock timeout.
+        &quot;&quot;&quot;
+
+        # Create a fake lock
+        txn = self.transactionUnderTest()
+        yield NamedLock.acquire(txn, &quot;ImplicitUIDLock:%s&quot; % (hashlib.md5(&quot;uid1&quot;).hexdigest(),))
+
+        # PUT fails
+        request = SimpleStoreRequest(
+            self,
+            &quot;PUT&quot;,
+            &quot;/calendars/users/wsanchez/calendar/1.ics&quot;,
+            headers=Headers({&quot;content-type&quot;: MimeType.fromString(&quot;text/calendar&quot;)}),
+            authid=&quot;wsanchez&quot;
+        )
+        request.stream = MemoryStream(&quot;&quot;&quot;BEGIN:VCALENDAR
+CALSCALE:GREGORIAN
+PRODID:-//Apple Computer\, Inc//iCal 2.0//EN
+VERSION:2.0
+BEGIN:VEVENT
+UID:uid1
+DTSTART;VALUE=DATE:20020101
+DTEND;VALUE=DATE:20020102
+DTSTAMP:20020101T121212Z
+SUMMARY:New Year's Day
+END:VEVENT
+END:VCALENDAR
+&quot;&quot;&quot;.replace(&quot;\n&quot;, &quot;\r\n&quot;))
+        response = yield self.send(request)
+        self.assertEqual(response.code, responsecode.SERVICE_UNAVAILABLE)
+
+
+    @inlineCallbacks
+    def test_timeoutOnDELETE(self):
+        &quot;&quot;&quot;
+        DELETE gets a 503 on a lock timeout.
+        &quot;&quot;&quot;
+
+        # PUT works
+        request = SimpleStoreRequest(
+            self,
+            &quot;PUT&quot;,
+            &quot;/calendars/users/wsanchez/calendar/1.ics&quot;,
+            headers=Headers({&quot;content-type&quot;: MimeType.fromString(&quot;text/calendar&quot;)}),
+            authid=&quot;wsanchez&quot;
+        )
+        request.stream = MemoryStream(&quot;&quot;&quot;BEGIN:VCALENDAR
+CALSCALE:GREGORIAN
+PRODID:-//Apple Computer\, Inc//iCal 2.0//EN
+VERSION:2.0
+BEGIN:VEVENT
+UID:uid1
+DTSTART;VALUE=DATE:20020101
+DTEND;VALUE=DATE:20020102
+DTSTAMP:20020101T121212Z
+ORGANIZER:mailto:wsanchez@example.com
+ATTENDEE:mailto:wsanchez@example.com
+SUMMARY:New Year's Day
+END:VEVENT
+END:VCALENDAR
+&quot;&quot;&quot;.replace(&quot;\n&quot;, &quot;\r\n&quot;))
+        response = yield self.send(request)
+        self.assertEqual(response.code, responsecode.CREATED)
+
+        # Create a fake lock
+        txn = self.transactionUnderTest()
+        yield NamedLock.acquire(txn, &quot;ImplicitUIDLock:%s&quot; % (hashlib.md5(&quot;uid1&quot;).hexdigest(),))
+
+        request = SimpleStoreRequest(
+            self,
+            &quot;DELETE&quot;,
+            &quot;/calendars/users/wsanchez/calendar/1.ics&quot;,
+            authid=&quot;wsanchez&quot;
+        )
+        response = yield self.send(request)
+        self.assertEqual(response.code, responsecode.SERVICE_UNAVAILABLE)
</ins></span></pre>
</div>
</div>

</body>
</html>