my suggested patch for this issue (self.record_id is a dict with
keyedTables):

suse101:~/web2py-1436/gluon # diff validators.py.ori validators.py
404,405c404,410
<         if len(rows) > 0 and str(rows[0].id) != str(self.record_id):
<             return (value, self.error_message)
---
>         if len(rows) > 0:
>             if isinstance(self.record_id, dict):
>                 for f in self.record_id.keys():
>                     if str(getattr(rows[0], f)) != str(self.record_id[f]):
>                         return (value, self.error_message)
>             elif str(rows[0].id) != str(self.record_id):
>                 return (value, self.error_message)

Ok?

Regards,

  Hans

~~~~~
On 21 Nov., 16:33, mdipierro <[email protected]> wrote:
> Hi Hans, I have your patch and I will be applying it tomorrow.
>
> Unfortunately the added experimental support for legacy databases
> opens issues like this. If we assume less about the table structure
> then more checks are required which may result in more complex and
> slower code. Let's all think about a good and elegant way to add
> IS_NOT_IN_DB support for legacy databases.
>
> Massimo
>
> On Nov 21, 4:30 am, Hans Murx <[email protected]> wrote:
>
> > gluon/validators.py lines 403-405:
>
> >         rows = self.dbset(field == value).select(limitby=(0, 1))
> >         if len(rows) > 0 and str(rows[0].id) != str(self.record_id):
> >             return (value, self.error_message)
>
> > - line 404: a field with name 'id' is required, but legacy tables may
> > not have a field named 'id'. Will raise an exception then.
>
> > - line 403: limitby is not correctly implemented for informix in
> > current web2py. Therefore a select with limitby does not return any
> > rows for informix (Massimo, do you remember my suggested patch for
> > that issue?).
>
> > Regards,
>
> >   Hans
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to