Yes, that works for me.

-Jim

On Friday, August 31, 2012 8:36:51 AM UTC-5, Massimo Di Pierro wrote:
>
> I am using trunk (2.0.3). Your original code is correct.
>
> I cannot reproduce the issue. I tried:
>
> $ python web2py.py -S welcome -M -N
> >>> link = db.define_table('link', 
>     Field('linkId', 'id', readable=False),
>     Field('name', length=50, required=True, unique=True),
>     Field('parentLinkId', 'reference link', required=True,
>           label='Parent Link'),
>     Field('controller', length=512, required=True),
>     Field('method', length=512, required=True),
>     Field('picture', length=512, required=False),
>     Field('permissionId', db.auth_permission, label='Rqd Permission'),
>     Field('groupId', db.auth_group, label='Rqd Group'),
>     Field('description', 'text', required=True),
>     format='%(name)s')
> >>> link
> <Table link 
> (linkId,name,parentLinkId,controller,method,picture,permissionId,groupId,description)>
>
> Could you please perform the same check?
>
> On Friday, 31 August 2012 08:29:32 UTC-5, Jim S wrote:
>>
>> No, I made no changes to my code what-so-ever.
>>
>> -Jim
>>
>> On Fri, Aug 31, 2012 at 8:20 AM, Bruno Rocha <rocha...@gmail.com> wrote:
>>
>>> did you turned lazy_tables to True on your db definition?
>>>
>>> Bruno Rocha
>>> http://rochacbruno.com.br
>>> mobile
>>>  Em 31/08/2012 10:02, "Jim S" <j...@qlf.com> escreveu:
>>>
>>> Getting the following:
>>>>
>>>> Traceback (most recent call last):
>>>>
>>>>
>>>>   File "C:\dev\web2py\gluon\restricted.py", line 209, in restricted
>>>>
>>>>
>>>>     exec ccode in environment
>>>>   File "C:/dev/web2py/applications/infocenter/models/db.py" 
>>>> <http://127.0.0.1:8000/admin/default/edit/infocenter/models/db.py>, line 
>>>> 152, in <module>
>>>>
>>>>
>>>>     format='%(name)s')
>>>>   File "C:\dev\web2py\gluon\dal.py", line 7047, in define_table
>>>>
>>>>
>>>>     table = self.lazy_define_table(tablename,*fields,**args)
>>>>
>>>>
>>>>   File "C:\dev\web2py\gluon\dal.py", line 7078, in lazy_define_table
>>>>
>>>>
>>>>     polymodel=polymodel)
>>>>   File "C:\dev\web2py\gluon\dal.py", line 920, in create_table
>>>>
>>>>
>>>>     fake_migrate=fake_migrate)
>>>>   File "C:\dev\web2py\gluon\dal.py", line 988, in migrate_table
>>>>
>>>>
>>>>     and not isinstance(table[key].type, SQLCustomType) \
>>>>
>>>>
>>>>   File "C:\dev\web2py\gluon\dal.py", line 7559, in __getitem__
>>>>
>>>>
>>>>     return ogetattr(self, str(key))
>>>>
>>>> AttributeError: 'Table' object has no attribute 'permissionid'
>>>>
>>>> Relevant define_table in db.py:
>>>>
>>>> link = db.define_table('link', 
>>>>     Field('linkId', 'id', readable=False),
>>>>     Field('name', length=50, required=True, unique=True),
>>>>     Field('parentLinkId', 'reference link', required=True,
>>>>           label='Parent Link'),
>>>>     Field('controller', length=512, required=True),
>>>>     Field('method', length=512, required=True),
>>>>     Field('picture', length=512, required=False),
>>>>     Field('permissionId', db.auth_permission, label='Rqd Permission'),
>>>>     Field('groupId', db.auth_group, label='Rqd Group'),
>>>>     Field('description', 'text', required=True),
>>>>     format='%(name)s')
>>>>
>>>>
>>>> This is line 152.  If I change it to the following (added .id to 
>>>> definition of permissionId field reference) :
>>>>
>>>> link = db.define_table('link', 
>>>>  Field('linkId', 'id', readable=False),
>>>>  Field('name', length=50, required=True, unique=True),
>>>>  Field('parentLinkId', 'reference link', required=True,
>>>>  label='Parent Link'),
>>>>  Field('controller', length=512, required=True),
>>>>  Field('method', length=512, required=True),
>>>>  Field('picture', length=512, required=False),
>>>>  Field('permissionId', db.auth_permission.id, label='Rqd Permission'), 
>>>>  Field('groupId', db.auth_group, label='Rqd Group'),
>>>>  Field('description', 'text', required=True),
>>>>  format='%(name)s')
>>>>
>>>> Then I get the following traceback:
>>>>
>>>> Traceback (most recent call last):
>>>>
>>>>
>>>>   File "C:\dev\web2py\gluon\restricted.py", line 209, in restricted
>>>>
>>>>
>>>>     exec ccode in environment
>>>>   File "C:/dev/web2py/applications/infocenter/models/db.py" 
>>>> <http://127.0.0.1:8000/admin/default/edit/infocenter/models/db.py>, line 
>>>> 152, in <module>
>>>>
>>>>
>>>>     format='%(name)s')
>>>>   File "C:\dev\web2py\gluon\dal.py", line 7047, in define_table
>>>>
>>>>
>>>>     table = self.lazy_define_table(tablename,*fields,**args)
>>>>
>>>>
>>>>   File "C:\dev\web2py\gluon\dal.py", line 7078, in lazy_define_table
>>>>
>>>>
>>>>     polymodel=polymodel)
>>>>   File "C:\dev\web2py\gluon\dal.py", line 721, in create_table
>>>>
>>>>
>>>>     elif field_type.startswith('reference'):
>>>>
>>>>
>>>>   File "C:\dev\web2py\gluon\dal.py", line 8122, in startswith
>>>>
>>>>
>>>>     raise SyntaxError, "startswith used with incompatible field type"
>>>> SyntaxError: startswith used with incompatible field type
>>>>
>>>> Any ideas where to look for this one?
>>>>
>>>> -Jim
>>>>
>>>> -- 
>>>>  
>>>>  
>>>>  
>>>>
>>> -- 
>>>  
>>>  
>>>  
>>>
>>
>>

-- 



Reply via email to