Line 128 of gql.py gives a syntax error:

fields=[args['polymodel']]+[field fof field in fields]

I took a guess that this was supposed to give a list of fields from
both the base table and the table being created in, and replaced it
with this instead:

fields = map(lambda x: args['polymodel'][x], args['polymodel'].fields)
+list(fields)

This change allowed the table to be constructed with fields from both
itself and its base class.  Unfortunately, this gives an error when
_create is called on the table (line 137), due to duplicate properties
from the base table.  Here's the trace:

Traceback (most recent call last):
  File "C:\Users\Dave\Documents\Python\web2py\gluon\restricted.py",
line 188, in restricted
    exec ccode in environment
  File "C:\Users\Dave\Documents\Python\web2py\applications\welcome/
models/db.py", line 80, in <module>
    db.define_table('person',Field('first_name'),
polymodel=db.contact)
  File "C:\Users\Dave\Documents\Python\web2py\gluon\contrib\gql.py",
line 137, in define_table
    t._create(polymodel=args.get('polymodel',None))
  File "C:\Users\Dave\Documents\Python\web2py\gluon\contrib\gql.py",
line 250, in _create
    self._tableobj = classobj(self._tablename,
(polymodel._tableobj, ), myfields)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine
\ext\db\polymodel.py", line 125, in __init__
    super(PolymorphicClass, cls).__init__(name, bases, dct,
map_kind=False)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine
\ext\db\__init__.py", line 418, in __init__
    _initialize_properties(cls, name, bases, dct)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine
\ext\db\__init__.py", line 336, in _initialize_properties
    raise DuplicatePropertyError('Duplicate property: %s' % attr_name)
DuplicatePropertyError: Duplicate property: address

Reply via email to