I don't like that example.
Mako IS a templating engine. So the author has you rendering the mako
templates AND THEN doing string substitution ? that's pointless.
anyways...
your error on render_signin is happening because of this line:
result = result.replace('%', '%%').replace('FORM_ACTION', '%s')
which means that somewhere on your template , you have too many or not
enough % signs
you can do a few things:
1- drop the string formatting in the template and use c / g globals OR
a function
2- convert the string formatting to a dict so you understand what's
going on better in the code, and find out where the extra or missing %
items are. ( ie: "Hello %(name_first)s %(name_last)s" %
{ 'name_first':'a', 'name_last':'b' }
But i'd suggest going for #1
Some ways you could handle this:
template:
${h.form_start(c.regform_action, method="post")}
controller:
def render_signin():
c.regform_action= '/post/to/whatever'
return render('/derived/account/signin.html').encode('utf-8')
or
template:
${h.form_start(h.regform_action(), method="post")}
helpers:
def regform_action():
return '/post/to/whatever'
controller:
def render_signin():
return render('/derived/account/signin.html').encode('utf-8')
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---