I want to create a webfolder plugin, for that the table needs a self
reference in a Field
db.define_table('plugin_webfolder_files',
        Field('name', requires=IS_NOT_EMPTY()),
        Field('file', 'upload', requires=IS_NOT_EMPTY()),
        Field('created_by', db.auth_user, readable=False,
writable=False),
        Field('parent', db.plugin_webfolder_files, default=0, requires
= IS_IN_DB(db,'plugin_webfolder_files.id','%(name)s'))
        )

unfortunately I get
Traceback (most recent call last):
  File "/home/select/Dev/web2py/gluon/restricted.py", line 173, in
restricted
    exec ccode in environment
  File "/home/select/Dev/web2py/applications/tlc2/models/
plugin_webfolder.py", line 9, in <module>
    Field('parent', db.plugin_webfolder_files, default=0, requires =
IS_IN_DB(db,'plugin_webfolder_files.id','%(name)s'))
  File "/home/select/Dev/web2py/gluon/sql.py", line 1272, in
__getattr__
    return dict.__getitem__(self,key)
KeyError: 'plugin_webfolder_files'

so I have to change it to
db.define_table('plugin_webfolder_files',
        Field('name', requires=IS_NOT_EMPTY()),
        Field('file', 'upload', requires=IS_NOT_EMPTY()),
        Field('created_by', db.auth_user, readable=False,
writable=False),
        Field('parent', 'integer', default=0, requires = IS_IN_DB
(db,'plugin_webfolder_files.id','%(name)s'))
        )

bug or feature?

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to