[CPS-devel] CPS 3.4.3 portal_remote_controller - adding document content

Daniel Frings frings at webgis.de
Mon Mar 19 10:20:44 CET 2007


Hey all,
i'm trying to add some content to an CPS workspace with an external
python script and the portal_remote_controler.

My problem is that the document is created with a text block but the
textblock remains empty.

can anybody help me?
Here the code:

-----------------------------------------
from xmlrpclib import ServerProxy
import datetime
import time

date = datetime.datetime.utcfromtimestamp(time.time())
title='Daniel_Test_Document'
description='Test Description %s' % date

constr = 'http://XXX:YYY@localhost:8080/cps_test/portal_remote_controller'
p = ServerProxy(constr)


def test_createDocument(title, description):
   content_template ='''\
Content:

- Title: %s

- Description: %s
'''
   content = content_template % (title, description, )

   doc_def = {
       'Title': title,
       'Description': description,
       'content': content,
       'content_format': 'text',
   }
   doc_rpath = 'workspaces/kram'
   result = p.createDocument('Document', doc_def, doc_rpath)
   print 'result: "%s"\n \n %s' % (result,content)

if __name__ == '__main__':
 test_createDocument(title, description)
-----------------------------------------


The result is:
-----------------------------------------
wserv02:/z # python addDoc.py
result: "workspaces/kram/daniel_test_document"

 Content:

- Title: Daniel_Test_Document

- Description: Test Description 2007-03-15 11:24:20.348167
-----------------------------------------
but there is NO content inside the document...


Thanks,
Daniel Frings



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