I'm running Zope 2.1.4 and PythonMethod 0.1.7, and I'm running into an AttributeError for "validate" when I do: dtml = getattr(self, 'popular.html') I don't know of another way to get at "popular.html" from python. This line is definitely the issue though... The method is called with self, REQUEST as parameters. Any ideas? Kevin
Hmm, I'm not sure if this will work but can you pass the _ namespace and use _.getattr? Ugly... -Michel Kevin Dangoor wrote:
I'm running Zope 2.1.4 and PythonMethod 0.1.7, and I'm running into an AttributeError for "validate" when I do:
dtml = getattr(self, 'popular.html')
I don't know of another way to get at "popular.html" from python. This line is definitely the issue though...
The method is called with self, REQUEST as parameters.
Any ideas?
Kevin
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
getattr is an evil function, and as such isn't allowed in PythonMethods, I'm fairly sure. The reason it's bad is it opens up some neat tricks: getattr(self, 'x_db'[1:]) This isn't caught easily by much of anything, and allows the PythonMethod author to reach _ attributes on objects - which would subvert some of the PythonMethods security. (Noting you can already do the same thing with self['x_db'[1:]] anyway, but it's assumed nothing valuable lives there ;) KevinL
"Kevin Dangoor" wrote I'm running Zope 2.1.4 and PythonMethod 0.1.7, and I'm running into an AttributeError for "validate" when I do:
dtml = getattr(self, 'popular.html')
I don't know of another way to get at "popular.html" from python. This line is definitely the issue though...
The method is called with self, REQUEST as parameters.
Any ideas?
Kevin
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
--------------- qnevhf@obsu.arg.nh --------------- Kevin Littlejohn, Technical Architect, Connect.com.au Don't let the Govt censor our access to the 'net - http://www.efa.org.au/Campaigns/stop.html
----- Original Message ----- From: "Kevin Littlejohn" <darius@connect.com.au> To: "Kevin Dangoor" <kid@kendermedia.com> Cc: <zope-dev@zope.org> Sent: Wednesday, February 23, 2000 6:29 PM Subject: Re: [Zope-dev] getattr in a PythonMethod
(Noting you can already do the same thing with self['x_db'[1:]] anyway, but it's assumed nothing valuable lives there ;)
Interesting... there's the answer to my question. dtml = self['popular.html'] does just what I need :) Kevin
"Kevin Dangoor" wrote I'm running Zope 2.1.4 and PythonMethod 0.1.7, and I'm running into an AttributeError for "validate" when I do:
dtml = getattr(self, 'popular.html')
I don't know of another way to get at "popular.html" from python. This
line
is definitely the issue though...
The method is called with self, REQUEST as parameters.
Kevin Dangoor wrote:
From: "Kevin Littlejohn" <darius@connect.com.au>
(Noting you can already do the same thing with self['x_db'[1:]] anyway, but it's assumed nothing valuable lives there ;)
Interesting... there's the answer to my question.
dtml = self['popular.html']
does just what I need :)
As long as 'popular.html' lives in the same folder as the PM, yes. Otherwise you'll want to use self.aq_acquire('popular.html'), which works in both cases. If you're trying to get an attribute of something which doesn't support acquisition or index notation, you're out of luck :-( getattr is broken because I can't allow use of the builtin getattr (for the reasons Kevin explains) and the careful_getattr I *do* provide tries to call validate all the time, and I haven't yet figured out what it wants. Cheers, Evan @ 4-am & digicool
participants (4)
-
Evan Simpson -
Kevin Dangoor -
Kevin Littlejohn -
Michel Pelletier