it's not a "feature" per-se but DAL has suffered a complete overhaul to 
accomodate for new features and some bug squashing.
What used to be a "commodity" leading to "faulty" data models indeed put 
the developers (me and Michele Comitini) to face a really hard problem to 
solve to support those kinds of tunrarounds. 
Let's say its a bug but - at least - let me clearly state that referencing 
a table that doesn't exist yet is not a "normal thing to do" :D

On Thursday, December 5, 2013 10:08:33 PM UTC+1, Jim S wrote:
>
> Thanks Niphlod. I agree the model doesn't make sense.  Made sense at the 
> time only for simplicity of defining one and only one group a user could 
> belong to.  I understand it is not the right way to do things.  But, 
> working on a rewrite of that app and will be redesigning the auth_user 
> table to get rid of that.  If I'm the only one complaining then it isn't 
> worth filing a but report to keep a 'feature' that is not necessary.
>
>
> On Thu, Dec 5, 2013 at 2:42 PM, Niphlod <nip...@gmail.com <javascript:>>wrote:
>
>> I guess this is a problem due to out-of-order reference definitions.....
>> it's quite a leap to require web2py to know about auth_group when it's 
>> not defined yet.......
>> Frankly, it should be treated as a bug (so, file an issue on google code) 
>> only because of backwards compatibility
>>
>> BTW, 
>> auth_groups has a FK to auth_membership
>> auth_membership has a FK to auth_groups and a FK to auth_user
>> your model doesn't make any sense (and frankly, it's a waste of 
>> functionality and doesn't improve any performance).... you're restricting a 
>> user to be part of only one group, jumping from auth_user to auth_groups 
>> without "passing" from auth_membership.
>>
>>
>> On Thursday, December 5, 2013 3:36:17 AM UTC+1, Jim S wrote:
>>>
>>> The following code is failing after update from 2.8.x to 2.8.2 (not 
>>> positive what version I came from)
>>>
>>>
>>> auth.settings.hmac_key = 'sha512:9d8d83af-4769-410b-9cf5-e01a163b498d'  # 
>>> before define_tables()
>>>
>>> auth.settings.extra_fields['auth_user']= [
>>>         Field('auth_group', 'reference auth_group', label='Group', 
>>>               requires=IS_EMPTY_OR(IS_IN_DB(db, 'auth_group.id', 
>>> '%(group)s'))),
>>>         Field('phone', 'string', length=20),
>>>         Field('active', 'boolean', default=True),
>>>         Field('image', 'upload'),
>>>         Field('created', 'datetime', default=request.now, writable=False
>>> ),
>>>         Field('supplier', 'reference supplier', requires=IS_EMPTY_OR(
>>> IS_IN_DB(db, 'supplier.id'))),
>>>         Field('distributor', 'reference distributor', requires=
>>> IS_EMPTY_OR(IS_IN_DB(db, 'distributor.id'))),
>>>         Field('fax', 'string', length=20)
>>>     ]
>>>
>>> ## create all tables needed by auth if not custom tables
>>> auth.define_tables(username=True, signature=False)
>>>
>>>
>>>
>>> The following traceback is generated:
>>>
>>> Traceback (most recent call last):
>>>  File "C:\dev\web2py\gluon\restricted.py", line 217, in restricted
>>>  exec ccode in environment
>>>  File 
>>> "C:/dev/web2py/applications/ibc/models/db.py"<http://127.0.0.1:8000/admin/default/edit/ibc/models/db.py>
>>> , line 69, in <module>
>>>  auth.define_tables(username=True, signature=False)
>>>  File "C:\dev\web2py\gluon\tools.py", line 1707, in define_tables
>>>  format='%(username)s'))
>>>  File "C:\dev\web2py\gluon\dal.py", line 8226, in define_table
>>>  table = self.lazy_define_table(tablename,*fields,**args)
>>>  File "C:\dev\web2py\gluon\dal.py", line 8263, in lazy_define_table
>>>  polymodel=polymodel)
>>>  File "C:\dev\web2py\gluon\dal.py", line 908, in create_table
>>>  raise KeyError('Cannot resolve reference %s in %s definition' % (
>>> referenced, table._tablename))
>>> KeyError: 'Cannot resolve reference auth_group in auth_user definition'
>>>
>>>
>>>
>>>
>>>  -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/T1kli0maSBE/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to