So, is this a bug in populuate, or something else?

On Oct 19, 8:27 pm, BigBaaadBob <bigbaaad...@gmail.com> wrote:
> # The origin of the requirement: i.e. whether it is fundamental or
> derived
> db.define_table('origin',
>     Field('name', requires=IS_NOT_EMPTY()),
>     Field('key', requires=IS_NOT_EMPTY()),
>     format='%(name)s'
> )
>
> # The category of the requirement
> db.define_table('kind',
>     Field('name', requires=IS_NOT_EMPTY()),
>     Field('key', requires=IS_NOT_EMPTY()),
>     format='%(name)s'
> )
>
> # The actual requirement object
> db.define_table('requirement',
>     Field('title',requires=IS_NOT_EMPTY()),
>     Field('body', 'text',requires=IS_NOT_EMPTY()),
>     Field('rationale', 'text'),
>     Field('preconditions', 'text'),
>     Field('postconditions', 'text'),
>     Field('traces_to', 'reference
> requirement',requires=IS_EMPTY_OR(IS_IN_DB(db, 'requirement.id',
> 'requirement.title'))),
>     Field('origin', db.origin,requires=IS_IN_DB(db, 'origin.id',
> 'origin.name')),
>     Field('kind', db.kind,requires=IS_IN_DB(db, 'kind.id',
> 'kind.name')),
>     Field('is_safety_critical','boolean'),
>     Field('updated_by', db.auth_user, default=auth.user_id,
> update=auth.user_id, readable=False, writable=False),
>     Field('updated_on', 'datetime', default=request.now,
> update=request.now, readable=False, writable=False),
>     format='%(title)s'
> )
>
> # Put fake data in the requirements table
> from gluon.contrib.populate import populate
> if db(db.origin.id>0).count() == 0:
>     populate(db.origin,5)
>     db.commit()
>
> if db(db.kind.id>0).count() == 0:
>     populate(db.kind,5)
>     db.commit()
>
> if db(db.requirement.id>0).count() == 0:
>     populate(db.requirement,50)
>     db.commit()
>
> On Oct 19, 8:16 pm,BigBaaadBob<bigbaaad...@gmail.com> wrote:
>
> > I can reliably create this problem with a model that contains
> > "references xxx" and using populate.  Trying to access the table in
> > the db manager causes the referenced error.
>
>

Reply via email to