On 9/20/06 1:55 PM, Christopher Masto wrote:
> Jonathan Vanasco wrote:
>> as an example, in a system i have, no deletes are immediate, deletes
>> are just bool flags + a deletion queue entry / timestemp, that waits
>> for a month before actual deletion.
>> so 95% of my selects on the public side include 'is_deleted= FALSE"
> 
> I tend to have things set up that way as well, so either the
> functionality you describe or an alternate way to accomplish the same
> thing could come in handy.  I'm also thinking about the situation where
> records have permissions/ACLs.

Here's a solution that comes to mind:

1. Override load() in your common base class and check is_deleted() before
deciding whether to return success or failure.  (You can do some magic
object swap stuff to ensure that a "failed" load() leaves the object
unchanged.)

2. Override get_objects() in a custom Manager subclass and then base all
your Managers on this class.  In your new get_objects(), supply some default
query arguments before calling through to the standard Manager class.

I'm hesitant to provide hooks to alter the behavior of these functions in
this way because I really think load() and get_objects() should be
straightforward and predictable.  (What if I *want* to load "deleted"
records?)  The subclassing method is explicit; all's fair in your own
subclasses :)

-John 



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to