To solve this issue include in the line 88 of myapp.py

https://github.com/rochacbruno/web2py_model_less_app/blob/master/modules/myapp.py#L88

self._LAZY_TABLES = []



On Mon, Aug 27, 2012 at 11:33 PM, Andrew <awillima...@gmail.com> wrote:

> Possible Issue, this might be due to the dal changes (or it could be me?):
>
> I'm running a variation of Bruno's Modelless App (and I tried his out of
> the box) https://github.com/rochacbruno/web2py_model_less_app
> , and I get:
>
>
> AttributeError: 'DataBase' object has no attribute '_LAZY_TABLES'
>
>
>
>
> On Sunday, August 26, 2012 8:37:16 AM UTC+12, Massimo Di Pierro wrote:
>>
>> Exactly.
>>
>>     mytable.myfield.set_**attributes(readable=True,**writable=True)
>>
>> is just a shortcut for
>>
>>    mytable.myfield.readable=True
>>    mytable.myfield.writable=True
>>
>> without it the lambda notation would not be very usable.
>>
>> On Saturday, 25 August 2012 11:50:10 UTC-5, Jonathan Lundell wrote:
>>>
>>> On 23 Aug 2012, at 7:25 AM, Massimo Di Pierro <massimo....@gmail.com>
>>> wrote:
>>> > So now in trunk you can do:
>>> >
>>> > db = DAL(lazy_tables=True)
>>> > db.define_table('person',**Field('name'),Field('age','**integer'),
>>> >    on_define=lambda table: [
>>> >            
>>> > table.name.set_attributes(**requires=IS_NOT_EMPTY(),**default=''),
>>>
>>> >            
>>> > table.age.set_attributes(**requires=IS_INT_IN_RANGE(0,**120),default=30),
>>>
>>> >   ])
>>> >
>>> > and the attributes will be set lazily. This is a good idea! Thanks
>>> Jonathan.
>>> >
>>>
>>> Clear something up for me, please. I was a little confused before about
>>> how this was implemented, but I've read the code and it looks like what I
>>> proposed. What I'm not following is the role of set_attributes. Is it
>>> simply to facilitate the lambda? Is this equivalent?
>>>
>>> def on_define(table):
>>>      table.name.requires = IS_NOT_EMPTY()
>>>      table.name.default = ''
>>>      table.age.requires = IS_INT_IN_RANGE(0,120)
>>>      table.age.default = 30
>>>
>>> db = DAL(lazy_tables=True)
>>> db.define_table('person', Field('name'), Field('age','integer'),
>>> on_define=on_define)
>>>
>>  --
>
>
>
>

-- 



Reply via email to