[Zope] Python Methods can't construct literal dictionaries?
I'm trying to create a Python Method, using PythonMethod 0-1-7, that validates a set of form values before updating a database. I planned to return any/all errors as a dictionary keyed by the errant field name. But statements like this in my Python Method input_errors = {} input_errors['password'] = "password must not be empty" ... return input_errors result in the following error when I try to save the change to the code: Error Type: Python Method Error Error Value: Forbidden operation STORE_SUBSCR at line 3 What's up with that? I can't create dictionaries in Python Methods? I must be missing something. Is there some way around this? -- Fred Yankowski [EMAIL PROTECTED] tel: +1.630.879.1312 Principal Consultant www.OntoSys.com fax: +1.630.879.1370 OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA ___ 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 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
* 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 )
[Zope] python methods
Hi, Is there any way to get access to inbuild python functions like 'filter' and 'lambda' within pythonMethods? terry -- Terry Kerr ([EMAIL PROTECTED]) Adroit Internet Solutions (www.adroit.net) Phone: +61 3 9563 4461 Fax: +61 3 9563 3856 ICQ: 79303381 ___ 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] python methods
Hi, I'm having problems with Python methods. I've followed the instructions for the guestbook example [1] to the letter but when I add the Python method [2] is causes an error as follows: Error Type: NameError Error Value: context TraceBack: Traceback (innermost last): File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line 165, in publish File /usr/local/Zope-2.1.6-src/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: addEntryAction) File... etc. Can anyone offer any advice? - Best regards, Lee Reilly [1] http://www.zope.org/Members/michel/ZB/SimpleExamples.html [2] Python method """ Create a guest book entry. """ # create a unique document id id='entry_%d' % len(context.objectIds()) # create the document context.manage_addProduct['OFSP'].manage_addDTMLDocument(id, title="", file=comments) # add a guest_name string property doc=getattr(context, id) doc.manage_addProperty('guest_name', guest_name, 'string') ___ 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] Python Methods Vote
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 )
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 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
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 )
[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 )
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 )
[Zope] Python Methods 0.1.7 under Zope 2.2.1
Working with Zope 2.2.1 (in two distinct servers), I noticed the following behaviour with (0.1.7) Python methods (created under Manager role): 1. Apparently anyone (non-authenticated users) can successfully run the methods even if these include operations (folder/file/user creation, etc.) for which the invoking user has no permission. 2. Although I am able to give Python methods the proxy role of Manager, I can not give them other proxy roles, roles which I also have and am able to give to DTML methods, for instance (anyway, problem 1 makes privileged proxy roles superfluous... :) ). Has anyone fixed this (while we wait for the new shiny Python methods)? Best regards thanks in advance J Esteves -- jmce: +351 919838775 ~ http://artenumerica.com/ ~ http://artenumerica.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 )