cut down the code to the point it doesn't fire an exception and start from 
there.... whenever you post something you seem to miss that we can't know 
all other table definitions (and variables) and for sure we can't do 
nothing to help you with this level of "implicitness" :-P

On Thursday, October 24, 2013 5:03:39 PM UTC+2, Annet wrote:
>
> I have the following table definition
>
> def set_requirement(hero): hero.categoryID.requires=[IS_IN_DB(db, 
> 'interfaceCategory.id', '%(name)s', orderby='interfaceCategory.id', 
> zero='Selecteer een interface', error_message='Selecteer een interface'), 
> IS_NOT_IN_DB(db(db.hero.categoryID==request.vars.categoryID), 
> 'hero.nodeID', error_message='Combinatie hero en interface al in database')]
>
> db.define_table('hero',
>     Field('nodeID', 'reference node', **isnode),
>     Field('categoryID', 'reference interfaceCategory', default='', 
> ondelete='RESTRICT', notnull=True, label='Interface categorie', 
> writable=False, readable=False),
>     Field('functionNavID', 'reference functionNav', default='', 
> requires=IS_IN_DB(db, 'functionNav.id', '%(name)s', 
> orderby='functionNav.id', zero='Selecteer een functie nav', 
> error_message='Selecteer een functie nav'), ondelete='RESTRICT', 
> notnull=True, label='Functie nav * '),
>     Field('heroFileName', length=32, writable=False, readable=False),
>     Field('heroFile', type='upload', 
> requires=[IS_EMPTY_OR(IS_IMAGE(extensions=('gif', 'jpg', 'jpeg', 'png'), 
> maxsize=(940,240), error_message='Afmeting: maxWidth is 940 pixels 
> maxHeight is 240 pixels. File format: gif, jpg, jpeg, png')), 
> IS_LENGTH(70*1024, error_message='File size overschreidt 70 KB')], 
> label='Hero file * ', autodelete=True),
>     Field('heroFileUrl', length=64, requires=IS_LENGTH(64, 
> error_message='Lengte overschreidt 64 tekens'), label='Hero shot file url * 
> '),
>     Field('createdOn', **attributes),
>     Field('modifiedOn', update=request.now, **attributes),
>     on_define=set_requirement,
>     migrate='hero.table')
>
> Today while defining another table when I clicked the data administration 
> button I got the following error
>
> <type 'exceptions.AttributeError'> 'Table' object has no attribute 
> 'categoryID'
>
>
> Traceback (most recent call last):
>   File "/Users/annet/web2py/gluon/restricted.py", line 217, in restricted
>     exec ccode in environment
>   File "/Users/annet/web2py/applications/dbModel/views/appadmin.html" 
> <http://127.0.0.1:8000/admin/default/edit/dbModel/views/appadmin.html>, line 
> 107, in <module>
>   File "/Users/annet/web2py/gluon/dal.py", line 8034, in __getitem__
>     return self.__getattr__(str(key))
>   File "/Users/annet/web2py/gluon/dal.py", line 8040, in __getattr__
>     return self.lazy_define_table(tablename,*fields,**args)
>   File "/Users/annet/web2py/gluon/dal.py", line 7978, in lazy_define_table
>     if on_define: on_define(table)
>   File "/Users/annet/web2py/applications/dbModel/models/26_graphics_db.py" 
> <http://127.0.0.1:8000/admin/default/edit/dbModel/models/26_graphics_db.py>, 
> line 35, in set_requirement
>     def set_requirement(hero): hero.categoryID.requires=[IS_IN_DB(db, 
> 'interfaceCategory.id', '%(name)s', orderby='interfaceCategory.id', 
> zero='Selecteer een interface', error_message='Selecteer een interface'), 
> IS_NOT_IN_DB(db(db.hero.categoryID==request.vars.categoryID), 'hero.nodeID', 
> error_message='Combinatie hero en interface al in database')]
>   File "/Users/annet/web2py/gluon/dal.py", line 8595, in __getitem__
>     return ogetattr(self, str(key))
> AttributeError: 'Table' object has no attribute 'categoryID'
>
>
> I am completely clueless as why I get this error when I remove the validator 
> I get the same error for
> a similar validator on another table.
>
> I am using web2py 2.7.4
>
>
> Kind regards,
>
> Annet
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to