sorry, "def" missing. class Blabla(SQLObject) # here goes the rest def select(cls, clause=None, **kw): sresult = super(Blabla, cls).select(clause, **kw) return sresult.filter(~ LIKE(Blabla.q.aField, "%aParameter%"))
On Sun, Jan 25, 2009 at 17:23, Frank Wagner <frank.wag...@nofusion.de> wrote: > i was facing another situation in which i had to filter each and every > query to a certain table through a certain command. > > in my case what i was doing (with a lot of help from oleg) was > overriding its select-method: > > class Blabla(SQLObject) > # here goes the rest > select(cls, clause=None, **kw): > sresult = super(Blabla, cls).select(clause, **kw) > return sresult.filter(~ LIKE(Blabla.q.aField, "%aParameter%")) > > > by adding this, every select through this class (as long as you don“t > form your queries manually), is appended the filters in here. > > this was a convenient solution in this case in which the > database-structure could not be changed by me. > > HTH, > > Frank > > > > > > On Sun, Jan 25, 2009 at 17:11, David Turner <nova...@openplans.org> wrote: >> http://www.sqlobject.org/Versioning.html >> >> On Sat, 2009-01-24 at 13:07 -0800, Daniel Fetchinson wrote: >>> I guess this question is familiar to many of you and since I came >>> across it for the first time now I'm soliciting best practice and >>> strategy advice. >>> >>> I have a set of tables with all sorts of relationships between them. >>> Many times items get deleted, but I'd like to make sure that I can >>> undo a delete later (not in the same session, but let's say a week >>> from the delete). Is there an obvious one way to do this? >>> >>> What I thought about is creating new tables for each already existing >>> table, something like deleted_zoo for zoo, deleted_animal for animal, >>> etc. Then when I delete something from zoo (which cascades down to >>> animal) I would override the appropriate method that would not only >>> delete the item from the table but would also insert it into the new >>> deleted_XXX tables. Then I could copy back from the deleted_XXX table >>> to the original XXX table if I want or I can delete it from there >>> permanently. >>> >>> How would you guys approach this problem? >>> >>> Cheers, >>> Daniel >>> >>> >> >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by: >> SourcForge Community >> SourceForge wants to tell your story. >> http://p.sf.net/sfu/sf-spreadtheword >> _______________________________________________ >> sqlobject-discuss mailing list >> sqlobject-discuss@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss >> > ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss