I should also add that if I add this line-
auth.add_permission(1, 'read', r.id)
so that it reads-
if db(db.man.id > 0).isempty():
for line in open('database.txt', 'rU'):
fieldname1,fieldname2,id1,id2 = line.strip().split('\t')
r = db.man.insert(fieldname1=fieldname1, fieldname2=fieldname2,
id1=id1, id2=id2)
auth.add_permission(1, 'read', r.id)
db.commit()
...I get a ticket w/
<type 'exceptions.AttributeError'> 'DAL' object has no attribute
'auth_permission'
>
>
On Monday, July 1, 2013 5:30:10 PM UTC-7, Jordan Ladora wrote:
>
> Hi,
>
> From a file, I'm loading a table that I would like to make accessible to
> any logged in user..
>
> Here's the model-
>
> db.define_table('man',
> Field('fieldname1', requires=IS_NOT_EMPTY(), label="fieldname1"),
> Field('fieldname2', requires=IS_NOT_EMPTY(), label="fieldname2"),
> Field('id1', requires=IS_NOT_EMPTY(), label="label1"),
> Field('id2', requires=IS_NOT_EMPTY(), label="label1"),
> format = '%(fieldname1)s %(fieldname2)s %(id1)s %(id2)s'
> )
>
>
> At the end of the models file, I have this code to fill the table from a
> flat file, if it is empty-
>
> if db(db.man.id > 0).isempty():
> for line in open('database.txt', 'rU'):
> fieldname1,fieldname2,id1,id2 = line.strip().split('\t')
> r = db.man.insert(fieldname1=fieldname1,
> fieldname2=fieldname2, id1=id1, id2=id2)
> db.commit()
>
>
> What is the best way now set the permissions for all the records in this
> table, so any logged in user can access them?
>
> Thanks for any help!
> -JL
>
>
--
---
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.