OK, just as a hack, I changed the code in SQLTABLE from:

    r = field.represent(r)

To:

    r = field.represent(r or [])

This eliminates the crash in the database administrator due to the
list:reference field.  I hesitate to suggest this as a fix for the
issue because my understanding of this code is very superficial and
this may lead to unintended side effects.  There may be good reason to
pass 'None' to field.represent() under other circumstances.

-- Joe B.

On Feb 7, 10:38 pm, Joe  Barnhart <joe.barnh...@gmail.com> wrote:
> I just ran into a similar problem... I think.  I defined a
> list:reference field like so:
>
>     Field("teams","list:reference team",label='Teams attending')
>
> The problem is that after I inserted one record (with no entries in
> the 'teams' field, I now get an error whenever I try to use the
> database administrator on the table.  The exact error is "BELONGS
> takes exactly 3 arguments (2 given)."
>
> On digging further, it seems to be happening in SQLTABLE __init__, in
> the fragment:
>
>      elif field.represent:
>         r = field.represent(r)
>
> Where r is None and the field is the list:reference field above.
> There are no entries in the team table as of yet, so perhaps it is
> returning None instead of an empty list.  I'll try entering some teams
> next.
>
> I'm still getting used to this WingIDE stuff, but it has vastly
> extended my view of what's going on under the covers!
>
> -- Joe B.
>

Reply via email to