I think this sql_represent errors are getting annoying. We need to
wrap sql_represent in a try catch so that it reports which file is
causing the problem.

On Oct 5, 7:59 am, Johann Spies <[email protected]> wrote:
> For the following model
>
> signature = db.Table(db, 'signature',
>                      Field('created_on', 'datetime', default=request.now),
>                      Field('created_by', db.auth_user, default=auth.user_id),
>                      Field('updated_on', 'datetime', default=request.now),
>                      Field('updated_by', db.auth_user, update=auth.user_id)
>                      )
>
> db.define_table('institution',
>                 Field('name'),
>                 Field('notes','text'),
>                 Field('higher_education','boolean'),
>                 Field('type_of_institution',
>                       requires=IS_IN_SET(['University',
>                                           'University of 
> Technology(Technikon)',
>                                           'College',
>                                           'NGO',
>                                           'Research Institute',
>                                           'Government',
>                                           'Private Sector']
>                                          )
>                       ),
>                 Field('country'),
>                 signature
>                 )
>
> db.define_table('journal',
>     Field('journal',unique=True),
>     Field('issn', length=10),
>     Field('notes', type='text'),
>                 signature
>                 )
>
> appadmin complains:
>
> Traceback (most recent call last):
>   File "/home/js/web2py/gluon/restricted.py", line 188, in restricted
>     exec ccode in environment
>   File "/home/js/web2py/applications/kb4/views/appadmin.html", line
> 88, in <module>
>     {{if hasattr(table,'_primarykey'):}}
>   File "/home/js/web2py/gluon/sql.py", line 2582, in __eq__
>     return Query(self, '=', value)
>   File "/home/js/web2py/gluon/sql.py", line 3034, in __init__
>     right = sql_represent(right, left.type, left._db._dbname,
> left._db._db_codec)
>   File "/home/js/web2py/gluon/sql.py", line 569, in sql_represent
>     return str(int(obj))
> ValueError: invalid literal for int() with base 10: 'string'
>
> The tables are empty at the moment.
>
> In the shell there is no problem.
>
> Version
> web2py Version 1.86.2 (2010-10-04 03:13:15)
>
> Regards
> Johann
>
> --
>  May grace and peace be yours in abundance through the full knowledge
> of God and of Jesus our Lord!  His divine power has given us
> everything we need for life and godliness through the full knowledge
> of the one who called us by his own glory and excellence.
>                                                     2 Pet. 1:2b,3a

Reply via email to