On Dec 21, 2007, at 3:13 PM, Rick Morrison wrote:

> Something like this is available on a roll-your-own basis via Python  
> properties along with some mapper tricks:
>
>    
> http://www.sqlalchemy.org/docs/04/mappers.html#advdatamapping_mapper_overriding
>
> I would be +1 for such a feature implemented on mapped instances,  
> could be useful for detecting those hard-to-find bugs, but I can't  
> think of a nice and simple API for it. For mapped instances via  
> Query(), it  could be an .option(), but I can't see a good way for  
> its use on relation()s. Also not sure if such a feature would throw  
> an exception on attribute setting, or whether it ought to simply be  
> ingored during a flush (OIOW, have it's "dirty" flag locked down to  
> False)
>


I think the only way something like this should be done is as a test  
fixture which decorates classes during unit tests.    It would be  
fairly clumsy to have in production code.

If you have coworkers who write broken code, the way you solve that is  
by having unit tests which will fail when the coworkers in question do  
something theyre not supposed to.   If other people are writing code  
that sets attrbutes its not supposed to and breaks things, you need  
more tests to catch those conditions.  If youre putting code into  
production that hasnt been tested, then you need a build process,  
automated testing, etc.    There is definitely a "best practice" here  
and test driven development is it.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to