Dalius Dobravolskas wrote:
>> <input name="user3" value="${initstr}" />
> There are helper functions that could simplify that. Like:
> ${h.input('user3', value=initstr)}
Hmm I'm getting SillyError(tm) now:
AttributeError: 'module' object has no attribute 'input'
${h.input('user3', value=initstr)}
I've created HelloWorld project per Pylons Book instructions, do I need
to enable helpers explicitly somehow somewhere?
>
> And so on... There is h.form as well.
>
>> try:
>> c.initstr = request.params['user3']
>> except KeyError:
>> c.initstr = 'default text'
>
> Argh, my eyes are hurt. Use get method:
>
> c.initstr = request.params.get('user3', 'default text')
That's what reading tutorials and books gets you, I got into habit of
using try .. except blocks and now I have to explicitly remember to get
rid of them where possible. Documentation should be read as last resort. :-)
> Try ToscaWidgets, experiment with it and you will see later that there
> is nothing magic what you can't do without that ;-)
Thanks, I will consider this, though I have looked at Formish today and
it looks *freezing cool*, incl. automatic generation of error HTML boxes
if invalid values were entered by user, and custom validators, like this:
class LessThan5(validatish.Validator):
def __call__(value):
if value is not None and value < 5:
raise validatish.Invalid('less than 5')
...
schemaish.Float(validator=LessThan5())
Regards,
mk
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---