[Zope] Re: Accessing zope through command-line python

sean.upton@uniontrib.com sean.upton@uniontrib.com
Mon, 24 Feb 2003 12:39:16 -0800


Yep. Magic.  Sets a global security manager on the thread running the Zope
app instance we are using.  Each thread has a single security manager bound
to it at any given point in time.  When Zope serves up requests via ZServer,
for example, it sets this for that thread every time an HTTP request hits
the server: in the web-serving context each hit has a default security
manager (or the last instantiated security manager?) set up for it until it
is changed to respond to a request.  We do the same, but since we are using
a single thread without giving it up, we can do this once at the top of the
script, and then run stuff requiring a security context which is usually TTW
code, but can be some CMF stuff that also assumes a security context.

Sean

-----Original Message-----
From: Paul Winkler [mailto:pw_lists@slinkp.com]
Sent: Monday, February 24, 2003 10:54 AM
To: zope@zope.org
Subject: Re: [Zope] Re: Accessing zope through command-line python


On Mon, Feb 24, 2003 at 10:37:51AM -0800, sean.upton@uniontrib.com wrote:
> #=============================
> # An example of putting new content into 
> # a CMF or Plone site in an out-of-process
> # Zope instance in a Python module:
> #=============================

(snip)

One question:

> newSecurityManager(None,zopeuser)        
> #new security manager to help invokeFactory run
> # also needed to run TTW code (PythonScripts, ZPT, DTML)

How's that work?  you don't use any return value, and you
make no further reference to zopeuser... 
that's what I dislike about Zope, there's too much code that
reads like magical hand-waving :(

 
> I'm working on putting together an out-of-process Zope howto, which I
expect
> to post in the next week or two on Zope.org, but in the meantime, feel
free
> to email me with any questions.

it's a great recipe, thanks!

-- 

Paul Winkler
http://www.slinkp.com


_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )