Hey,

[email protected] wrote:
> I implemented a very crude flush/commit-time version of this today
> that disables all modifications. Michael suggested the use of
> connection_callable to provide fine-grained control of which engine to
> use for modifications. I haven't gone through all the details yet but
> it seems to work for my basic tests.
> 
> pjjH
> 
> 
> class ReadOnlySession(DefaultSession):
>     def __init__(self, **kwargs):
>         super(ReadOnlySession, self).__init__(**kwargs)
>         self._mapper_flush_opts = {'connection_callable',
> self._disable_any_modifications}
> 
>     def _disable_any_modifications(self, mapper=None, instance=None,
> **kwargs):
>         return None

If I understand it correctly, this is on a per-session basis, correct? 
I'd like to block modification to some but not all objects in the same 
session.

Regards,

Martijn


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
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