|
Hi list,
I'm trying to create some documents in a CPS Default Site (3.4) from a client python application using CPSRemoteController. I have problems when creating a "News Item" with a photo (photo field in schema). I've used the xmlrpc Binary object (like File document examples in "Understanding and using the CPS Remote Controller") but when I access the News Item created in CPS it appears a blinking "!!!". If I try to edit the document created, there's an AttributeError: Binary instance has no attribute 'size'.
Am I using the correct field in schema? Is the right way using the Binary object?
Here you are the source code of the client application:
# -*- coding: ISO-8859-15 -*- from xmlrpclib import ServerProxy, Binary
SERVER = 'myIPaddress' PORT = '8081' PORTAL = 'myportal' USER = 'myuser' PWD = 'mypwd'
connectString = 'http://%s:[EMAIL PROTECTED]:%s/%s/portal_remote_controller' % (USER,PWD,SERVER,PORT,PORTAL) proxy = ServerProxy(connectString)
# Read image from file f = open('banner.jpg') binary = Binary(f.read()) f.close()
# Document definition doc_def = { 'Title': 'A news item example', 'Description': 'The description goes here', 'photo': binary, }
try: proxy.createDocument('News Item', doc_def, 'workspaces', 0, 'No comment') except: print 'Error'
print "End ---"
Thanks a lot Juan Lago Cabrera
Este correo electrónico y, en su caso, cualquier fichero anexo, contiene información confidencial exclusivamente dirigida a su(s) destinatario(s). Toda copia o divulgación deberá ser autorizada por IAVANTE. This e-mail and any attachments are confidential and exclusively directed to its adressee(s). Any copy or distribution will have to be authorized by IAVANTE.
|
_______________________________________________ cps-devel mailing list http://lists.nuxeo.com/mailman/listinfo/cps-devel
