<!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>[14521] twext/trunk</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/14521">14521</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2015-03-06 13:39:59 -0800 (Fri, 06 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge pod-2-pod branch to trunk.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#twexttrunktwextenterprisedalrecordpy">twext/trunk/twext/enterprise/dal/record.py</a></li>
<li><a href="#twexttrunktwextenterprisedalsyntaxpy">twext/trunk/twext/enterprise/dal/syntax.py</a></li>
<li><a href="#twexttrunktwextenterprisedaltesttest_recordpy">twext/trunk/twext/enterprise/dal/test/test_record.py</a></li>
<li><a href="#twexttrunktwextenterprisedaltesttest_sqlsyntaxpy">twext/trunk/twext/enterprise/dal/test/test_sqlsyntax.py</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#twexttrunk">twext/trunk/</a></li>
<li><a href="#twexttrunktwext">twext/trunk/twext/</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="twexttrunk"></a>
<div class="propset"><h4>Property changes: twext/trunk</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4>Modified: svn:mergeinfo</h4></div>
<span class="cx">/twext/branches/users/cdaboo/jobs:12742-12780
</span><span class="cx">/twext/branches/users/sagen/recordtypes:13647-13658
</span><span class="cx">/twext/branches/users/sagen/recordtypes-2:13659
</span><span class="cx">   + /twext/branches/users/cdaboo/jobqueue-3:13444-13471
</span><span class="cx">/twext/branches/users/cdaboo/jobs:12742-12780
</span><span class="cx">/twext/branches/users/cdaboo/pod2pod-migration:14416-14520
</span><span class="cx">/twext/branches/users/sagen/recordtypes:13647-13658
</span><span class="cx">/twext/branches/users/sagen/recordtypes-2:13659
</span><a id="twexttrunktwext"></a>
<div class="propset"><h4>Property changes: twext/trunk/twext</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/twext:4379-4443
</span><span class="cx">/CalendarServer/branches/egg-info-351/twext:4589-4625
</span><span class="cx">/CalendarServer/branches/generic-sqlstore/twext:6167-6191
</span><span class="cx">/CalendarServer/branches/new-store/twext:5594-5934
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile/twext:5911-5935
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile-2/twext:5936-5981
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-4.3-dev/twext:10180-10190,10192
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-5.1-dev/twext:11846
</span><span class="cx">/CalendarServer/branches/users/cdaboo/batchupload-6699/twext:6700-7198
</span><span class="cx">/CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692/twext:5693-5702
</span><span class="cx">/CalendarServer/branches/users/cdaboo/component-set-fixes/twext:8130-8346
</span><span class="cx">/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627/twext:3628-3644
</span><span class="cx">/CalendarServer/branches/users/cdaboo/fix-no-ischedule/twext:11607-11871
</span><span class="cx">/CalendarServer/branches/users/cdaboo/implicituidrace/twext:8137-8141
</span><span class="cx">/CalendarServer/branches/users/cdaboo/ischedule-dkim/twext:9747-9979
</span><span class="cx">/CalendarServer/branches/users/cdaboo/json/twext:11622-11912
</span><span class="cx">/CalendarServer/branches/users/cdaboo/managed-attachments/twext:9985-10145
</span><span class="cx">/CalendarServer/branches/users/cdaboo/more-sharing-5591/twext:5592-5601
</span><span class="cx">/CalendarServer/branches/users/cdaboo/partition-4464/twext:4465-4957
</span><span class="cx">/CalendarServer/branches/users/cdaboo/performance-tweaks/twext:11824-11836
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pods/twext:7297-7377
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycalendar/twext:7085-7206
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycard/twext:7227-7237
</span><span class="cx">/CalendarServer/branches/users/cdaboo/queued-attendee-refreshes/twext:7740-8287
</span><span class="cx">/CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twext:5071-5105
</span><span class="cx">/CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twext:11875-11900
</span><span class="cx">/CalendarServer/branches/users/cdaboo/shared-calendars-5187/twext:5188-5440
</span><span class="cx">/CalendarServer/branches/users/cdaboo/sharing-in-the-store/twext:11935-12016
</span><span class="cx">/CalendarServer/branches/users/cdaboo/store-scheduling/twext:10876-11129
</span><span class="cx">/CalendarServer/branches/users/cdaboo/timezones/twext:7443-7699
</span><span class="cx">/CalendarServer/branches/users/cdaboo/txn-debugging/twext:8730-8743
</span><span class="cx">/CalendarServer/branches/users/gaya/sharedgroups-3/twext:11088-11204
</span><span class="cx">/CalendarServer/branches/users/glyph/always-abort-txn-on-error/twext:9958-9969
</span><span class="cx">/CalendarServer/branches/users/glyph/case-insensitive-uid/twext:8772-8805
</span><span class="cx">/CalendarServer/branches/users/glyph/conn-limit/twext:6574-6577
</span><span class="cx">/CalendarServer/branches/users/glyph/contacts-server-merge/twext:4971-5080
</span><span class="cx">/CalendarServer/branches/users/glyph/dalify/twext:6932-7023
</span><span class="cx">/CalendarServer/branches/users/glyph/db-reconnect/twext:6824-6876
</span><span class="cx">/CalendarServer/branches/users/glyph/deploybuild/twext:7563-7572
</span><span class="cx">/CalendarServer/branches/users/glyph/digest-auth-redux/twext:10624-10635
</span><span class="cx">/CalendarServer/branches/users/glyph/disable-quota/twext:7718-7727
</span><span class="cx">/CalendarServer/branches/users/glyph/dont-start-postgres/twext:6592-6614
</span><span class="cx">/CalendarServer/branches/users/glyph/enforce-max-requests/twext:11640-11643
</span><span class="cx">/CalendarServer/branches/users/glyph/hang-fix/twext:11465-11491
</span><span class="cx">/CalendarServer/branches/users/glyph/imip-and-admin-html/twext:7866-7984
</span><span class="cx">/CalendarServer/branches/users/glyph/ipv6-client/twext:9054-9105
</span><span class="cx">/CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext:11413-11436
</span><span class="cx">/CalendarServer/branches/users/glyph/linux-tests/twext:6893-6900
</span><span class="cx">/CalendarServer/branches/users/glyph/log-cleanups/twext:11691-11731
</span><span class="cx">/CalendarServer/branches/users/glyph/migrate-merge/twext:8690-8713
</span><span class="cx">/CalendarServer/branches/users/glyph/misc-portability-fixes/twext:7365-7374
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-6/twext:6322-6368
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-7/twext:6369-6445
</span><span class="cx">/CalendarServer/branches/users/glyph/multiget-delete/twext:8321-8330
</span><span class="cx">/CalendarServer/branches/users/glyph/new-export/twext:7444-7485
</span><span class="cx">/CalendarServer/branches/users/glyph/one-home-list-api/twext:10048-10073
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle/twext:7106-7155
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle-nulls/twext:7340-7351
</span><span class="cx">/CalendarServer/branches/users/glyph/other-html/twext:8062-8091
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-sim/twext:8240-8251
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade/twext:8376-8400
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade_to_1/twext:8571-8583
</span><span class="cx">/CalendarServer/branches/users/glyph/q/twext:9560-9688
</span><span class="cx">/CalendarServer/branches/users/glyph/queue-locking-and-timing/twext:10204-10289
</span><span class="cx">/CalendarServer/branches/users/glyph/quota/twext:7604-7637
</span><span class="cx">/CalendarServer/branches/users/glyph/sendfdport/twext:5388-5424
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-fixes/twext:8436-8443
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-take2/twext:8155-8174
</span><span class="cx">/CalendarServer/branches/users/glyph/sharedpool/twext:6490-6550
</span><span class="cx">/CalendarServer/branches/users/glyph/sharing-api/twext:9192-9205
</span><span class="cx">/CalendarServer/branches/users/glyph/skip-lonely-vtimezones/twext:8524-8535
</span><span class="cx">/CalendarServer/branches/users/glyph/sql-store/twext:5929-6073
</span><span class="cx">/CalendarServer/branches/users/glyph/start-service-start-loop/twext:11060-11065
</span><span class="cx">/CalendarServer/branches/users/glyph/subtransactions/twext:7248-7258
</span><span class="cx">/CalendarServer/branches/users/glyph/table-alias/twext:8651-8664
</span><span class="cx">/CalendarServer/branches/users/glyph/uidexport/twext:7673-7676
</span><span class="cx">/CalendarServer/branches/users/glyph/unshare-when-access-revoked/twext:10562-10595
</span><span class="cx">/CalendarServer/branches/users/glyph/use-system-twisted/twext:5084-5149
</span><span class="cx">/CalendarServer/branches/users/glyph/uuid-normalize/twext:9268-9296
</span><span class="cx">/CalendarServer/branches/users/glyph/warning-cleanups/twext:11347-11357
</span><span class="cx">/CalendarServer/branches/users/glyph/whenNotProposed/twext:11881-11897
</span><span class="cx">/CalendarServer/branches/users/glyph/xattrs-from-files/twext:7757-7769
</span><span class="cx">/CalendarServer/branches/users/sagen/applepush/twext:8126-8184
</span><span class="cx">/CalendarServer/branches/users/sagen/inboxitems/twext:7380-7381
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources/twext:5032-5051
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources-2/twext:5052-5061
</span><span class="cx">/CalendarServer/branches/users/sagen/purge_old_events/twext:6735-6746
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4038/twext:4040-4067
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4066/twext:4068-4075
</span><span class="cx">/CalendarServer/branches/users/sagen/resources-2/twext:5084-5093
</span><span class="cx">/CalendarServer/branches/users/sagen/testing/twext:10827-10851,10853-10855
</span><span class="cx">/CalendarServer/branches/users/wsanchez/transations/twext:5515-5593
</span><span class="cx">/twext/branches/users/cdaboo/jobqueue-3/twext:13444-13471
</span><span class="cx">/twext/branches/users/cdaboo/jobs/twext:12742-12780
</span><span class="cx">/twext/branches/users/sagen/recordtypes/twext:13647-13658
</span><span class="cx">/twext/branches/users/sagen/recordtypes-2/twext:13659
</span><span class="cx">   + /CalDAVTester/trunk/twext:11193-11198
</span><span class="cx">/CalendarServer/branches/config-separation/twext:4379-4443
</span><span class="cx">/CalendarServer/branches/egg-info-351/twext:4589-4625
</span><span class="cx">/CalendarServer/branches/generic-sqlstore/twext:6167-6191
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile-2/twext:5936-5981
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile/twext:5911-5935
</span><span class="cx">/CalendarServer/branches/new-store/twext:5594-5934
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-4.3-dev/twext:10180-10190,10192
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-5.1-dev/twext:11846
</span><span class="cx">/CalendarServer/branches/users/cdaboo/batchupload-6699/twext:6700-7198
</span><span class="cx">/CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692/twext:5693-5702
</span><span class="cx">/CalendarServer/branches/users/cdaboo/component-set-fixes/twext:8130-8346
</span><span class="cx">/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627/twext:3628-3644
</span><span class="cx">/CalendarServer/branches/users/cdaboo/fix-no-ischedule/twext:11607-11871
</span><span class="cx">/CalendarServer/branches/users/cdaboo/implicituidrace/twext:8137-8141
</span><span class="cx">/CalendarServer/branches/users/cdaboo/ischedule-dkim/twext:9747-9979
</span><span class="cx">/CalendarServer/branches/users/cdaboo/json/twext:11622-11912
</span><span class="cx">/CalendarServer/branches/users/cdaboo/managed-attachments/twext:9985-10145
</span><span class="cx">/CalendarServer/branches/users/cdaboo/more-sharing-5591/twext:5592-5601
</span><span class="cx">/CalendarServer/branches/users/cdaboo/partition-4464/twext:4465-4957
</span><span class="cx">/CalendarServer/branches/users/cdaboo/performance-tweaks/twext:11824-11836
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pods/twext:7297-7377
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycalendar/twext:7085-7206
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycard/twext:7227-7237
</span><span class="cx">/CalendarServer/branches/users/cdaboo/queued-attendee-refreshes/twext:7740-8287
</span><span class="cx">/CalendarServer/branches/users/cdaboo/relative-config-paths-5070/twext:5071-5105
</span><span class="cx">/CalendarServer/branches/users/cdaboo/reverse-proxy-pods/twext:11875-11900
</span><span class="cx">/CalendarServer/branches/users/cdaboo/shared-calendars-5187/twext:5188-5440
</span><span class="cx">/CalendarServer/branches/users/cdaboo/sharing-in-the-store/twext:11935-12016
</span><span class="cx">/CalendarServer/branches/users/cdaboo/store-scheduling/twext:10876-11129
</span><span class="cx">/CalendarServer/branches/users/cdaboo/timezones/twext:7443-7699
</span><span class="cx">/CalendarServer/branches/users/cdaboo/txn-debugging/twext:8730-8743
</span><span class="cx">/CalendarServer/branches/users/gaya/sharedgroups-3/twext:11088-11204
</span><span class="cx">/CalendarServer/branches/users/glyph/always-abort-txn-on-error/twext:9958-9969
</span><span class="cx">/CalendarServer/branches/users/glyph/case-insensitive-uid/twext:8772-8805
</span><span class="cx">/CalendarServer/branches/users/glyph/conn-limit/twext:6574-6577
</span><span class="cx">/CalendarServer/branches/users/glyph/contacts-server-merge/twext:4971-5080
</span><span class="cx">/CalendarServer/branches/users/glyph/dalify/twext:6932-7023
</span><span class="cx">/CalendarServer/branches/users/glyph/db-reconnect/twext:6824-6876
</span><span class="cx">/CalendarServer/branches/users/glyph/deploybuild/twext:7563-7572
</span><span class="cx">/CalendarServer/branches/users/glyph/digest-auth-redux/twext:10624-10635
</span><span class="cx">/CalendarServer/branches/users/glyph/disable-quota/twext:7718-7727
</span><span class="cx">/CalendarServer/branches/users/glyph/dont-start-postgres/twext:6592-6614
</span><span class="cx">/CalendarServer/branches/users/glyph/enforce-max-requests/twext:11640-11643
</span><span class="cx">/CalendarServer/branches/users/glyph/hang-fix/twext:11465-11491
</span><span class="cx">/CalendarServer/branches/users/glyph/imip-and-admin-html/twext:7866-7984
</span><span class="cx">/CalendarServer/branches/users/glyph/ipv6-client/twext:9054-9105
</span><span class="cx">/CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext:11413-11436
</span><span class="cx">/CalendarServer/branches/users/glyph/linux-tests/twext:6893-6900
</span><span class="cx">/CalendarServer/branches/users/glyph/log-cleanups/twext:11691-11731
</span><span class="cx">/CalendarServer/branches/users/glyph/migrate-merge/twext:8690-8713
</span><span class="cx">/CalendarServer/branches/users/glyph/misc-portability-fixes/twext:7365-7374
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-6/twext:6322-6368
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-7/twext:6369-6445
</span><span class="cx">/CalendarServer/branches/users/glyph/multiget-delete/twext:8321-8330
</span><span class="cx">/CalendarServer/branches/users/glyph/new-export/twext:7444-7485
</span><span class="cx">/CalendarServer/branches/users/glyph/one-home-list-api/twext:10048-10073
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle-nulls/twext:7340-7351
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle/twext:7106-7155
</span><span class="cx">/CalendarServer/branches/users/glyph/other-html/twext:8062-8091
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-sim/twext:8240-8251
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade/twext:8376-8400
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade_to_1/twext:8571-8583
</span><span class="cx">/CalendarServer/branches/users/glyph/q/twext:9560-9688
</span><span class="cx">/CalendarServer/branches/users/glyph/queue-locking-and-timing/twext:10204-10289
</span><span class="cx">/CalendarServer/branches/users/glyph/quota/twext:7604-7637
</span><span class="cx">/CalendarServer/branches/users/glyph/sendfdport/twext:5388-5424
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-fixes/twext:8436-8443
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-take2/twext:8155-8174
</span><span class="cx">/CalendarServer/branches/users/glyph/sharedpool/twext:6490-6550
</span><span class="cx">/CalendarServer/branches/users/glyph/sharing-api/twext:9192-9205
</span><span class="cx">/CalendarServer/branches/users/glyph/skip-lonely-vtimezones/twext:8524-8535
</span><span class="cx">/CalendarServer/branches/users/glyph/sql-store/twext:5929-6073
</span><span class="cx">/CalendarServer/branches/users/glyph/start-service-start-loop/twext:11060-11065
</span><span class="cx">/CalendarServer/branches/users/glyph/subtransactions/twext:7248-7258
</span><span class="cx">/CalendarServer/branches/users/glyph/table-alias/twext:8651-8664
</span><span class="cx">/CalendarServer/branches/users/glyph/uidexport/twext:7673-7676
</span><span class="cx">/CalendarServer/branches/users/glyph/unshare-when-access-revoked/twext:10562-10595
</span><span class="cx">/CalendarServer/branches/users/glyph/use-system-twisted/twext:5084-5149
</span><span class="cx">/CalendarServer/branches/users/glyph/uuid-normalize/twext:9268-9296
</span><span class="cx">/CalendarServer/branches/users/glyph/warning-cleanups/twext:11347-11357
</span><span class="cx">/CalendarServer/branches/users/glyph/whenNotProposed/twext:11881-11897
</span><span class="cx">/CalendarServer/branches/users/glyph/xattrs-from-files/twext:7757-7769
</span><span class="cx">/CalendarServer/branches/users/sagen/applepush/twext:8126-8184
</span><span class="cx">/CalendarServer/branches/users/sagen/inboxitems/twext:7380-7381
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources-2/twext:5052-5061
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources/twext:5032-5051
</span><span class="cx">/CalendarServer/branches/users/sagen/purge_old_events/twext:6735-6746
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4038/twext:4040-4067
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4066/twext:4068-4075
</span><span class="cx">/CalendarServer/branches/users/sagen/resources-2/twext:5084-5093
</span><span class="cx">/CalendarServer/branches/users/sagen/testing/twext:10827-10851,10853-10855
</span><span class="cx">/CalendarServer/branches/users/wsanchez/transations/twext:5515-5593
</span><span class="cx">/twext/branches/users/cdaboo/jobqueue-3/twext:13444-13471
</span><span class="cx">/twext/branches/users/cdaboo/jobs/twext:12742-12780
</span><span class="cx">/twext/branches/users/cdaboo/pod2pod-migration/twext:14416-14520
</span><span class="cx">/twext/branches/users/sagen/recordtypes-2/twext:13659
</span><span class="cx">/twext/branches/users/sagen/recordtypes/twext:13647-13658
</span><a id="twexttrunktwextenterprisedalrecordpy"></a>
<div class="modfile"><h4>Modified: twext/trunk/twext/enterprise/dal/record.py (14520 => 14521)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/twext/enterprise/dal/record.py        2015-03-06 21:20:35 UTC (rev 14520)
+++ twext/trunk/twext/enterprise/dal/record.py        2015-03-06 21:39:59 UTC (rev 14521)
</span><span class="lines">@@ -171,6 +171,18 @@
</span><span class="cx">         return r
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    def __hash__(self):
+        return hash(tuple([getattr(self, attr) for attr in self.__attrmap__.keys()]))
+
+
+    def __eq__(self, other):
+        if type(self) != type(other):
+            return False
+        attrs = dict([(attr, getattr(self, attr),) for attr in self.__attrmap__.keys()])
+        otherattrs = dict([(attr, getattr(other, attr),) for attr in other.__attrmap__.keys()])
+        return attrs == otherattrs
+
+
</ins><span class="cx">     @classmethod
</span><span class="cx">     def fromTable(cls, table):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="lines">@@ -198,7 +210,7 @@
</span><span class="cx">         words = columnName.lower().split(&quot;_&quot;)
</span><span class="cx"> 
</span><span class="cx">         def cap(word):
</span><del>-            if word.lower() == &quot;id&quot;:
</del><ins>+            if word.lower() in (&quot;id&quot;, &quot;uid&quot;, &quot;guid&quot;,):
</ins><span class="cx">                 return word.upper()
</span><span class="cx">             else:
</span><span class="cx">                 return word.capitalize()
</span><span class="lines">@@ -246,41 +258,50 @@
</span><span class="cx"> 
</span><span class="cx">             MyRecord.create(transaction, column1=1, column2=u&quot;two&quot;)
</span><span class="cx">         &quot;&quot;&quot;
</span><ins>+        self = cls.make(**k)
+        yield self.insert(transaction)
+        returnValue(self)
+
+
+    @classmethod
+    def make(cls, **k):
+        &quot;&quot;&quot;
+        Make a record without creating one in the database - this will not have an
+        associated L{transaction}. When the record is ready to be written to the database
+        use L{SerializeableRecord.insert} to add it. Before it gets written to the DB, the
+        attributes can be changed.
+        &quot;&quot;&quot;
</ins><span class="cx">         self = cls()
</span><del>-        colmap = {}
</del><span class="cx">         attrtocol = cls.__attrmap__
</span><del>-        needsCols = []
-        needsAttrs = []
</del><span class="cx"> 
</span><span class="cx">         for attr in attrtocol:
</span><span class="cx">             col = attrtocol[attr]
</span><span class="cx">             if attr in k:
</span><del>-                setattr(self, attr, k[attr])
-                colmap[col] = k.pop(attr)
</del><ins>+                value = k.pop(attr)
+                setattr(self, attr, value)
</ins><span class="cx">             else:
</span><span class="cx">                 if col.model.needsValue():
</span><span class="cx">                     raise TypeError(
</span><span class="cx">                         &quot;required attribute {0!r} not passed&quot;
</span><span class="cx">                         .format(attr)
</span><span class="cx">                     )
</span><del>-                else:
-                    needsCols.append(col)
-                    needsAttrs.append(attr)
</del><span class="cx"> 
</span><span class="cx">         if k:
</span><span class="cx">             raise TypeError(&quot;received unknown attribute{0}: {1}&quot;.format(
</span><span class="cx">                 &quot;s&quot; if len(k) &gt; 1 else &quot;&quot;, &quot;, &quot;.join(sorted(k))
</span><span class="cx">             ))
</span><del>-        result = yield (Insert(colmap, Return=needsCols if needsCols else None)
-                        .on(transaction))
-        if needsCols:
-            self._attributesFromRow(zip(needsAttrs, result[0]))
</del><span class="cx"> 
</span><del>-        self.transaction = transaction
</del><ins>+        return self
</ins><span class="cx"> 
</span><del>-        returnValue(self)
</del><span class="cx"> 
</span><ins>+    def duplicate(self):
+        return self.make(**dict([(attr, getattr(self, attr),) for attr in self.__attrmap__.keys()]))
</ins><span class="cx"> 
</span><ins>+
+    def isnew(self):
+        return self.transaction is None
+
+
</ins><span class="cx">     def _attributesFromRow(self, attributeList):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Take some data loaded from a row and apply it to this instance,
</span><span class="lines">@@ -296,6 +317,46 @@
</span><span class="cx">             setattr(self, setAttribute, setValue)
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    @inlineCallbacks
+    def insert(self, transaction):
+        &quot;&quot;&quot;
+        Insert a new a row for an existing record that was not initially created in the database.
+        &quot;&quot;&quot;
+
+        # Cannot do this if a transaction has already been assigned because that means
+        # the record already exists in the DB.
+
+        if self.transaction is not None:
+            raise ReadOnly(self.__class__.__name__, &quot;Cannot insert&quot;)
+
+        colmap = {}
+        attrtocol = self.__attrmap__
+        needsCols = []
+        needsAttrs = []
+
+        for attr in attrtocol:
+            col = attrtocol[attr]
+            v = getattr(self, attr)
+            if not isinstance(v, ColumnSyntax):
+                colmap[col] = v
+            else:
+                if col.model.needsValue():
+                    raise TypeError(
+                        &quot;required attribute {0!r} not passed&quot;
+                        .format(attr)
+                    )
+                else:
+                    needsCols.append(col)
+                    needsAttrs.append(attr)
+
+        result = yield (Insert(colmap, Return=needsCols if needsCols else None)
+                        .on(transaction))
+        if needsCols:
+            self._attributesFromRow(zip(needsAttrs, result[0]))
+
+        self.transaction = transaction
+
+
</ins><span class="cx">     def delete(self):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Delete this row from the database.
</span><span class="lines">@@ -411,7 +472,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @classmethod
</span><del>-    def query(cls, transaction, expr, order=None, ascending=True, group=None, forUpdate=False, noWait=False, limit=None):
</del><ins>+    def query(cls, transaction, expr, order=None, group=None, limit=None, forUpdate=False, noWait=False, ascending=True, distinct=False):
</ins><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Query the table that corresponds to C{cls}, and return instances of
</span><span class="cx">         C{cls} corresponding to the rows that are returned from that table.
</span><span class="lines">@@ -435,30 +496,87 @@
</span><span class="cx">         @param noWait: include NOWAIT with the FOR UPDATE
</span><span class="cx">         @type noWait: L{bool}
</span><span class="cx">         &quot;&quot;&quot;
</span><ins>+        return cls._rowsFromQuery(
+            transaction,
+            cls.queryExpr(
+                expr,
+                order=order,
+                group=group,
+                limit=limit,
+                forUpdate=forUpdate,
+                noWait=noWait,
+                ascending=ascending,
+                distinct=distinct,
+            ),
+            None
+        )
+
+
+    @classmethod
+    def queryExpr(cls, expr, attributes=None, order=None, group=None, limit=None, forUpdate=False, noWait=False, ascending=True, distinct=False):
+        &quot;&quot;&quot;
+        Query expression that corresponds to C{cls}. Used in cases where a sub-select
+        on this record's table is needed.
+
+        @param expr: An L{ExpressionSyntax} that constraints the results of the
+            query.  This is most easily produced by accessing attributes on the
+            class; for example, C{MyRecordType.query((MyRecordType.col1 &gt;
+            MyRecordType.col2).And(MyRecordType.col3 == 7))}
+
+        @param order: A L{ColumnSyntax} to order the resulting record objects
+            by.
+
+        @param ascending: A boolean; if C{order} is not C{None}, whether to
+            sort in ascending or descending order.
+
+        @param group: a L{ColumnSyntax} to group the resulting record objects
+            by.
+
+        @param forUpdate: do a SELECT ... FOR UPDATE
+        @type forUpdate: L{bool}
+        @param noWait: include NOWAIT with the FOR UPDATE
+        @type noWait: L{bool}
+        &quot;&quot;&quot;
</ins><span class="cx">         kw = {}
</span><span class="cx">         if order is not None:
</span><span class="cx">             kw.update(OrderBy=order, Ascending=ascending)
</span><span class="cx">         if group is not None:
</span><span class="cx">             kw.update(GroupBy=group)
</span><ins>+        if limit is not None:
+            kw.update(Limit=limit)
</ins><span class="cx">         if forUpdate:
</span><span class="cx">             kw.update(ForUpdate=True)
</span><span class="cx">             if noWait:
</span><span class="cx">                 kw.update(NoWait=True)
</span><del>-        if limit is not None:
-            kw.update(Limit=limit)
-        return cls._rowsFromQuery(
-            transaction,
-            Select(
-                list(cls.table),
-                From=cls.table,
-                Where=expr,
-                **kw
-            ),
-            None
</del><ins>+        if distinct:
+            kw.update(Distinct=True)
+        if attributes is None:
+            attributes = list(cls.table)
+        return Select(
+            attributes,
+            From=cls.table,
+            Where=expr,
+            **kw
</ins><span class="cx">         )
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @classmethod
</span><ins>+    def querysimple(cls, transaction, **kw):
+        &quot;&quot;&quot;
+        Match all rows matching the specified attribute/values from the table that corresponds to C{cls}.
+        All attributes are logically AND'ed.
+        &quot;&quot;&quot;
+        where = None
+        for k, v in kw.iteritems():
+            subexpr = (cls.__attrmap__[k] == v)
+            if where is None:
+                where = subexpr
+            else:
+                where = where.And(subexpr)
+        return cls.query(transaction, where)
+
+
+    @classmethod
</ins><span class="cx">     def all(cls, transaction):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Load all rows from the table that corresponds to C{cls} and return
</span><span class="lines">@@ -484,17 +602,34 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @classmethod
</span><del>-    def deletesome(cls, transaction, where):
</del><ins>+    def deletesome(cls, transaction, where, returnCols=None):
</ins><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Delete all rows matching the where expression from the table that corresponds to C{cls}.
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         return Delete(
</span><span class="cx">             From=cls.table,
</span><span class="cx">             Where=where,
</span><ins>+            Return=returnCols,
</ins><span class="cx">         ).on(transaction)
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @classmethod
</span><ins>+    def deletesimple(cls, transaction, **kw):
+        &quot;&quot;&quot;
+        Delete all rows matching the specified attribute/values from the table that corresponds to C{cls}.
+        All attributes are logically AND'ed.
+        &quot;&quot;&quot;
+        where = None
+        for k, v in kw.iteritems():
+            subexpr = (cls.__attrmap__[k] == v)
+            if where is None:
+                where = subexpr
+            else:
+                where = where.And(subexpr)
+        return cls.deletesome(transaction, where)
+
+
+    @classmethod
</ins><span class="cx">     @inlineCallbacks
</span><span class="cx">     def _rowsFromQuery(cls, transaction, qry, rozrc):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="lines">@@ -521,3 +656,61 @@
</span><span class="cx">             self.transaction = transaction
</span><span class="cx">             selves.append(self)
</span><span class="cx">         returnValue(selves)
</span><ins>+
+
+
+class SerializableRecord(Record):
+    &quot;&quot;&quot;
+    An L{Record} that serializes/deserializes its attributes for a text-based
+    transport (e.g., JSON-over-HTTP) to allow records to be transferred from
+    one system to another (with potentially mismatched schemas).
+    &quot;&quot;&quot;
+
+    def serialize(self):
+        &quot;&quot;&quot;
+        Create an L{dict} of each attribute with L{str} values for each attribute
+        value. Sub-classes may need to override this to specialize certain value
+        conversions.
+
+        @return: mapping of attribute to string values
+        @rtype: L{dict} of L{str}:L{str}
+        &quot;&quot;&quot;
+
+        # Certain values have to be mapped to str
+        result = {}
+        for attr in self.__attrmap__:
+            value = getattr(self, attr)
+            col = self.__attrmap__[attr]
+            if col.model.type.name == &quot;timestamp&quot; and value is not None:
+                value = str(value)
+            result[attr] = value
+        return result
+
+
+    @classmethod
+    def deserialize(cls, attrmap):
+        &quot;&quot;&quot;
+        Given an L{dict} mapping attributes to values, create an L{Record} with
+        the specified values. Sub-classes may need to override this to handle special
+        values that need to be converted to specific types. They also need to override
+        this to handle possible schema mismatches (attributes no longer used, new
+        attributes not present in the map).
+
+        @param attrmap: serialized representation of a record
+        @type attrmap: L{dict} of L{str}:L{str}
+
+        @return: a newly created, but not inserted, record
+        @rtype: L{SerializableRecord}
+        &quot;&quot;&quot;
+
+        # Certain values have to be mapped to non-str types
+        mapped = {}
+        for attr in attrmap:
+            value = attrmap[attr]
+            col = cls.__attrmap__[attr]
+            if col.model.type.name == &quot;timestamp&quot; and value is not None:
+                value = parseSQLTimestamp(value)
+            mapped[attr] = value
+
+        record = cls.make(**mapped)
+        return record
</ins></span></pre></div>
<a id="twexttrunktwextenterprisedalsyntaxpy"></a>
<div class="modfile"><h4>Modified: twext/trunk/twext/enterprise/dal/syntax.py (14520 => 14521)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/twext/enterprise/dal/syntax.py        2015-03-06 21:20:35 UTC (rev 14520)
+++ twext/trunk/twext/enterprise/dal/syntax.py        2015-03-06 21:39:59 UTC (rev 14521)
</span><span class="lines">@@ -439,6 +439,8 @@
</span><span class="cx">                     &quot;{} expression needs an explicit count of parameters&quot;.format(op.upper())
</span><span class="cx">                 )
</span><span class="cx">             return CompoundComparison(self, op, Constant(other))
</span><ins>+        elif isinstance(other, set) or isinstance(other, frozenset) or isinstance(other, list) or isinstance(other, tuple):
+            return CompoundComparison(self, op, Constant(other))
</ins><span class="cx">         else:
</span><span class="cx">             # Can't be Select.__contains__ because __contains__ gets
</span><span class="cx">             # __nonzero__ called on its result by the &quot;in&quot; syntax.
</span><span class="lines">@@ -548,6 +550,13 @@
</span><span class="cx">                     for counter in range(self.value.count)
</span><span class="cx">                 ]).subSQL(queryGenerator, allTables)
</span><span class="cx">             )
</span><ins>+        elif isinstance(self.value, set) or isinstance(self.value, frozenset) or isinstance(self.value, list) or isinstance(self.value, tuple):
+            return _inParens(
+                _CommaList([
+                    SQLFragment(queryGenerator.placeholder.placeholder(), [value])
+                    for value in self.value
+                ]).subSQL(queryGenerator, allTables)
+            )
</ins><span class="cx">         else:
</span><span class="cx">             return SQLFragment(
</span><span class="cx">                 queryGenerator.placeholder.placeholder(), [self.value]
</span></span></pre></div>
<a id="twexttrunktwextenterprisedaltesttest_recordpy"></a>
<div class="modfile"><h4>Modified: twext/trunk/twext/enterprise/dal/test/test_record.py (14520 => 14521)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/twext/enterprise/dal/test/test_record.py        2015-03-06 21:20:35 UTC (rev 14520)
+++ twext/trunk/twext/enterprise/dal/test/test_record.py        2015-03-06 21:39:59 UTC (rev 14521)
</span><span class="lines">@@ -24,8 +24,8 @@
</span><span class="cx"> from twisted.trial.unittest import TestCase, SkipTest
</span><span class="cx"> 
</span><span class="cx"> from twext.enterprise.dal.record import (
</span><del>-    Record, fromTable, ReadOnly, NoSuchRecord
-)
</del><ins>+    Record, fromTable, ReadOnly, NoSuchRecord,
+    SerializableRecord)
</ins><span class="cx"> from twext.enterprise.dal.test.test_parseschema import SchemaTestHelper
</span><span class="cx"> from twext.enterprise.dal.syntax import SchemaSyntax
</span><span class="cx"> from twext.enterprise.fixtures import buildConnectionPool
</span><span class="lines">@@ -67,6 +67,13 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+class TestSerializeRecord(SerializableRecord, Alpha):
+    &quot;&quot;&quot;
+    A sample test serializable record with default values specified.
+    &quot;&quot;&quot;
+
+
+
</ins><span class="cx"> class TestAutoRecord(Record, Delta):
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     A sample test record with default values specified.
</span><span class="lines">@@ -300,6 +307,44 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @inlineCallbacks
</span><ins>+    def test_querySimple(self):
+        &quot;&quot;&quot;
+        L{Record.querysimple} will allow you to query for a record by its class
+        attributes as columns.
+        &quot;&quot;&quot;
+        txn = self.pool.connection()
+        for beta, gamma in [(123, u&quot;one&quot;), (234, u&quot;two&quot;), (345, u&quot;three&quot;),
+                            (356, u&quot;three&quot;), (456, u&quot;four&quot;)]:
+            yield txn.execSQL(&quot;insert into ALPHA values (:1, :2)&quot;,
+                              [beta, gamma])
+        records = yield TestRecord.querysimple(txn, gamma=u&quot;three&quot;)
+        self.assertEqual(len(records), 2)
+        records.sort(key=lambda x: x.beta)
+        self.assertEqual(records[0].beta, 345)
+        self.assertEqual(records[1].beta, 356)
+
+
+    @inlineCallbacks
+    def test_eq(self):
+        &quot;&quot;&quot;
+        L{Record.__eq__} works.
+        &quot;&quot;&quot;
+        txn = self.pool.connection()
+        data = [(123, u&quot;one&quot;), (456, u&quot;four&quot;), (345, u&quot;three&quot;),
+                (234, u&quot;two&quot;), (356, u&quot;three&quot;)]
+        for beta, gamma in data:
+            yield txn.execSQL(&quot;insert into ALPHA values (:1, :2)&quot;,
+                              [beta, gamma])
+
+        one = yield TestRecord.load(txn, 123)
+        one_copy = yield TestRecord.load(txn, 123)
+        two = yield TestRecord.load(txn, 234)
+
+        self.assertTrue(one == one_copy)
+        self.assertFalse(one == two)
+
+
+    @inlineCallbacks
</ins><span class="cx">     def test_all(self):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         L{Record.all} will return all instances of the record, sorted by
</span><span class="lines">@@ -335,6 +380,48 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @inlineCallbacks
</span><ins>+    def test_deletesome(self):
+        &quot;&quot;&quot;
+        L{Record.deletesome} will delete all instances of the matching records.
+        &quot;&quot;&quot;
+        txn = self.pool.connection()
+        data = [(123, u&quot;one&quot;), (456, u&quot;four&quot;), (345, u&quot;three&quot;),
+                (234, u&quot;two&quot;), (356, u&quot;three&quot;)]
+        for beta, gamma in data:
+            yield txn.execSQL(&quot;insert into ALPHA values (:1, :2)&quot;,
+                              [beta, gamma])
+
+        yield TestRecord.deletesome(txn, TestRecord.gamma == u&quot;three&quot;)
+        all = yield TestRecord.all(txn)
+        self.assertEqual(set([record.beta for record in all]), set((123, 456, 234,)))
+
+        yield TestRecord.deletesome(txn, (TestRecord.gamma == u&quot;one&quot;).Or(TestRecord.gamma == u&quot;two&quot;))
+        all = yield TestRecord.all(txn)
+        self.assertEqual(set([record.beta for record in all]), set((456,)))
+
+
+    @inlineCallbacks
+    def test_deletesimple(self):
+        &quot;&quot;&quot;
+        L{Record.deletesimple} will delete all instances of the matching records.
+        &quot;&quot;&quot;
+        txn = self.pool.connection()
+        data = [(123, u&quot;one&quot;), (456, u&quot;four&quot;), (345, u&quot;three&quot;),
+                (234, u&quot;two&quot;), (356, u&quot;three&quot;)]
+        for beta, gamma in data:
+            yield txn.execSQL(&quot;insert into ALPHA values (:1, :2)&quot;,
+                              [beta, gamma])
+
+        yield TestRecord.deletesimple(txn, gamma=u&quot;three&quot;)
+        all = yield TestRecord.all(txn)
+        self.assertEqual(set([record.beta for record in all]), set((123, 456, 234,)))
+
+        yield TestRecord.deletesimple(txn, beta=123, gamma=u&quot;one&quot;)
+        all = yield TestRecord.all(txn)
+        self.assertEqual(set([record.beta for record in all]), set((456, 234)))
+
+
+    @inlineCallbacks
</ins><span class="cx">     def test_repr(self):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         The C{repr} of a L{Record} presents all its values.
</span><span class="lines">@@ -458,3 +545,59 @@
</span><span class="cx">         rec = yield TestRecord.load(txn, 234)
</span><span class="cx">         result = yield rec.trylock()
</span><span class="cx">         self.assertTrue(result)
</span><ins>+
+
+    @inlineCallbacks
+    def test_serialize(self):
+        &quot;&quot;&quot;
+        A L{SerializableRecord} may be serialized.
+        &quot;&quot;&quot;
+        txn = self.pool.connection()
+        for beta, gamma in [
+            (123, u&quot;one&quot;),
+            (234, u&quot;two&quot;),
+            (345, u&quot;three&quot;),
+            (356, u&quot;three&quot;),
+            (456, u&quot;four&quot;),
+        ]:
+            yield txn.execSQL(
+                &quot;insert into ALPHA values (:1, :2)&quot;, [beta, gamma]
+            )
+
+        rec = yield TestSerializeRecord.load(txn, 234)
+        result = rec.serialize()
+        self.assertEqual(result, {&quot;beta&quot;: 234, &quot;gamma&quot;: u&quot;two&quot;})
+
+
+    @inlineCallbacks
+    def test_deserialize(self):
+        &quot;&quot;&quot;
+        A L{SerializableRecord} may be deserialized.
+        &quot;&quot;&quot;
+        txn = self.pool.connection()
+
+        rec = yield TestSerializeRecord.deserialize({&quot;beta&quot;: 234, &quot;gamma&quot;: u&quot;two&quot;})
+        yield rec.insert(txn)
+        yield txn.commit()
+
+        txn = self.pool.connection()
+        rec = yield TestSerializeRecord.query(txn, TestSerializeRecord.beta == 234)
+        self.assertEqual(len(rec), 1)
+        self.assertEqual(rec[0].gamma, u&quot;two&quot;)
+        yield txn.commit()
+
+        # Check that attributes can be changed prior to insert, and not after
+        txn = self.pool.connection()
+        rec = yield TestSerializeRecord.deserialize({&quot;beta&quot;: 456, &quot;gamma&quot;: u&quot;one&quot;})
+        rec.gamma = u&quot;four&quot;
+        yield rec.insert(txn)
+        def _raise():
+            rec.gamma = u&quot;five&quot;
+        self.assertRaises(ReadOnly, _raise)
+        yield txn.commit()
+
+        txn = self.pool.connection()
+        rec = yield TestSerializeRecord.query(txn, TestSerializeRecord.beta == 456)
+        self.assertEqual(len(rec), 1)
+        self.assertEqual(rec[0].gamma, u&quot;four&quot;)
+        yield txn.commit()
</ins></span></pre></div>
<a id="twexttrunktwextenterprisedaltesttest_sqlsyntaxpy"></a>
<div class="modfile"><h4>Modified: twext/trunk/twext/enterprise/dal/test/test_sqlsyntax.py (14520 => 14521)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/twext/enterprise/dal/test/test_sqlsyntax.py        2015-03-06 21:20:35 UTC (rev 14520)
+++ twext/trunk/twext/enterprise/dal/test/test_sqlsyntax.py        2015-03-06 21:39:59 UTC (rev 14521)
</span><span class="lines">@@ -1006,6 +1006,90 @@
</span><span class="cx">         )
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    def test_inIterable(self):
+        &quot;&quot;&quot;
+        L{ColumnSyntax.In} returns a sub-expression using the SQL C{in} syntax
+        with parameter list.
+        &quot;&quot;&quot;
+        # One item with IN only
+        items = set((&quot;A&quot;,))
+        for items in (set(items), list(items), tuple(items),):
+            self.assertEquals(
+                Select(
+                    From=self.schema.FOO,
+                    Where=self.schema.FOO.BAR.In(items),
+                ).toSQL().bind(),
+                SQLFragment(&quot;select * from FOO where BAR in (?)&quot;, [&quot;A&quot;])
+            )
+
+        # Two items with IN only
+        items = set((&quot;A&quot;, &quot;B&quot;))
+        for items in (set(items), list(items), tuple(items),):
+            self.assertEquals(
+                Select(
+                    From=self.schema.FOO,
+                    Where=self.schema.FOO.BAR.In(items),
+                ).toSQL().bind(names=items),
+                SQLFragment(
+                    &quot;select * from FOO where BAR in (?, ?)&quot;, [&quot;A&quot;, &quot;B&quot;]
+                )
+            )
+
+            # Two items with preceding AND
+            self.assertEquals(
+                Select(
+                    From=self.schema.FOO,
+                    Where=(
+                        (
+                            self.schema.FOO.BAZ == Parameter(&quot;P1&quot;)
+                        ).And(
+                            self.schema.FOO.BAR.In(items)
+                        )
+                    )
+                ).toSQL().bind(P1=&quot;P1&quot;),
+                SQLFragment(
+                    &quot;select * from FOO where BAZ = ? and BAR in (?, ?)&quot;,
+                    [&quot;P1&quot;, &quot;A&quot;, &quot;B&quot;]
+                ),
+            )
+
+            # Two items with following AND
+            self.assertEquals(
+                Select(
+                    From=self.schema.FOO,
+                    Where=(
+                        (
+                            self.schema.FOO.BAR.In(items)
+                        ).And(
+                            self.schema.FOO.BAZ == Parameter(&quot;P2&quot;)
+                        )
+                    )
+                ).toSQL().bind(P2=&quot;P2&quot;),
+                SQLFragment(
+                    &quot;select * from FOO where BAR in (?, ?) and BAZ = ?&quot;,
+                    [&quot;A&quot;, &quot;B&quot;, &quot;P2&quot;]
+                ),
+            )
+
+            # Two items with preceding OR and following AND
+            self.assertEquals(
+                Select(
+                    From=self.schema.FOO,
+                    Where=((
+                        self.schema.FOO.BAZ == Parameter(&quot;P1&quot;)
+                    ).Or(
+                        self.schema.FOO.BAR.In(items).And(
+                            self.schema.FOO.BAZ == Parameter(&quot;P2&quot;)
+                        )
+                    ))
+                ).toSQL().bind(P1=&quot;P1&quot;, P2=&quot;P2&quot;),
+                SQLFragment(
+                    &quot;select * from FOO where BAZ = ? or BAR in (?, ?) and BAZ = ?&quot;,
+                    [&quot;P1&quot;, &quot;A&quot;, &quot;B&quot;, &quot;P2&quot;]
+                ),
+            )
+
+
</ins><span class="cx">     def test_max(self):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         L{Max}C{(column)} produces an object in the C{columns} clause that
</span></span></pre>
</div>
</div>

</body>
</html>