Hi all,

I have been trying out ``zope.xmlpickle`` as a alternative to
XMLExportImport in Zope2. Seems to do the job just fine. Grab Zope
2.9.3 and install zope.xmlpickle by hand using something of the form:

 % cd /opt/Zope-2.9/lib/python/zope
 % svn checkout svn://svn.zope.org/repos/main/Zope3/trunk/src/zope/xmlpickle

Then using zopectl debug:

 >>> from zope.xmlpickle import dumps

Picking on something simple to start with:

 >>> xml = dumps(app.acl_users.aq_base)
 >>> print xml
 <?xml version="1.0" encoding="utf-8" ?>
 <pickle>
   <initialized_object>
     <klass>
       <global name="__newobj__" module="copy_reg"/>
     </klass>
     <arguments>
       <tuple>
         <global name="SiteErrorLog"
module="Products.SiteErrorLog.SiteErrorLog"/>
       </tuple>
     </arguments>
     <state>
       <dictionary>
         <item key="_ignored_exceptions">
             <tuple>
               <string>Unauthorized</string>
               <string>Redirect</string>
               <string>NotFound</string>
             </tuple>
         </item>
         <item key="copy_to_zlog">
             <true/>
         </item>
         <item key="keep_entries">
             <int>20</int>
         </item>
       </dictionary>
     </state>
   </initialized_object>
 </pickle>


That looks okay. But I strike problems with ``Missing.Value`` when
trying this on something that includes a catalog. The simplest way
to recreate the problem::

 >>> import Missing
 >>> dumps(Missing.Value())
 Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/opt/Zope-2.9/lib/python/zope/xmlpickle/xmlpickle.py", line
146, in dumps
     p = _dumpsUsing_PicklerThatSortsDictItems(ob, 1)
   File "/opt/Zope-2.9/lib/python/zope/xmlpickle/xmlpickle.py", line
73, in _dumpsUsing_PicklerThatSortsDictItems
     _PicklerThatSortsDictItems(file, bin).dump(object)
   File 
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/pickle.py",
line 231, in dump
     self.save(obj)
   File 
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/pickle.py",
line 324, in save
     self.save_global(obj, rv)
   File 
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/pickle.py",
line 753, in save_global
     module = whichmodule(obj, name)
   File 
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/pickle.py",
line 825, in whichmodule
     if func in classmap:
 TypeError: unhashable type

Meanwhile, dumps seems to work quite happy with many other examples
that I tried. Including all the content of a plone site minus a couple
of the catalogs. And ``zope.xmlpickle.loads`` seems to do the right thing too.

Any suggestions on getting a successful dumps of a Missing.Value?


Cheers
Michael
_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )

Reply via email to