[sqlalchemy] Re: any easy way to make a just-out-of-db object readonly?

2008-12-05 Thread Michael Bayer


On Dec 5, 2008, at 11:10 AM, [EMAIL PROTECTED] wrote:


 i'm asking about SA-related stuff, i know how to handle the python
 side. how to lock relations, collections etc - how to make an
 instance readonly?

 and eventualy if it is poosible after that to unlock that instance at
 some point - so lock all the user-visible stuff but leave some
 flag _locked writable.

you could perhaps override __setattribute__




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[sqlalchemy] Re: any easy way to make a just-out-of-db object readonly?

2008-12-05 Thread Andreas Jung
On 05.12.2008 17:10 Uhr, [EMAIL PROTECTED] wrote:
 i'm asking about SA-related stuff, i know how to handle the python
 side. how to lock relations, collections etc - how to make an
 instance readonly?

 and eventualy if it is poosible after that to unlock that instance at
 some point - so lock all the user-visible stuff but leave some
 flag _locked writable.

You might register a MapperExtension with your mapper. Inside the 
before_*() methods you could perform some checks in order to avoid any 
kind of write operations or modifications.

-aj

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---

begin:vcard
fn:Andreas Jung
n:Jung;Andreas
org:ZOPYX Ltd.  Co. KG
adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
email;internet:[EMAIL PROTECTED]
title:CEO
tel;work:+49-7071-793376
tel;fax:+49-7071-7936840
tel;home:+49-7071-793257
x-mozilla-html:FALSE
url:www.zopyx.com
version:2.1
end:vcard



[sqlalchemy] Re: any easy way to make a just-out-of-db object readonly?

2008-12-05 Thread az

On Friday 05 December 2008 19:22, Michael Bayer wrote:
 On Dec 5, 2008, at 11:10 AM, [EMAIL PROTECTED] wrote:
  i'm asking about SA-related stuff, i know how to handle the python
  side. how to lock relations, collections etc - how to make an
  instance readonly?
 
  and eventualy if it is poosible after that to unlock that instance at
  some point - so lock all the user-visible stuff but leave some
  flag _locked writable.

 you could perhaps override __setattribute__
yeah but what to do with collections... or should i override 
collectionclass... hmm.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[sqlalchemy] Re: any easy way to make a just-out-of-db object readonly?

2008-12-05 Thread az

ah yes, i forgot that already have that in dbcook! 
but i dont think it will avoid adding things to collections. 
okay thanks i'll dig further.  
On Friday 05 December 2008 19:39, Andreas Jung wrote:
 On 05.12.2008 17:10 Uhr, [EMAIL PROTECTED] wrote:
  i'm asking about SA-related stuff, i know how to handle the python
  side. how to lock relations, collections etc - how to make an
  instance readonly?
 
  and eventualy if it is poosible after that to unlock that instance at
  some point - so lock all the user-visible stuff but leave some
  flag _locked writable.

 You might register a MapperExtension with your mapper. Inside the
 before_*() methods you could perform some checks in order to avoid any
 kind of write operations or modifications.

 -aj

 

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---