Hi Mike,

I have a form with some hidden fields that were dynamically added by
another operation going on in the same page.  These hidden fields were
formed with values that were already validated.  I do not wish to
validate this again.  Can I use __unpackargs__ to specify the fields I
want to validate and just leave the ones that I don't want out of the
list?  Is this what __unpackargs__ does?

So for example I have a form with first_name, last_name, course_name,
enrollment_limit,....and some hidden fields (these are also repeating
fields) like: sess-1.name, sess-1.start, sess-2.name,
sess-2.start....and so on.  What do I have to do to prevent
sess-1.name, sess-1.start, sess-2.name, sess-2.start from validating,
but still I want them to be added to my object.

Seems like the only solution is to re-validate them and use
Formencode's solution of repeating fields to solve this....

-Mark

On Mar 3, 11:02 am, Mike Orr <[email protected]> wrote:
> I don't understand Johnathan's point.  Most fields are strings, yes.
> But I assumed Mark wanted integers.  That's what SelectInt is for.
> Otherwise you can just use OneOf.
>
> On Tue, Mar 2, 2010 at 5:28 PM, Mark <[email protected]> wrote:
> > Thank you for the detailed explanation.
>
> > One thing:  What does __unpackargs__ do? I don't see this being used
> > everytime, is it something optional?  What do you usually supply it
> > with?
>
> ``.__unpackargs__`` tells how many positional args the validator
> constructor takes, and which attributes they should be assigned to.
> FancyValidator takes no args, but custom subclasses might want to, to
> specify constraints like length, minimum value, type, etc.
>
> It's implemented by formencode.declarative.Declarative, which is a
> superclass of Validator. You can use it in your own classes to avoid
> writing a boilerplate .__init__ method.
>
> Someday there will be a FormEncode manual that mentions it. Until
> then, I'd recommend reading the docstrings of all the FormEncode
> modules.  Note that some of the validators seem (to me) old or
> useless, so if something looks strange, it probably is.
>
> --
> Mike Orr <[email protected]>

-- 
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.

Reply via email to