Hello

I'm a python/turbogears newbie.
I've been searching the docs for an example of calling one
controller from another and have come up empty.

Reason:
I've copied the movie toscawidgets tutorial in setting up
a controller to create a form instance 

 create_enrol_form = EnrolmentForm("create_enrol_form", action='create')
    
and display the form by sending it to the create controller:

     @validate(create_enrol_form,error_handler=enrol)
     @expose()
     def create(self, **kw):
        ...
        raise redirect("list")  <-- this is the line I'd like to change

After form validation, I want to display a message on the screen that 
is populated with data from the form and from a "related" table,
so I'd like to pass to a template two objects that can be used as data
for the message.
I can send in the dicts of the two objects but that seems messy - 
especially in the url (GET method).

I can achieve what I want in a python script just by calling
genshi.loader.load.generate, passing it a dictionary of the
two objects,  and then calling genshi's render (outputting html),
but that doesn't work in tg (I get a blank screen),
and copying the simple movie case and raising a redirect 
only seems to allow me to pass a dictionary of strings
to url (there is no documentation on pylons.url):

(from tg.controllers.py:) 
from pylons import url
...
def redirect(*args, **kwargs):
    url(*args, **kwargs)

If I pass objects in to redirect in **kwargs, it transmits only their 
str() forms using GET to the url and I can't access any of their 
attributes.

So how do I send objects from a form and a db query of an associated 
table directly from the form creation controller to another 
form-confirmation controller?

Thanks
Anita




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to