[Zope] Re:[Zope]Python Method question

Chris McDonough chrism@digicool.com
Tue, 8 Aug 2000 10:18:40 -0400


Ahhhh... I see.  Thanks.

Well, instead of calling execfile() (or exec()), make the PythonMethods
for google and altavista, etc. part of your Product.  Then replace the
call to execfile with a call to the PythonMethod, eg.

methods = [self.googlepythonmethod, self.altavistapythonmethod]
for method in methods:
   count = count + 1
   # whatever security stuff you're talking about...
   method()

Does this make sense?  I *think* this will work.


-----Original Message-----
From: entropia [mailto:entropiamax@jazzfree.com]
Sent: Tuesday, August 08, 2000 10:05 AM
To: Chris McDonough
Cc: zope@zope.org
Subject: Re: [Zope] Re:[Zope]Python Method question


I am a Zope Newbie. I dont understand ZOpe too much. I know python but I
am not an expert. Well, I want to make a Zope Product. There is a python
program Pagecast (pagecast.sourceforge.net, I am not the creator) that I
want to transform in a Product. This program submit a list of URL to
various search engines. For each search engine there is a file that is
executable code. My desire is that this files can be modified by any
manager, not only the system administrator. For security reason I think
that this should be a Python Method. 
In the original code I have: 
 for file in Servers: 
            count = count + 1 
            # TODO insert security here 
            execfile(file, globals(), locals()) 
where servers is a list Servers=["google.def","altavista.def",...] 
As I said, this .def files are executable code. 
My question is: 
How can I execute this file if this file is a PythonMethod? Is that
posible? 
Chris McDonough escribió: 
I'm still not sure what you mean (I'm sure this is my fault...) 
> -----Original Message----- 
> From: entropia [mailto:entropiamax@jazzfree.com] 
> Sent: Tuesday, August 08, 2000 7:34 AM 
> To: zope@zope.org 
> Subject: [Zope] Re:[Zope]Python Method question 
> 
> 
> My question is this: 
>  I have a Zope Product. I want that some modules from this product be 
> configurable. I can use exec() but then I have a big security 
> hole. I am 
> not 
> a ZOBD expert, but I belive thet it doesn't save methods, only 
> variables. 
> Exits somo trick thet permits me: 
> import aPythonMethod 
> or 
> x=PythonMethod.call(....) 
> or something 
> Is that posible? 
> 
> Chris McDonough escribió: 
> 
> > Do you mean you want to use a Python Method (in the sense of a 
> methodish 
> > object instantiated from Evan Simpson's Python Method 
> Product) from a 
> > Python Product?  You *should* be able to call it by getting 
> a hold of 
> it 
> > through acquisition or by otherwise getting a hold of an 
> object in the 
> 
> > ZODB and traversing from it. 
> > 
> > > -----Original Message----- 
> > > From: entropia [mailto:entropiamax@jazzfree.com] 
> > > Sent: Monday, August 07, 2000 3:20 AM 
> > > To: zope@zope.org 
> > > Subject: [Zope] Python Method question 
> > > 
> > > 
> > > I hava a question regards Python Method: How can I 
> > > import a Python Method from a Product module? 
> > > 
> > > 
> > > _______________________________________________ 
> > > Zope maillist  -  Zope@zope.org 
> > > http://lists.zope.org/mailman/listinfo/zope 
> > > **   No cross posts or HTML encoding!  ** 
> > > (Related lists - 
> > >  http://lists.zope.org/mailman/listinfo/zope-announce 
> > >  http://lists.zope.org/mailman/listinfo/zope-dev ) 
> > > 
> 
> 
> 
> 
> _______________________________________________ 
> Zope maillist  -  Zope@zope.org 
> http://lists.zope.org/mailman/listinfo/zope 
> **   No cross posts or HTML encoding!  ** 
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce 
>  http://lists.zope.org/mailman/listinfo/zope-dev ) 
>