2007/5/5, Jennifer Cranfill <[EMAIL PROTECTED]>:
>
> Sorry for all of the posts! Openwfe is very exciting and I'm looking
> forward to get it working in my python env.
>
> I'm using openwfe-1.7.3pre0 and I'd like to be able to launch a flow
> from a python script. So far I've been able to list all flows, but
> once I go to launch one, I get encoder errors.
>
> Example script:
> from openwfe.rest.wlclient import WorkSession
> workSession = WorkSession('localhost', 5080, 'bob', 'bob')
> flows = workSession.listLaunchables()
>
> for flow in flows:
>     if flow.url == 'http://localhost:7079/tests/flow__1.8.xml':
>         workSession.launchFlow(flow.engineId, flow)
>
> Output:
> Traceback (most recent call last):
>   File "openwfe-example.py", line 11, in ?
>     workSession.launchFlow(flow.engineId, flow)
>   File "/openwfe-1.7.3pre0/etc/python-apre/lib/openwfe/rest/wlclient/
> __init__.py", line 157, in launchFlow
>     data = codec.encode(launchitem)
>   File "/openwfe-1.7.3pre0/etc/python-apre/lib/openwfe/workitem/
> codec.py", line 514, in encode
>     raise ValueError, \
> ValueError: No encoder for objects of class
> 'openwfe.workitem.Launchable'
>
> I also tried calling launchFlow() with flow.url, but I got a
> "ValueError: No encoder for objects of class '<type 'unicode'>'".

Hi Jennifer,

the launchFlow() method is expecting a LaunchItem instance.

You could do something like :

---8<---
li = Launchitem()
li.workflowDefinitionUrl = 'http://localhost:7079/tests/test_flow_5.xml'
li.setAttribute(TEST, TEST_NAME)

wfid = workSession.launchFlow(MAIN_ENGINE, li)
--->8---

(
this example is taken from the OpenWFE test suite which uses Pyya :
http://openwfe.svn.sourceforge.net/viewvc/openwfe/trunk/openwfe-tests/
http://openwfe.svn.sourceforge.net/viewvc/openwfe/trunk/openwfe-tests/tests_suite/
http://openwfe.svn.sourceforge.net/viewvc/openwfe/trunk/openwfe-tests/tests_suite/test_t_flow_5.py?view=markup
)

I made good progress on the OpenWFEru old-style REST interface, stay tuned.


Best regards,

-- 
John Mettraux   -///-   http://jmettraux.openwfe.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"OpenWFE users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/openwfe-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to