Massimo thank you for your response.
Unfortunately, I have not the traceback now, since I chose to build a 
separate table, not referring to db.auth_group. This
is a kind of duplication in regards to auth_group, but it makes simple the 
handling of my lab_members table:

db.define_table('lab_members', 
                Field('lab',label='Lab Name',
                      default= auth.user_id and auth.user.username,
                      writable=False,
                      ),
                Field('member',unique=True,requires=IS_NOT_EMPTY()),
                )

The strange thing in this case again, is the :
default= auth.user_id and auth.user.username,
which I have taken from an older answer of yours:

https://groups.google.com/forum/?fromgroups=#!searchin/web2py/Re:$20Record$20Versioning/web2py/e55el7q_-kk/XkG1hN5w9VYJ

If i run my application on -S appname mode,  having just: "default= 
auth.user.username,", this error comes back:
Traceback (most recent call last):
  File "/home/kmouts/web2py/gluon/restricted.py", line 212, in restricted
    exec ccode in environment
  File "applications/lims/models/db.py", line 140, in <module>
    default= auth.user.username,
AttributeError: 'NoneType' object has no attribute 'username'

So it seems a check has to be made first if a current user exists (by 
auth.user_id )and then to try to get the attribute username from auth.user.

-- 



Reply via email to