I do not understand

> When I delete the parent, it's child is deleted, which is what I expect.

how can it be? parent does not link the child

> When I delete the queue entry, the child is deleted, which is not desired.

This has nothing to do with autodelete, this has to do with
ondelete='cascade'. You want (I think)

Field('child',db.child,requires=IS_IN_DB(db,'child.id'),ondelete='NO
ACTION')



On Sep 19, 12:48 pm, weheh <richard_gor...@verizon.net> wrote:
> db.define_table('child',
>   Field('parent',db.parent,
>     requires=IS_NULL_OR(IS_IN_DB(db,'parent.id','%(title)s'))),
>   Field('name','upload',length=50,
>     autodelete=True,
>     uploadfolder=os.path.join(request.folder,'static/data/child'),
>     uploadseparate=True,
>     )
>   )
> db.define_table('parent',
>   Field('user_id',db.auth_user,
>     requires=IS_NULL_OR(IS_IN_DB(db,'auth_user.id'))),
>   Field('categ',db.categ,label=T('Category'),default=12,
>     requires=IS_IN_DB(db,'categ.id','%(name)s',zero=None)),
>   Field('blah1','string',length=50,label=T('Blah')),
>   Field('blah2','string',length=50,label=T('Blah')),
>   Field('blah3','string',length=50,label=T('Blah')),
> etc.
> )
> db.define_table('queue',
>   Field('user_id',db.auth_user,
>     requires=IS_NULL_OR(IS_IN_DB(db,'auth_user.id'))),
>   Field('parent',db.parent,requires=IS_IN_DB(db,'parent.id')),
>   Field('start','datetime'),
>   Field('end','datetime'),
>   Field('child',db.child,requires=IS_IN_DB(db,'child.id')),
>   )
>
> When I delete the parent, it's child is deleted, which is what I
> expect.
> When I delete the queue entry, the child is deleted, which is not
> desired.
>
> On Sep 19, 1:24 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > Can you show us the table in question and the queue table?
>
> > On Sep 18, 10:59 pm, weheh <richard_gor...@verizon.net> wrote:
>
> > > I have a table with an upload field declared with autodelete=True. The
> > > upload file is not really uploaded, it's created on the fly. The table
> > > id is referenced by a queue, which is polled to determine whether or
> > > not the upload file needs to be created. Once created, the queue entry
> > > is deleted. This is where the problem is -- deleting the queue entry
> > > also deletes the uploaded file. I only want the uploaded file deleted
> > > when it's parent record is deleted, not when the queue record is
> > > deleted. I've tried a db.mytable.fieldname.autodelete=False just
> > > before deleting the queue entry, but this doesn't work. What should I
> > > be doing?
>
>

Reply via email to