Re: [Zope] Python Methods can't "construct literal dictionaries"?
This is one of the shortcomings of Python Methods that Scripts eliminate. You can work around it by writing: x = {} x.update({y: z}) Cheers, Evan @ digicool & 4-am ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] python methods
> The Doctor What <[EMAIL PROTECTED]> wrote: > * Tres Seaver ([EMAIL PROTECTED]) [001130 09:06]: > > Chris Withers <[EMAIL PROTECTED]> wrote: > > 'lambda' is actually a keyword, not a function, and hence works > > fine in PM0.1.7. 'map()', 'filter()', et al., were deemed to > > be susceptible to being used in DOS attacks, and hence are not > > permitted in through-the-web code (they would need to be added > > to the '_' namespace, like 'str()', et aliae). > > For those of us who are trying to figure out everything at a low > level, where would this be in the source? * 'lambda' as keyword: http://www.python.org/doc/1.5.2p2/ref/lambda.html#l2h-317 * DTML sets up the "safe" functions (available in the '_' namespace), in: $SOFTWARE_HOME/DocumentTemplate/DT_Util.py. * "Old" PythonMethod stuff tries hard to limit the user to the same set of "builtins" as DTML; see: $INSTANCE_HOME/Products/PythonMethod/Guarded.py (note that TemplateDict's "safe" methods are borrowed). Tres. -- === Tres Seaver[EMAIL PROTECTED] Digital Creations "Zope Dealers" http://www.zope.org ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] python methods
From: The Doctor What <[EMAIL PROTECTED]> > For those of us who are trying to figure out everything at a low > level, where would this be in the source? Here's an example of adding stuff to '_' using a monkey patch Product. Contents of __init__.py of directory Products/MoreBuiltins: def _AddBuiltins(): from urllib import urlopen, quote, unquote from base64 import decodestring, encodestring def same_type(self, a, b): return type(a)==type(b) def attr_map(self, o): r = o.__dict__.copy() for k in r.keys(): if k[:1] == '_': del r[k] return r class AnObject: def __init__(self, **kw): self.__dict__.update(kw) NewBuiltins = { 'list': list, 'tuple': tuple, 'map': map, 'filter': filter, 'reduce': reduce, 'urllib': AnObject(open=urlopen, quote=quote, unquote=unquote), 'base64': AnObject(decode=decodestring, encode=encodestring), 'same_type': same_type, 'attr_map': attr_map, } from DocumentTemplate.DT_Util import TemplateDict TemplateDict.__dict__.update(NewBuiltins) #call it _AddBuiltins() ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] python methods
* Tres Seaver ([EMAIL PROTECTED]) [001130 09:06]: > Chris Withers <[EMAIL PROTECTED]> wrote: > 'lambda' is actually a keyword, not a function, and hence works > fine in PM0.1.7. 'map()', 'filter()', et al., were deemed to > be susceptible to being used in DOS attacks, and hence are not > permitted in through-the-web code (they would need to be added > to the '_' namespace, like 'str()', et aliae). For those of us who are trying to figure out everything at a low level, where would this be in the source? Ciao! -- When a trainstation is were a train stops what is a workstation? The Doctor What: Un-Humble http://docwhat.gerf.org/ [EMAIL PROTECTED] KF6VNC ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] python methods
Chris Withers <[EMAIL PROTECTED]> wrote: > > Terry Kerr wrote: > > > > Hi, > > > > Is there any way to get access to inbuild python functions like 'filter' > > and 'lambda' within pythonMethods? > > I think the powers that be decided they were 'unsafe' :-( > > Can anyone confirm or deny? 'lambda' is actually a keyword, not a function, and hence works fine in PM0.1.7. 'map()', 'filter()', et al., were deemed to be susceptible to being used in DOS attacks, and hence are not permitted in through-the-web code (they would need to be added to the '_' namespace, like 'str()', et aliae). Tres. -- === Tres Seaver[EMAIL PROTECTED] Digital Creations "Zope Dealers" http://www.zope.org ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] python methods
Terry Kerr wrote: > > Hi, > > Is there any way to get access to inbuild python functions like 'filter' > and 'lambda' within pythonMethods? I think the powers that be decided they were 'unsafe' :-( Can anyone confirm or deny? cheers, Chris ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] Python Methods Vote
Just view the poll again. Everything but "python method" has been getting trounced so far. How come "python function" isn't there, again ? Isn't that what they actually are ? ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] Python Methods Vote
I have the opposite problem. Having voted once - early yesterday - I now can't vote again. The reason I want to vote again is that I have changed my mind! Now I want to _poll down_ "Python Method" and add a new alternative "ZPython Method" or add some points to "Python Script" or "ZPY". The poll is not cookiebased. > Is there any way you can see what the results are looking like without > having to vote again? > > How do you know we're only voting once? ;-) > > cheers, > > Chris > > Michel Pelletier wrote: > > > > Please vote folks! > > > > -Michel > > > > Shane Hathaway wrote: > > > > > > Being Election Day in the United States, now is a good time to vote on > > > the new name for Python Methods. > > > > > > Python Methods are a relatively new concept for Zope. They give you the > > > features of DTML, such as through-the-web editing and security, while > > > providing a familiar, refined syntax. > > > > > > But before we can fold them into the Zope core, you need to help us > > > choose the right name for them. Some have voiced the opinion that the > > > name "Python Method" is confusing because it can just as easily refer to > > > methods in standard Python modules. > > > > > > There are some interesting alternatives, so please cast your vote! > > > > > > http://www.zope.org/Members/hathawsh/poll > > > > > > ___ > > > Zope-Dev maillist - [EMAIL PROTECTED] > > > 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 ) > > > > ___ > > Zope maillist - [EMAIL PROTECTED] > > 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 - [EMAIL PROTECTED] > 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 - [EMAIL PROTECTED] 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 )
RE: [Zope] Python Methods Vote
> Is there any way you can see what the results are looking like without > having to vote again? Don't worry, there's no need actually to count the votes. Despite the fact that this race went right down to the wire, according to my complex computer-based prediction models (based on exit polls and incredibly detailed statistical analysis) I can hereby announce that "Python Script" is the outright undisputed winner :) ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] python methods
Python methods are not yet part of the standard distribution, you can however get the product install tarball from Zope.org - Original Message - From: "Manuel Amador (Rudd-O) Gerente de desarrollo Alpha Omega Creative Solutions http: //www.alomega.com/" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, September 29, 2000 10:56 PM Subject: [Zope] python methods > Oh, another thingy: > > An object called Python method is supposed to appear on > the Add list? or am I supposed to emulate it with some > kind of external method and files? If that's the case, > well, sad kludge. Please let me know. > > -- >Universidad Federico Santa Maria - Campus Guayaquil > > ___ > Zope maillist - [EMAIL PROTECTED] > 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 - [EMAIL PROTECTED] 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 )