[Zope] Accessing arbitrary Python objects from ZPT
Dieter Maurer
dieter@handshake.de
Sat, 30 Mar 2002 21:37:17 +0100
Michael Lausch writes:
> On Fri, 2002-03-29 at 21:18, Dieter Maurer wrote:
> > Please read the Zope developer guide. It should tell you about
> > the security declarations necessary to make attributes accessible
> > by TTW (Through The Web) code...
> >
>
> but how to add security declarations to classes where i don't have the
> source code, or in which i do not want to introduce zope dependencies
> (not that this is a bad thing per se, but consider using the same
> backend code in 2 different environments, WWW and GUI)
I see two options:
* one is called "Monkey-patching" (I do not like the term, but
it is used by the list):
It means "runtime modification" (usually at initialization time)
of existing classes.
Look at "AccessControl.SecurityInfo.allow_class" for an example
of providing security declarations at runtime
"allow_class" makes a class (completely) unprotected.
* derive a Zope special class from the source-less
or general purpose class and add whatever is necessary
to use it inside Zope
I would usually prefer this solution.
Dieter