[Zope-dev] use of exec in products considered harmful?

Toby Dickenson tdickenson@geminidataloggers.com
Wed, 15 Mar 2000 11:55:40 +0000


On Tue, 14 Mar 2000 09:18:30 -0800, Michel Pelletier
<michel@digicool.com> wrote:

>Toby Dickenson wrote:
>> 
>> On Mon, 13 Mar 2000 12:32:05 -0800, "Jonothan Farr" <jfarr@real.com>
>> wrote:
>> 
>> >> Would something like the Brains class that can be set for SQL methods
>> >> do the job?
>> >
>> >Brains classes always have the same constructor arguments (namely: (self)).
>> 
>> That doesn't need to be true for _your_ brains classes.
>> 
>> >What
>> >makes this problem difficult is that the constructors of Zope objects which map
>> >to local files can have virtually any signature.
>> 
>> Let your brains classes __init__ take a REQUEST parameter. They can
>> extract the properties it needs, before calling the base class
>> __init__.
>
>Note also that your brains class can acquire REQUEST using self.REQUEST.

Normally thats true, however we need these parameters in a __init__,
and constructors run with an empty acquisition context.

(Unlike many acquisition problems, I think this one makes sense -
things don't have a context until they have been created.)


Toby Dickenson
tdickenson@geminidataloggers.com