--On Mittwoch, Mai 29, 2002 16:15:44 +0100 Toby Dickenson 
<[EMAIL PROTECTED]> wrote:

> On Wednesday 29 May 2002 3:24 pm, Joachim Schmitz wrote:
>> Hi,
>>
>> I want to acces a ZCatalog via xmlrpc, but
>>
>> server=xmlrpclib.Server("http://myserver.aixtraware.de";
>>                         ,BasicAuthTransport(username="user",password="pw
>>                         "))
>> r = server.Catalog()
>>
>> results in
>>
>> <Fault -1: "Unexpected Zope exception: cannot marshal <type
>> 'IOBTreeItems'> objects">
>>
>> What is to do, to enable marshalling of those types ?
>
> You could hack xmlrpclib to marshall those object, but I dont recommend
> it.  Those objects can be big (but lazily evaluated), and you would be
> opening a  significant denial of service vulnerability in your server.
But it also can be very interesting for exporting data from a Zope site, to 
be used in other applications.

>
> I suggest you create a method (Python Script?) that makes the catalog
> query,  sanitizes the response by making sure it is not too big, and
> returns a  vanilla list or dictionary
I wrote a little pythonscript to export data from a ZPatterns Rack, where 
the data is stored in a propertysheet:

res=context.Catalog()

t=[]
for m in  sequence.sort(res,(('reg_id','cmp','desc'),)):
    r=m.propertysheets.Basic.propertyItems()
    t.append(r)
return t

This runs fine, when I test the script. But when I access it with xmlrpc, I 
get:

<Fault -1: "Unexpected Zope exception: cannot marshal <type 'None'> 
objects">

I changed Zope xmlrpclib.py and added to the Marshaller class:

    def dump_None(self, value):
        self.write("<value><string>None</string></value>\n")
    dispatch[NoneType] = dump_None

Now that works, but I think the xmlrpclib.py, should be able to marshall 
the "None" type.





Mit freundlichen Grüßen                              Joachim Schmitz
--------------------------------------------------------------------
AixtraWare Ingenieurbüro für Internetanwendungen
Hüsgenstr. 33a, D-52457 Aldenhoven
Telefon: +49-2464-8851, FAX: +49-2464-905163
--------------------------------------------------------------------
Key fingerprint = DA10 CC82 62F8 1DBB 39A1  1EDC 725B 3317 A8D7 C3A6
Keyserver: http://www.keyserver.net/en/


_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to