On 27 August 2012 12:55, Anthony <[email protected]> wrote:

> Not sure what you mean. Can you show your code?
>
> On Monday, August 27, 2012 4:22:18 AM UTC-4, Johann Spies wrote:
>
>> On 26 August 2012 20:33, Anthony <[email protected]> wrote:
>>
>>> the second method is the only way to keep the referenced table lazy (the
>>> first method will trigger the table to be defined).
>>>
>>
>> Does that mean that the lazy table option will not work for a system
>> using a uuid-based reference in stead if id-based?
>>
>>
I am referring to this type of code (from the book):

db.define_table('person',
    Field('uuid', length=64, default=lambda:str(uuid.uuid4())),
    Field('modified_on', 'datetime', default=now),
    Field('name'),
    format='%(name)s')

db.define_table('dog',
    Field('uuid', length=64, default=lambda:str(uuid.uuid4())),
    Field('modified_on', 'datetime', default=now),
    Field('owner', length=64),
    Field('name'),
    format='%(name)s')

db.dog.owner.requires = IS_IN_DB(db,'person.uuid','%(name)s')

if not db(db.person.id).count():
    id = uuid.uuid4()
    db.person.insert(name="Massimo", uuid=id)
    db.dog.insert(owner=id, name="Snoopy")



Regards
Johann

-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 



Reply via email to