On Monday 12 October 2009 13:04:54 Daishy wrote:
> Hi together,
>
> I got a problem using the tg.url function that i cant seem to fix: I
> wrote a form which is basicly like the one in the tutorial (in the
> documentationsection). It is defined outside the Controller and passed
> to the template by one of the functions inside the controller. Now i
> have the action attribute defined es url('/root/sub/save') which works
> fine, if my app is hosted under '/'. Now i want to deploy it on
> another machine, which uses apache+mod_wsgi and a subpath '/myapp'.
> Within the templates and the controller url('/root/sub/method') gets
> translated to '/myapp/root/sub/method' which is correct. The Form
> however ist still /root/sub/save.
> Am i not allowed to use the url-function outside of an controller and
> what else should i do instead?
Try making the action a callable. That should be evaluated and
form-rendering-time, yielding the correct result.
Like this:
my_form = TableForm('my_form', action=lambda: url("/root/sub/method", ..)
HTH,
Diez
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---