check latest trunk please, this has changed.
On 30 Giu, 22:15, dlypka <dly...@gmail.com> wrote: > For the moment, I suggest you simply remove the stmt: > self._last_reference = tmp > > I can assure you that it is not needed for any existing applications. > It is intended as a future feature to support native Google App Engine > code > within web2py. > > _last_reference is a dynamically added attribute to the instance, > but somehow the error suggests the code is passing through that > statement > twice on the same self instance. > > Perhaps a del self._last_reference in front would help, but I need > to really find the the root cause of the bug. > > - Dave Lypka. > > On Jun 30, 2:33 pm, dlypka <dly...@gmail.com> wrote: > > > I will have a look at this tonight, using the WING IDE debugger, > > because _last_reference was a new property added at my suggestion, > > so I am somewhat familiar with it > > > Looks like somehow the same SQL Row instance is being 'reused' for > > creating a new row > > which I would not expect to happen. > > > - Dave Lypka. > > > On Jun 30, 1:03 am, Yarko Tymciurak <resultsinsoftw...@gmail.com> > > wrote: > > > > On Jun 29, 3:27 pm, Chris S <sanders.ch...@gmail.com> wrote: > > > > > I'm actually not sure how to set break points. I'm using Eclipse so > > > > I'm sure there's a way but while I'm educating myself. > > > > A bit of an aside, but for completeness: > > > > Not sure about Eclipse... maybe this will > > > help:http://pydev.org/manual_adv_debugger.html > > > > It sort of looks familiar - like winpdb (which is a free windowed --- > > > NOT windows --- debugger for python; you could get that separate). > > > > I would (of course) do this with local gae environment. > > > > An alternative is to get a 30-day eval of WingIDE, and debug with > > > that.... either should be fine. > > > > - Yarko > > > > > Here's all you > > > > should need to know if the above isn't descriptive enough. > > > > > In db.py: > > > > auth = Auth(globals(),db) # authentication/authorization > > > > auth.define_tables() # creates all needed tables > > > > > Using Appadmin > > > > -Add a user to auth_users > > > > -Create group 'admin' in auth_groups > > > > -Make the user a member of admin in auth_memberships > > > > > In the application: > > > > def add(): > > > > """ > > > > Debug Function > > > > """ > > > > group=db(db.auth_group.role=='admin').select()[0] > > > > auth.add_permission(group.id,'access','mystuff') > > > > auth.add_permission(group.id,'access','myotherstuff') > > > > redirect(URL(request.application,request.controller,'index')) > > > > > Call /application/controller/add > > > > In appadmin view the auth_permissions table. > > > > You should see two entries > > > > one with the group.id for Admin, access, and table of 'mystuff'. > > > > one with the group.id for Admin, access, and table of 'myotherstuff'. > > > > > Instead you'll get the above error and only "mystuff" is added to the > > > > auth_permissions. > > > > You can comment out either line and add them one at a time with no > > > > errors. In fact you can add the same permission several times and > > > > you'll see duplicate enteries. You can not however, have both of the > > > > above added in a single function call. This use to work but no longer > > > > does. When I get some time maybe I can test which revision broke this > > > > but my guess is it's 650:7c531beb7820 with comment > > > > "self._last_reference, thanks Dave". > > > > > Sorry I'm not more help. Wish I could just patch this but I'm still > > > > learning python/web2py and this one's a bit above me. > > > > > On Jun 29, 3:01 pm, Yarko Tymciurak <resultsinsoftw...@gmail.com> > > > > wrote: > > > > > > 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 <sanders.ch...@gmail.com> 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 <sanders.ch...@gmail.com> 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 <sanders.ch...@gmail.com> 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 :)- Hide quoted text - > > > > - Show quoted text -