Il 30/08/2012 15:22, Manuele Pesenti ha scritto:
another problem jumped out using new 2.0.2 release having tables with
camel case field names. This is the traceback
Traceback (most recent call last):
File
"/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/restricted.py",
line 209, in restricted
exec ccode in environment
File
"/home/manuele/Dropbox/sviluppo/web2py-2.0.2/applications/theseus/models/plugin_openlayers.py",
line 205, in <module>
fake_migrate = plugin_openlayers_fake_migrate
File "/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/dal.py",
line 7041, in define_table
table = self.lazy_define_table(tablename,*fields,**args)
File "/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/dal.py",
line 7072, in lazy_define_table
polymodel=polymodel)
File "/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/dal.py",
line 876, in create_table
fake_migrate=fake_migrate)
File "/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/dal.py",
line 944, in migrate_table
and not isinstance(table[key].type, SQLCustomType) \
File "/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/dal.py",
line 7553, in __getitem__
return ogetattr(self, str(key))
AttributeError: 'Table' object has no attribute 'thematiclayer_id'
maybe it's useful to highlight that the attribute error is raised
because the table has a field called "thematicLayer_id" with the "L"
(UPPERCASE).
M
the problem seams to be the function fix hre under reported and
defined inside the migrate_table method in DAL that returns k.lower()
and not only k even if upper case field name are supported by the db
used:
def fix(item):
k,v=item
if not isinstance(v,dict):
v=dict(type='unkown',sql=v)
return k.lower(),v
### make sure all field names are lower case to avoid conflicts
As said before I'm trying to migrate an existing aplication to new
framework release so I don't want to change the model because there
are data in tables I don't want to loose so I don't think that to
change my field names it's a good solution. Can you help me?
Cheers
Manuele
--