Re: [Zope-dev] zope.xmlpickle

2006-05-26 Thread Michael Dunstan

On 5/26/06, Jim Fulton <[EMAIL PROTECTED]> wrote:

It would be nice to integrate this back into the export/import
machinery.


Yeah, I'd like to think I'll be able to find time to put this into Zope 2.11.


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

You need someone with pickle zen to look at this.  I don't have time
right now myself.  If you don't find any other takers, then put an
issue in the Zope 3 collector.


How about review of a trivial patch that is attached?

Michael


missing-hash.patch
Description: Binary data
___
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 )


Re: [Zope-dev] zope.xmlpickle

2006-05-26 Thread Jim Fulton

Michael Dunstan wrote:

Hi all,

I have been trying out ``zope.xmlpickle`` as a alternative to
XMLExportImport in Zope2.


Cool. xmlpickle is really a newer version of the xml pickler used in
Zope 2's export/import.  It's main goal is to provide nicer pickles:

- More readable

- More diff friendly.  It does this my:

  - sorting dictionary items

  - eliminating unused memo references

It would be nice to integrate this back into the export/import
machinery.  Some care would be needed to make it compatible with
the old xml pickles.

> 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
 
 
   
 
   
 
 
   
 
   
 
 
   
 
 
   Unauthorized
   Redirect
   NotFound
 
 
 
 
 
 
 20
 
   
 
   
 


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 "", 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?


You need someone with pickle zen to look at this.  I don't have time
right now myself.  If you don't find any other takers, then put an
issue in the Zope 3 collector.

Jim

--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.org
___
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 )


[Zope-dev] zope.xmlpickle

2006-05-26 Thread Michael Dunstan

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
 
 
   
 
   
 
 
   
 
   
 
 
   
 
 
   Unauthorized
   Redirect
   NotFound
 
 
 
 
 
 
 20
 
   
 
   
 


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 "", 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 )