[web2py] Deleting uploaded files

2011-07-26 Thread Johann Spies
I have the following model:


db.define_table(files,
Field(title, string),
Field(description, text),
Field(file,upload, autodelete = True), #
something to be uploaded
signature)
db.files.id.represent = \
  lambda id: A('edit',
   _href=URL(r=request, c='default',
 f='edit_document_entry',
 args=str(id)))

When I use the 'edit' link and click on the 'delete' button and submit
Web2Py flashes that the record has been deleted.  Actually that is not
true:  All that was deleted was sthe uploaded file or at least the link to
it in the record.  The rest of the record is still there.

The record count stays the same after the deletion.

I know I can delete the record using (db.files.id==id).delete()  but why
the abovementioned behaviour?

Regards
Johann
-- 
 May grace and peace be yours in abundance through the full knowledge of God
and of Jesus our Lord!  His divine power has given us everything we need for
life and godliness through the full knowledge of the one who called us by
his own glory and excellence.
2 Pet. 1:2b,3a


Re: [web2py] Deleting uploaded files

2011-07-26 Thread Richard Vézina
It's maybe related somehow with this issue :
https://groups.google.com/forum/#!topic/web2py/-tFA1G5wbsI

It seems to me that 1.97.1 had break something about upload type...

Richard

On Tue, Jul 26, 2011 at 6:23 AM, Johann Spies johann.sp...@gmail.comwrote:

 I have the following model:


 db.define_table(files,
 Field(title, string),
 Field(description, text),
 Field(file,upload, autodelete = True), #
 something to be uploaded
 signature)
 db.files.id.represent = \
   lambda id: A('edit',
_href=URL(r=request, c='default',
  f='edit_document_entry',
  args=str(id)))

 When I use the 'edit' link and click on the 'delete' button and submit
 Web2Py flashes that the record has been deleted.  Actually that is not
 true:  All that was deleted was sthe uploaded file or at least the link to
 it in the record.  The rest of the record is still there.

 The record count stays the same after the deletion.

 I know I can delete the record using (db.files.id==id).delete()  but why
 the abovementioned behaviour?

 Regards
 Johann
 --
  May grace and peace be yours in abundance through the full knowledge of
 God and of Jesus our Lord!  His divine power has given us everything we need
 for life and godliness through the full knowledge of the one who called us
 by his own glory and excellence.
 2 Pet. 1:2b,3a