[CPS-devel] Creating documents with CPSRemoteController

Juan Lago Cabrera juan.lago at iavantefundacion.com
Thu Mar 30 10:07:50 CEST 2006


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:%s@%s:%s/%s/portal_remote_controller <http://%25s:%25s@%25s:%25s/%25s/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 
Coordinador de Proyecto 
FUNDACIÓN IAVANTE 
juan.lago at iavantefundacion.com 
Tel. 951 015 300 

 

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.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.nuxeo.com/pipermail/cps-devel/attachments/20060330/4621270e/attachment-0001.html


More information about the cps-devel mailing list
More information about CPS: CPS project - CVS - API

Hosting: Nuxeo: Zope service provider


This list archive provided by Nuxeo, the leaders of open source ECM. Check out the Nuxeo 5 open source, standards-based ECM project.