<!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>[12430] CalendarServer/branches/users/cdaboo/pod-migration/txdav</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/12430">12430</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2014-01-22 19:26:38 -0800 (Wed, 22 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Checkpoint: cross-pod serialization of properties.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServerbranchesuserscdaboopodmigrationtxdavbasepropertystorebasepy">CalendarServer/branches/users/cdaboo/pod-migration/txdav/base/propertystore/base.py</a></li>
<li><a href="#CalendarServerbranchesuserscdaboopodmigrationtxdavbasepropertystoresqlpy">CalendarServer/branches/users/cdaboo/pod-migration/txdav/base/propertystore/sql.py</a></li>
<li><a href="#CalendarServerbranchesuserscdaboopodmigrationtxdavcommondatastorepoddingconduitpy">CalendarServer/branches/users/cdaboo/pod-migration/txdav/common/datastore/podding/conduit.py</a></li>
<li><a href="#CalendarServerbranchesuserscdaboopodmigrationtxdavcommondatastorepoddingtesttest_conduitpy">CalendarServer/branches/users/cdaboo/pod-migration/txdav/common/datastore/podding/test/test_conduit.py</a></li>
<li><a href="#CalendarServerbranchesuserscdaboopodmigrationtxdavcommondatastoresqlpy">CalendarServer/branches/users/cdaboo/pod-migration/txdav/common/datastore/sql.py</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#CalendarServerbranchesuserscdaboopodmigrationtxdavbasepropertystorememorypy">CalendarServer/branches/users/cdaboo/pod-migration/txdav/base/propertystore/memory.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServerbranchesuserscdaboopodmigrationtxdavbasepropertystorebasepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/cdaboo/pod-migration/txdav/base/propertystore/base.py (12429 => 12430)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/cdaboo/pod-migration/txdav/base/propertystore/base.py        2014-01-23 02:20:26 UTC (rev 12429)
+++ CalendarServer/branches/users/cdaboo/pod-migration/txdav/base/propertystore/base.py        2014-01-23 03:26:38 UTC (rev 12430)
</span><span class="lines">@@ -13,6 +13,7 @@
</span><span class="cx"> # See the License for the specific language governing permissions and
</span><span class="cx"> # limitations under the License.
</span><span class="cx"> ##
</span><ins>+from twisted.internet.defer import inlineCallbacks
</ins><span class="cx"> 
</span><span class="cx"> &quot;&quot;&quot;
</span><span class="cx"> Base property store.
</span><span class="lines">@@ -254,15 +255,33 @@
</span><span class="cx">         return key in self._globalKeys
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    @inlineCallbacks
</ins><span class="cx">     def copyAllProperties(self, other):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Copy all the properties from another store into this one. This needs to be done
</span><del>-        independently of the UID. Each underlying store will need to implement this.
</del><ins>+        independently of the UID.
</ins><span class="cx">         &quot;&quot;&quot;
</span><del>-        pass
</del><span class="cx"> 
</span><ins>+        other_props = yield other.serialize()
+        yield self.deserialize(other_props)
</ins><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    def serialize(self):
+        &quot;&quot;&quot;
+        Return a C{dict} of all properties, where the dict key is a C{tuple} of the property name
+        and the viewer UID, and the values are C{str} representations of the XML.
+        &quot;&quot;&quot;
+        raise NotImplementedError()
+
+
+    def deserialize(self, props):
+        &quot;&quot;&quot;
+        Copy all properties from the specified C{dict} into this store. The dict comes from an L{serialize} call.
+        &quot;&quot;&quot;
+        raise NotImplementedError()
+
+
+
</ins><span class="cx"> # FIXME: Actually, we should replace this with calls to IPropertyName()
</span><span class="cx"> def validKey(key):
</span><span class="cx">     # Used by implementations to verify that keys are valid
</span></span></pre></div>
<a id="CalendarServerbranchesuserscdaboopodmigrationtxdavbasepropertystorememorypy"></a>
<div class="addfile"><h4>Added: CalendarServer/branches/users/cdaboo/pod-migration/txdav/base/propertystore/memory.py (0 => 12430)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/cdaboo/pod-migration/txdav/base/propertystore/memory.py                                (rev 0)
+++ CalendarServer/branches/users/cdaboo/pod-migration/txdav/base/propertystore/memory.py        2014-01-23 03:26:38 UTC (rev 12430)
</span><span class="lines">@@ -0,0 +1,109 @@
</span><ins>+# -*- test-case-name: txdav.base.propertystore.test.test_xattr -*-
+##
+# Copyright (c) 2010-2014 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+from twisted.internet.defer import succeed
+
+&quot;&quot;&quot;
+Property store using a dict - read-only (except for initial insert). This is used
+to mirror properties on a resource on another pod.
+&quot;&quot;&quot;
+
+from txdav.base.propertystore.base import AbstractPropertyStore, validKey, \
+    PropertyName
+from txdav.idav import PropertyChangeNotAllowedError
+from txdav.xml.parser import WebDAVDocument
+
+
+__all__ = [
+    &quot;PropertyStore&quot;,
+]
+
+
+
+class PropertyStore(AbstractPropertyStore):
+    &quot;&quot;&quot;
+    Property store using a C{dict}. C{dict} keys are a C{tuple} of the property name and user
+    id (both as C{str}. Property values are the C{str} representation of the XML value.
+    &quot;&quot;&quot;
+
+    def __init__(self, defaultuser, properties):
+        &quot;&quot;&quot;
+        Initialize a L{PropertyStore}.
+        &quot;&quot;&quot;
+        super(PropertyStore, self).__init__(defaultuser)
+
+        self.properties = properties
+
+
+    def __str__(self):
+        return &quot;&lt;%s&gt;&quot; % (self.__class__.__name__)
+
+
+    #
+    # Required implementations
+    #
+
+    def _getitem_uid(self, key, uid):
+        validKey(key)
+        try:
+            value = self.properties[(key.toString(), uid)]
+        except KeyError:
+            raise KeyError(key)
+
+        return WebDAVDocument.fromString(value).root_element
+
+
+    def _setitem_uid(self, key, value, uid):
+        validKey(key)
+        raise PropertyChangeNotAllowedError(&quot;Property store is read-only.&quot;, (key,))
+
+
+    def _delitem_uid(self, key, uid):
+        validKey(key)
+        raise PropertyChangeNotAllowedError(&quot;Property store is read-only.&quot;, (key,))
+
+
+    def _keys_uid(self, uid):
+        for cachedKey, cachedUID in self.properties.keys():
+            if cachedUID == uid:
+                yield PropertyName.fromString(cachedKey)
+
+
+    def _removeResource(self):
+        pass
+
+
+    def flush(self):
+        return None
+
+
+    def abort(self):
+        return None
+
+
+    def serialize(self):
+        &quot;&quot;&quot;
+        The dict used in this class is already the serialized format.
+        &quot;&quot;&quot;
+        return succeed(self.properties)
+
+
+    def deserialize(self, props):
+        &quot;&quot;&quot;
+        The dict being passed in is already the format we need.
+        &quot;&quot;&quot;
+        self.properties = props
+        return succeed(None)
</ins></span></pre></div>
<a id="CalendarServerbranchesuserscdaboopodmigrationtxdavbasepropertystoresqlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/cdaboo/pod-migration/txdav/base/propertystore/sql.py (12429 => 12430)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/cdaboo/pod-migration/txdav/base/propertystore/sql.py        2014-01-23 02:20:26 UTC (rev 12429)
+++ CalendarServer/branches/users/cdaboo/pod-migration/txdav/base/propertystore/sql.py        2014-01-23 03:26:38 UTC (rev 12430)
</span><span class="lines">@@ -378,23 +378,43 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @inlineCallbacks
</span><del>-    def copyAllProperties(self, other):
</del><ins>+    def serialize(self):
</ins><span class="cx">         &quot;&quot;&quot;
</span><del>-        Copy all the properties from another store into this one. This needs to be done
-        independently of the UID.
</del><ins>+        Return a C{dict} of all properties, where the dict key is a C{tuple} of the property name
+        and the viewer UID, and the values are C{str} representations of the XML.
</ins><span class="cx">         &quot;&quot;&quot;
</span><ins>+        results = {}
+        rows = yield self._allWithID.on(self._txn, resourceID=self._resourceID)
+        for key_str, uid, value_str in rows:
+            results[(key_str, uid)] = value_str
+        returnValue(results)
</ins><span class="cx"> 
</span><del>-        rows = yield other._allWithID.on(other._txn, resourceID=other._resourceID)
-        for key_str, uid, value_str in rows:
-            wasCached = [(key_str, uid) in self._cached]
-            if wasCached[0]:
-                yield self._updateQuery.on(
-                    self._txn, resourceID=self._resourceID, value=value_str,
-                    name=key_str, uid=uid)
</del><ins>+
+    @inlineCallbacks
+    def deserialize(self, props):
+        &quot;&quot;&quot;
+        Copy all properties from the specified C{dict} into this store. The dict comes from an L{serialize} call.
+        &quot;&quot;&quot;
+
+        for key, value_str in props.items():
+            key_str, uid = key
+            if key in self._cached:
+                if self._cached[key] != value_str:
+                    yield self._updateQuery.on(
+                        self._txn,
+                        resourceID=self._resourceID,
+                        value=value_str,
+                        name=key_str,
+                        uid=uid
+                    )
</ins><span class="cx">             else:
</span><span class="cx">                 yield self._insertQuery.on(
</span><del>-                    self._txn, resourceID=self._resourceID, value=value_str,
-                    name=key_str, uid=uid)
</del><ins>+                    self._txn,
+                    resourceID=self._resourceID,
+                    value=value_str,
+                    name=key_str,
+                    uid=uid
+                )
</ins><span class="cx"> 
</span><span class="cx">         # Invalidate entire set of cached per-user data for this resource and reload
</span><span class="cx">         self._cached = {}
</span></span></pre></div>
<a id="CalendarServerbranchesuserscdaboopodmigrationtxdavcommondatastorepoddingconduitpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/cdaboo/pod-migration/txdav/common/datastore/podding/conduit.py (12429 => 12430)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/cdaboo/pod-migration/txdav/common/datastore/podding/conduit.py        2014-01-23 02:20:26 UTC (rev 12429)
+++ CalendarServer/branches/users/cdaboo/pod-migration/txdav/common/datastore/podding/conduit.py        2014-01-23 03:26:38 UTC (rev 12430)
</span><span class="lines">@@ -16,7 +16,7 @@
</span><span class="cx"> 
</span><span class="cx"> from twext.python.log import Logger
</span><span class="cx"> 
</span><del>-from twisted.internet.defer import inlineCallbacks, returnValue
</del><ins>+from twisted.internet.defer import inlineCallbacks, returnValue, maybeDeferred
</ins><span class="cx"> from twisted.python.reflect import namedClass
</span><span class="cx"> 
</span><span class="cx"> from txdav.caldav.datastore.scheduling.freebusy import generateFreeBusyInfo
</span><span class="lines">@@ -699,9 +699,11 @@
</span><span class="cx">                 &quot;message&quot;: str(e),
</span><span class="cx">             })
</span><span class="cx"> 
</span><ins>+        if transform is not None:
+            value = yield maybeDeferred(transform, value)
</ins><span class="cx">         returnValue({
</span><span class="cx">             &quot;result&quot;: &quot;ok&quot;,
</span><del>-            &quot;value&quot;: transform(value) if transform is not None else value,
</del><ins>+            &quot;value&quot;: value,
</ins><span class="cx">         })
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -794,8 +796,15 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @staticmethod
</span><ins>+    @inlineCallbacks
</ins><span class="cx">     def _to_externalize_list(value):
</span><del>-        return [v.externalize() for v in value] if value is not None else None
</del><ins>+        results = None
+        if value is not None:
+            results = []
+            for v in value:
+                v = yield v.externalize()
+                results.append(v)
+        returnValue(results)
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @classmethod
</span><span class="lines">@@ -970,7 +979,11 @@
</span><span class="cx">             action[&quot;keywords&quot;] = kwargs
</span><span class="cx">         result = yield self.sendRequest(target.transaction(), recipient, action)
</span><span class="cx">         if result[&quot;result&quot;] == &quot;ok&quot;:
</span><del>-            returnValue(result[&quot;value&quot;] if transform is None else transform(result[&quot;value&quot;]))
</del><ins>+            if transform is not None:
+                value = yield maybeDeferred(transform, result[&quot;value&quot;])
+            else:
+                value = result[&quot;value&quot;]
+            returnValue(value)
</ins><span class="cx">         elif result[&quot;result&quot;] == &quot;exception&quot;:
</span><span class="cx">             raise namedClass(result[&quot;class&quot;])(result[&quot;message&quot;])
</span><span class="cx"> 
</span><span class="lines">@@ -1005,9 +1018,11 @@
</span><span class="cx">                 &quot;message&quot;: str(e),
</span><span class="cx">             })
</span><span class="cx"> 
</span><ins>+        if transform is not None:
+            value = yield maybeDeferred(transform, value)
</ins><span class="cx">         returnValue({
</span><span class="cx">             &quot;result&quot;: &quot;ok&quot;,
</span><del>-            &quot;value&quot;: transform(value) if transform is not None else value,
</del><ins>+            &quot;value&quot;: value,
</ins><span class="cx">         })
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="CalendarServerbranchesuserscdaboopodmigrationtxdavcommondatastorepoddingtesttest_conduitpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/cdaboo/pod-migration/txdav/common/datastore/podding/test/test_conduit.py (12429 => 12430)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/cdaboo/pod-migration/txdav/common/datastore/podding/test/test_conduit.py        2014-01-23 02:20:26 UTC (rev 12429)
+++ CalendarServer/branches/users/cdaboo/pod-migration/txdav/common/datastore/podding/test/test_conduit.py        2014-01-23 03:26:38 UTC (rev 12430)
</span><span class="lines">@@ -1103,7 +1103,7 @@
</span><span class="cx">         remote_home = yield self.homeUnderTest(name=&quot;puser01&quot;, create=True)
</span><span class="cx">         remote_home._migration = _MIGRATION_STATUS_MIGRATING
</span><span class="cx"> 
</span><del>-        result = yield remote_home.get()
</del><ins>+        result = yield remote_home.getExternal()
</ins><span class="cx">         self.assertTrue(isinstance(result, CalendarHomeExternal))
</span><span class="cx">         self.assertEqual(result.name(), remote_home.name())
</span><span class="cx"> 
</span></span></pre></div>
<a id="CalendarServerbranchesuserscdaboopodmigrationtxdavcommondatastoresqlpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/cdaboo/pod-migration/txdav/common/datastore/sql.py (12429 => 12430)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/cdaboo/pod-migration/txdav/common/datastore/sql.py        2014-01-23 02:20:26 UTC (rev 12429)
+++ CalendarServer/branches/users/cdaboo/pod-migration/txdav/common/datastore/sql.py        2014-01-23 03:26:38 UTC (rev 12430)
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx"> from txdav.base.datastore.util import QueryCacher
</span><span class="cx"> from txdav.base.datastore.util import normalizeUUIDOrNot
</span><span class="cx"> from txdav.base.propertystore.base import PropertyName
</span><ins>+from txdav.base.propertystore.memory import PropertyStore as MemoryPropertyStore
</ins><span class="cx"> from txdav.base.propertystore.none import PropertyStore as NonePropertyStore
</span><span class="cx"> from txdav.base.propertystore.sql import PropertyStore
</span><span class="cx"> from txdav.caldav.icalendarstore import ICalendarTransaction, ICalendarStore
</span><span class="lines">@@ -1640,7 +1641,7 @@
</span><span class="cx"> 
</span><span class="cx">     @classmethod
</span><span class="cx">     @inlineCallbacks
</span><del>-    def makeClass(cls, txn, homeData, metadataData):
</del><ins>+    def makeClass(cls, txn, homeData, metadataData, properties=None):
</ins><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Build the actual home class taking into account the possibility that we might need to
</span><span class="cx">         switch in the external version of the class.
</span><span class="lines">@@ -1673,7 +1674,10 @@
</span><span class="cx">         for attr, value in zip(cls.metadataAttributes(), metadataData):
</span><span class="cx">             setattr(home, attr, value)
</span><span class="cx"> 
</span><del>-        yield home._loadPropertyStore()
</del><ins>+        if properties is None:
+            yield home._loadPropertyStore()
+        else:
+            home._propertyStore = MemoryPropertyStore(home.uid(), properties)
</ins><span class="cx"> 
</span><span class="cx">         for factory_type, factory in txn._notifierFactories.items():
</span><span class="cx">             home.addNotifier(factory_type, factory.newNotifier(home))
</span><span class="lines">@@ -1770,6 +1774,7 @@
</span><span class="cx">         return succeed(None)
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    @inlineCallbacks
</ins><span class="cx">     def externalize(self):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Create a dictionary mapping key attributes so this object can be sent over a cross-pod call
</span><span class="lines">@@ -1779,7 +1784,8 @@
</span><span class="cx">         serialized = {}
</span><span class="cx">         serialized[&quot;home&quot;] = dict([(attr[1:], getattr(self, attr, None)) for attr in self.homeAttributes()])
</span><span class="cx">         serialized[&quot;metadata&quot;] = dict([(attr[1:], getattr(self, attr, None)) for attr in self.metadataAttributes()])
</span><del>-        return serialized
</del><ins>+        serialized[&quot;properties&quot;] = (yield self.properties().serialize())
+        returnValue(serialized)
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @classmethod
</span><span class="lines">@@ -1794,7 +1800,7 @@
</span><span class="cx"> 
</span><span class="cx">         home = [mapping[&quot;home&quot;].get(row[1:]) for row in cls.homeAttributes()]
</span><span class="cx">         metadata = [mapping[&quot;metadata&quot;].get(row[1:]) for row in cls.metadataAttributes()]
</span><del>-        child = yield cls.makeClass(txn, home, metadata)
</del><ins>+        child = yield cls.makeClass(txn, home, metadata, properties=mapping[&quot;properties&quot;])
</ins><span class="cx">         returnValue(child)
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -4217,7 +4223,7 @@
</span><span class="cx"> 
</span><span class="cx">     @classmethod
</span><span class="cx">     @inlineCallbacks
</span><del>-    def makeClass(cls, home, bindData, additionalBindData, metadataData, propstore=None, ownerHome=None):
</del><ins>+    def makeClass(cls, home, bindData, additionalBindData, metadataData, propstore=None, ownerHome=None, properties=None):
</ins><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Given the various database rows, build the actual class.
</span><span class="cx"> 
</span><span class="lines">@@ -4281,11 +4287,14 @@
</span><span class="cx">             for attr, value in zip(child.metadataAttributes(), metadataData):
</span><span class="cx">                 setattr(child, attr, value)
</span><span class="cx"> 
</span><del>-        # We have to re-adjust the property store object to account for possible shared
-        # collections as previously we loaded them all as if they were owned
-        if propstore and bindMode != _BIND_MODE_OWN:
-            propstore._setDefaultUserUID(ownerHome.uid())
-        yield child._loadPropertyStore(propstore)
</del><ins>+        if properties is None:
+            # We have to re-adjust the property store object to account for possible shared
+            # collections as previously we loaded them all as if they were owned
+            if propstore and bindMode != _BIND_MODE_OWN:
+                propstore._setDefaultUserUID(ownerHome.uid())
+            yield child._loadPropertyStore(propstore)
+        else:
+            home._propertyStore = MemoryPropertyStore(ownerHome.uid(), properties)
</ins><span class="cx"> 
</span><span class="cx">         returnValue(child)
</span><span class="cx"> 
</span><span class="lines">@@ -4565,6 +4574,7 @@
</span><span class="cx">         returnValue(child)
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    @inlineCallbacks
</ins><span class="cx">     def externalize(self):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Create a dictionary mapping key attributes so this object can be sent over a cross-pod call
</span><span class="lines">@@ -4575,7 +4585,8 @@
</span><span class="cx">         serialized[&quot;bind&quot;] = dict([(attr[1:], getattr(self, attr, None)) for attr in self.bindAttributes()])
</span><span class="cx">         serialized[&quot;additionalBind&quot;] = dict([(attr[1:], getattr(self, attr, None)) for attr in self.additionalBindAttributes()])
</span><span class="cx">         serialized[&quot;metadata&quot;] = dict([(attr[1:], getattr(self, attr, None)) for attr in self.metadataAttributes()])
</span><del>-        return serialized
</del><ins>+        serialized[&quot;properties&quot;] = (yield self.properties().serialize())
+        returnValue(serialized)
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @classmethod
</span><span class="lines">@@ -4591,7 +4602,7 @@
</span><span class="cx">         bind = [mapping[&quot;bind&quot;].get(row[1:]) for row in cls.bindAttributes()]
</span><span class="cx">         additionalBind = [mapping[&quot;additionalBind&quot;].get(row[1:]) for row in cls.additionalBindAttributes()]
</span><span class="cx">         metadata = [mapping[&quot;metadata&quot;].get(row[1:]) for row in cls.metadataAttributes()]
</span><del>-        child = yield cls.makeClass(parent, bind, additionalBind, metadata)
</del><ins>+        child = yield cls.makeClass(parent, bind, additionalBind, metadata, properties=mapping[&quot;properties&quot;])
</ins><span class="cx">         returnValue(child)
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -5848,7 +5859,7 @@
</span><span class="cx">         and reconstituted at the other end. Note that the other end may have a different schema so
</span><span class="cx">         the attributes may not match exactly and will need to be processed accordingly.
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        return dict([(attr[1:], getattr(self, attr, None)) for attr in itertools.chain(self._rowAttributes(), self._otherSerializedAttributes())])
</del><ins>+        return succeed(dict([(attr[1:], getattr(self, attr, None)) for attr in itertools.chain(self._rowAttributes(), self._otherSerializedAttributes())]))
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     @classmethod
</span></span></pre>
</div>
</div>

</body>
</html>