Hi,

I hope my late response will still be helpful.  You probably want to
use a chained validator.  A chained validator is a validator placed in
the chained_validators attribute of a schema.  It has access to the
entire value dictionary instead of a single value.  You can use the
dictionary to get both values and and validate the database.  Here is
an old example that demonstrates a chained validator:
http://pylonshq.com/pasties/c1f9f9dffaf13a25f3d13b03bc09a472

Your example might call for traditional validators in addition to the
chained validators and that is okay.  For example you would have a
UnicodeString validator for the string and an Integer validator for
the id in the schema both in addition to the chained validator.  These
are called before you have access to the value_dict in the chained
validator(this is True only if validate_partial_form = False).

-Ian

On May 6, 4:30 am, Antonio_Zgz <[email protected]> wrote:
> Hi Pyloners!
>
> I have a form with two fields, a String and a id (number). I have to
> validate the String in two ways (not empty and unique). I need to
> check that string field is unique within a table from a database, but
> it hasn't unique at whole database. I need that id for validating that
> String is unique in the table referenced by the id (making a query and
> filtering by id) in a validate function like _to_python(self, value,
> state).
>
> My question is: How can I pass two arguments to validation function?,
> that is, the string to validate and the id field from the form. I
> really appreciate your help!
>
> Thank you!
> Antonio.
>
> --
> 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 
> athttp://groups.google.com/group/pylons-discuss?hl=en.

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