[Plone-IT] Re: Plone e xmlrpc

luigi scarso luigi.scarso a gmail.com
Mar 19 Maggio 2009 08:02:07 UTC


2009/5/15 luigi scarso <luigi.scarso a gmail.com>

> OK, qualcosa incomincia ad uscire ...ma e' meglio ricominciare .
>
> Da
>
> http://blogs.nuxeo.com/sections/blogs/tarek_ziade/2005_11_04_xml-rpc-over-zope-3
>
> si scarica uno script che contiene la classe
> BasicAuthTransport
>
> Da qui poi, per inserire una News, aggiungere alla fine dello script
>
> import time
> BAtransport = BasicAuthTransport('admin', 'password')
> site = ServerProxy('http://192.168.2.26:18080/Plone',
> transport=BAtransport,verbose=1,allow_none=True)
> try:
>     id  = 'test_FOO_'
>     print( site.news.invokeFactory( 'News Item',
>                                     id,
>                                     None,
>                                     ))
>
>     print(site.news.test_FOO_.setText("Hello!"))
>     print(site.news.test_FOO_.setTitle("A  test"))
>
> except Exception,e :
>    print "ERROR*********************************"
>    print str(e)
>
>
> Invece e' da un po' che sbatto la testa per cambiare lo stato di test_FOO_
in 'published' (default e' 'private') .
Ci sono diverse soluzioni
ma quella che cerco io
e' "pure xmlrpc" ovvero senza scrivere codice da aggiungere in Plone
Ad esempio, perfino a command line

$> wget --user=admin --password=password
--post-data='workflow_action=publish'
http://192.168.2.26:18080/Plone/news/test_FOO_/content_status_modify

pubblica test_FOO_
mentre

print(site.news.test_FOO_.content_status_modify("publish"))

(messo subito prima di exception... )
solleva l'eccezione


Fault -1: Unexpected Zope exception: zExceptions.NotFound -    Site Error
   An error was encountered while publishing this resource.

    Resource not found

  Sorry, the requested resource does not exist. Check the URL and try
again.   Resource:
http://192.168.2.26:18080/Plone/news/test_FOO_/content_status_modify


   Troubleshooting Suggestions


   The URL may be incorrect.
   The parameters passed to this resource may be incorrect.
   A resource that this resource relies on may be
      encountering an error.


   For more detailed information about the error, please
  refer to the error log.


   If the error persists please contact the site maintainer.
  Thank you for your patience.

(cmq error log non riporta nulla)


Io credo che sia dovuto al fatto che l'acquisizione non valga con xmlrpc --
infatti dalla zopectl in debug,
si vede che test_FOO_ *non ha* un attributo content_status_modify .

Quindi ho due possibilita':
1) individuare il metodo di test_FOO_ che pubblica la risorsa

2) individuare il metodo di Plone che , prendendo come argomento almeno
Plone.news.test_FOO_
e 'publish' , pubblica la risorsa

qualche idea ?

-- 
luigi
-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: <http://lists.plone.org/pipermail/plone-plone-it/attachments/20090519/a5574363/attachment.html>


Maggiori informazioni sulla lista Plone-IT