problems with calling python scripts

2 messages Options
Embed this post
Permalink
ruby042 () problems with calling python scripts
Reply Threaded More More options
Print post
Permalink
Hi, I hope you can help me! I have some problems with the combination of Archetype forms and python scripts.

I've copied the base_edit files to my new Archetypes-based product and modified base_edit.cpy.metadata:
[actions]
action.success=traverse_to:string:myScript

Now it calls the script when the user clicks on the save button. But it doesn't redirect the user to the "view" tab as it used to do without the script. I also tried it with the portal_form_controller tool:

a) Template/Script: base_edit, Status: success, Context type: newCT, Action type: traverse_to, Action argument: string:myScript
b) Template/Script: myScript, Status: success, Context type: newCT, Action type: traverse_to_action, Action argument: string:view.

I've tried this in various combinations - Either it redirects to the view tab and doesn't call the script, or it calls the script but doesn't redirect to the view tab. So where exactly am I wrong?

A second thing which doesn't work is calling a python script when the user initializes the new document. You know what I mean? The user adds a new document. At this moment the url of this object is http://localhost:8080/FooFolder/portal_factory/Foo/foo.2008-11-29.7479322372/edit. The user saves it. Now the url is http://localhost:8080/Foo/name_of_foo.
I just can't find out which template I have to modify in order to add a script while the object is still temporary.

Thanks!
JustinCo () Re: problems with calling python scripts
Reply Threaded More More options
Print post
Permalink
you need a script metadata file that redirects to the view tab

ruby042 wrote:
Hi, I hope you can help me! I have some problems with the combination of Archetype forms and python scripts.

I've copied the base_edit files to my new Archetypes-based product and modified base_edit.cpy.metadata:
[actions]
action.success=traverse_to:string:myScript

Now it calls the script when the user clicks on the save button. But it doesn't redirect the user to the "view" tab as it used to do without the script. I also tried it with the portal_form_controller tool:

a) Template/Script: base_edit, Status: success, Context type: newCT, Action type: traverse_to, Action argument: string:myScript
b) Template/Script: myScript, Status: success, Context type: newCT, Action type: traverse_to_action, Action argument: string:view.

I've tried this in various combinations - Either it redirects to the view tab and doesn't call the script, or it calls the script but doesn't redirect to the view tab. So where exactly am I wrong?

A second thing which doesn't work is calling a python script when the user initializes the new document. You know what I mean? The user adds a new document. At this moment the url of this object is http://localhost:8080/FooFolder/portal_factory/Foo/foo.2008-11-29.7479322372/edit. The user saves it. Now the url is http://localhost:8080/Foo/name_of_foo.
I just can't find out which template I have to modify in order to add a script while the object is still temporary.

Thanks!