Moving from SQLite to Postgres and when running Database
Administration we're getting unknown field type errors when using a db
reference i.e. Field('Client', db.Client)
Any advice or work arounds?
TIA,
Traceback (most recent call last):
File "C:\web2py\gluon\restricted.py", line 204, in restricted
exec ccode in environment
File "C:/web2py/applications/OAS/models/oa.py", line 358, in
<module>
Field('Interpretation_Type', db.Interpretation_Type))
File "C:\web2py\gluon\dal.py", line 5114, in define_table
polymodel=polymodel)
File "C:\web2py\gluon\dal.py", line 624, in create_table
(field.type, field.name)
SyntaxError: Field: unknown field type: db.Client for Client
Code listing:
precision, scale = map(int,field.type[8:-1].split(','))
ftype = self.types[field.type[:7]] % \
dict(precision=precision,scale=scale)
elif not field.type in self.types:
raise SyntaxError, 'Field: unknown field type: %s for
%s' % \
(field.type, field.name)
Model:
db.define_table('Client',
Field('Company', 'string'),
Field('Address', 'string'),
Field('Town', 'string'),
Field('State', 'string'),
Field('Zip', 'string'),
Field('Activity', 'integer'),
Field('Account', 'integer'),
format='%(Company)s')
db.define_table('Contact',
Field('Client', db.Client),
Field('Surname', 'string'),
Field('First_Name', 'string'),
Field('Position', 'string'),
Field('Department', 'string'),
Field('eMail', 'string'),
Field('Mobile', 'string'),
Field('Phone', 'string'),
Field('Fax', 'string'),
format='%(Surname)s - %(First_Name)s')
Environment:
Windows 7 64bit
Current Postgresql (64bit) with psycopy2
web2py source from trunk: (1, 99, 4, datetime.datetime(2011, 12, 31,
4, 51, 15), 'stable')
Python 2.7.2: C:\Python27\python.exe