Good morning to all, our case is as follows, in the production site
have web2py 1.89.5 and MySQL, all our applications are operating
properly.
Now we would like to upgrade to version 1.94.6, however we have
compatibility issues with the new version of the dal, these are the
details.
db.define_table('benefs2',
Field('names', 'string',
requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
vacio')], label='Benef. Nombre(s)'),
Field('apelPater', 'string',
requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
vacio')], label='Benef. Apel. Pater.'),
Field('apelMater', 'string',
requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
vacio')], label='Benef. Apel. Mater.'),
Field('rfc', 'string', requires=[IS_UPPER(),
IS_NOT_EMPTY(error_message='No puede estar vacio'),\
IS_LENGTH(13,error_message='El tamaño debe ser de 13
caracteres alfanumericos'),IS_ALPHANUMERIC(error_message='¡Deben ser
caracteres alfanumericos!'), \
IS_NOT_IN_DB(db,'benefs2.rfc',error_message='El RFC ya
existe')], label='Benef. RFC'),
Field('sexo','string',requires=IS_IN_SET(['femenino','masculino']),
label='Benef. Sexo'),
Field('enfermedades',db.enfermedades,requires=IS_IN_DB(db,'enfermedades.id','%
(names)s'), label='Benef. Enfermedad',readable=False),
Field('namesWorked', 'string',
requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
vacio')], label='Trabajador Nombre(s)'),
Field('apelPaterWorked', 'string',
requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
vacio')], label='Trabajador Apel.Pater.'),
Field('apelMaterWorked', 'string',
requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
vacio')], label='Trabajador Apel.Mater.'),
Field('rfcWorked', 'string', requires=[IS_UPPER(),
IS_NOT_EMPTY(error_message='No puede estar vacio'),\
IS_LENGTH(13,error_message='El tamaño debe ser de 13
caracteres alfanumericos'),IS_ALPHANUMERIC(error_message='¡Deben ser
caracteres alfanumericos!'), \
IS_NOT_IN_DB(db,'benefs2.rfcWorked',error_message='El RFC ya
existe')], label='Trabajador RFC'),
IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')],
label='Trabajador Tel.Trabajo'),
Field('sexoWorked','string',requires=IS_IN_SET(['femenino','masculino']),
label='Trabajador Sexo'),
Field('subdireccion','string',requires=IS_IN_SET(['Nezahualcóyotl
y Chalco','Ecatepec y Tecámac','Cuautitlán Izcalli y
Naucalpan']),label='Trabajador SubDir.'))
Could you help?, thanks in advance for your excellent work.
Traceback (most recent call last):
File "/home/drayco/web2py/gluon/restricted.py", line 189, in
restricted
exec ccode in environment
File "/home/drayco/web2py/applications/init/models/db.py", line 334,
in <module>
Field('subdireccion','string',requires=IS_IN_SET(['Nezahualcóyotl
y Chalco','Ecatepec y Tecámac','Cuautitlán Izcalli y
Naucalpan']),label='Trabajador SubDir.'))
File "/home/drayco/web2py/gluon/dal.py", line 3973, in define_table
polymodel=polymodel)
File "/home/drayco/web2py/gluon/dal.py", line 611, in create_table
fake_migrate=fake_migrate)
File "/home/drayco/web2py/gluon/dal.py", line 655, in migrate_table
and not isinstance(table[key].type, SQLCustomType) \
File "/home/drayco/web2py/gluon/dal.py", line 4323, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'sexoworked'
Code listing
4318.
4319.
4320.
4321.
4322.
4323.
4324.
4325.
4326.
4327.
return rows[0]
return None
elif str(key).isdigit():
return self._db(self.id ==
key).select(limitby=(0,1)).first()
elif key:
return dict.__getitem__(self, str(key))
def __call__(self, key=DEFAULT, **kwargs):
if key!=DEFAULT:
if isinstance(key, Query):