can you give a complete example necessary to reproduce?

Alternatively, you can debug yourself:  set a breakpoint at gluon/
tools.py::Auth:add_permission()

and analyze what's going on...

- Yarko

On Jun 29, 2:13 pm, Chris S <[email protected]> wrote:
> Crap that should read:
>
> To reproduce:
> def test():
>     auth.add_permission(id,'name','table1')
>     auth.add_permission(id,'name','table2')
> return
>
> I'm trying to assign two different permissions to the same group in a
> single function to get the error.
>
> On Jun 29, 2:11 pm, Chris S <[email protected]> wrote:
>
> > Actually, that's not exactly what's happening.
>
> > The error is produced when trying to make two calls back to back to
> > auth.add_permission().
> > Single calls still create duplicate enteries but back to back calls
> > error on the 2nd call never creating an entry.
>
> > To reproduce:
> > def test():
> >     auth.add_permission(id,'name','table1')
> >     auth.add_permission(id,'name','table1')
> > return
>
> > Either one of the above can be run by itself, but both in the same
> > controller will fail with the above error on the 2nd permission.
>
> > On Jun 29, 1:35 pm, Chris S <[email protected]> wrote:
>
> > > I think the most recent update to trunk I've found a spot in sql.py
> > > where functionality is different though it might be intended.
>
> > > In the last stable release you could make a call:
> > > auth.add_permission(group.id,'name','table_name')
>
> > > You could do this with out first checking for it's existence already.
> > > A new entry was created and no errors thrown.
> > > Now if you try to do the above call and that same permission is
> > > already defined you get:
> > > ----------New Error------------
> > > raise SyntaxError, 'Object exists and cannot be redefined: %s' % key
> > > SyntaxError: Object exists and cannot be redefined: _last_reference
> > > ----------/New Error------------
>
> > > While it's good that this points out that I wasn't checking for these
> > > permissions before, it's bad that you find out by an error which
> > > didn't previously exist.
>
> > > I can wrap my add_permission calls in a try: block, or i could check
> > > for the permission before adding.  But is that something that should
> > > just be included in web2py by default?  It's how I assumed it worked
> > > originally :)

Reply via email to