El miércoles, 15 de enero de 2014, 15:39:07 (UTC+1), Anthony escribió:
>
> The cascading delete is handled by the database, so the web2py DAL is not
> executing the delete from the db.allegato table and therefore doesn't have
> the opportunity to run the _before_delete and _after_delete callbacks (the
> former is used to autodelete uploaded files).
>
I just run into this issue, I was wondering if it is advisible to perform
the CASCADE on web2py, something like:
def cascader(t1,t2,f):
def func(s):
for r in s.select(t1.id):
s = db(f==r.id)
for func2 in t2._before_delete:
func2(s)
return func
for t in db:
for f in t:
if f.type.startswith('reference'):
ref_table = db[f.type[10:]]
ref_table._before_delete.append(cascader(ref_table,t,f))
this would bring problems for circular references, does not include lists,
etc, but is it a reasonable idea?
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.