Re: [Zope3-Users] Is a view persistent?
Am Donnerstag, 2. August 2007 13:37 schrieb Fred Drake: On 8/2/07, Hermann Himmelbauer [EMAIL PROTECTED] wrote: mylist = [] @button.buttonAndHandler(_(u'Suchen'), name='suchen') def handle_suchen(self, action): self.mylist.append(123) When I output mylist in my page template, the number 123 is appended to mylist if I press the Suchen button, so if I press it 5 times, the list holds 5 items. When I restart my zope instance, the list is empty again. The attribute will be persistent so long as you don't restart the process, *because* it's a class attribute. Note that the code you showed never sets the value of self.mylist, but only mutates the existing value. To not have a semi-persistent self.mylist, do this instead: def handle_suchen(self, action): self.mylist = [123] Thanks for your reply, I was so Zopified and concentrated on object persistence that I forgot about this really basic Python issue... Best Regards, Hermann -- [EMAIL PROTECTED] GPG key ID: 299893C7 (on keyservers) FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] z3c.recipe.runscript
On Thursday 02 August 2007 11:40, David Pratt wrote: Thank you Stephan for z3c.recipe.runscript. I am just going through some recipe's and was also thinking about something like this. I'll be checking it out in the next day or so. Many thanks. You are welcome. Regards, Stephan -- Stephan Richter CBU Physics Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Rendering subobjects in pages
How can I specify a template to render a sub-object within one of my content objects? For example, pretend I have a Contact object which contains a Person object. I am rendering the Contact object through a page template. class Contact: person = Person() In all the examples I see, rendering the person would be done using many tal expressions like span tal:content=context/person/name / or something similar. Is it possible to render the person object using a single tal expression, div tal:content=context/person /, having the rendering handled by a template somewhere? The reason I want to do this is because the person object will be used in many different classes and for a consistent look and feel I would like to render the object the same on all pages without having to maintain 10 different page templates. Hope this makes sense. Greg ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Rendering subobjects in pages
Hi, On Mon, Aug 06, 2007 at 09:51:18AM -0230, Greg Baker wrote: How can I specify a template to render a sub-object within one of my content objects? For example, pretend I have a Contact object which contains a Person object. I am rendering the Contact object through a page template. class Contact: person = Person() In all the examples I see, rendering the person would be done using many tal expressions like span tal:content=context/person/name / or something similar. Is it possible to render the person object using a single tal expression, div tal:content=context/person /, You may use a view which adapts Person() objects: div tal:content=structure context/person/@@defaultview / You have to define e view for Person() like this: *browser/configure.zcml* [...] page for=..interfaces.IPerson name=defaultview template=mypersontemplate.pt [...] / [...] Don't forget to allow access to you Person()-class (e.g. via configure/class/allow). [snip] Regards, Frank ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Rendering subobjects in pages
Am Montag, 6. August 2007 14:21 schrieb Greg Baker: How can I specify a template to render a sub-object within one of my content objects? For example, pretend I have a Contact object which contains a Person object. I am rendering the Contact object through a page template. class Contact: person = Person() In all the examples I see, rendering the person would be done using many tal expressions like span tal:content=context/person/name / or something similar. Is it possible to render the person object using a single tal expression, div tal:content=context/person /, having the rendering handled by a template somewhere? The reason I want to do this is because the person object will be used in many different classes and for a consistent look and feel I would like to render the object the same on all pages without having to maintain 10 different page templates. I'd recommend to have a look at z3c.form and z3c.formdemo, especially subforms. z3c.formdemo features the addressbook - demo, which handles such issues. Regards, Hermann -- [EMAIL PROTECTED] GPG key ID: 299893C7 (on keyservers) FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] FTP permissions
Hi, I am having trouble restricting the view on contained objects when being represented as a filesystem specifically being accessed via FTP. I pasted the python code and configuration at http://paste.lisp.org/display/45391 Essentially i want to restrict users so they may only view their own objects (eg. objects they have permissions on) and the rest of the contained objects would remain hidden. Thanks in advance, Fergus ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Contract Work
Hello. I am heading the engineering for JSA Technologies in the United States. We are building an application in Zope 3 that will link colleges and universities around the world on a financial network. We are looking for Zope 3 contractors to help us complete the project. The project may include, hardware, software, and lots of networking. We are looking to start ASAP, and the project will last 1-6 months. We would expect you to work from your own location. There is no travel required or special hours. We may hire some people for a longer time. Please contact me directly if you are interested. If you have any specialties, please let me know. -- David ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] How to access request variable from vocabulary
Hi, I have a simple function that is registered a vocabulary for a Choice-widget. My problem is that the vocabulary should access the session, which seems to be only possible if I somehow get the request variable, which is available in a view. (A common way to retrieve the session seems to be session=ISession(self.request)[KEY]). However, the vocabulary seems to get only the context as a parameter but not the view. How can I solve this problem? Best Regards, Hermann -- [EMAIL PROTECTED] GPG key ID: 299893C7 (on keyservers) FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] How to access request variable from vocabulary
Adam Groszer wrote: I'm using something like this: def getCurrentRequest(): return getInteraction().participations[0] It is, of course, better if you can structure your app so you don't have to pull the request out of thin air, but if you do, I'd be a little more careful about it. Like so: def getRequest(): i = zope.security.management.getInteraction() # raises NoInteraction for p in i.participations: if IRequest.providedBy(p): return p raise RuntimeError('Could not find current request.') -- Benji York Senior Software Engineer Zope Corporation ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] How to access request variable from vocabulary
Yow, the whitespace in my last message was seriously messed up. Let me try again. Adam Groszer wrote: I'm using something like this: def getCurrentRequest(): return getInteraction().participations[0] It is, of course, better if you can structure your app so you don't have to pull the request out of thin air, but if you do, I'd be a little more careful about it. Like so: def getRequest(): i = zope.security.management.getInteraction() for p in i.participations: if IRequest.providedBy(p): return p raise RuntimeError('Could not find current request.') -- Benji York Senior Software Engineer Zope Corporation ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] z3c.form: how to use invariant/validator?
On Sunday 05 August 2007 16:51, Peter Piehler wrote: recently I started working with Zope3 and z3c.form. The figures in the form should be checked, for instance that the first name and the surname are not identical. Therefore I write an invariant-check: class IAddress(zope.interface.Interface): Address Interface ... @zope.interface.invariant def areEqual( address ): if address.firstname == address.surname: raise zope.interface.Invalid(ufirst name and surname are same) I was expecting that the error would be shown in the form. Unfortunately, zope canceled the action: Hi Peter, just a quick note to tell you that I am not ignoring you. I have just reproduced the problem in a doctest and I am fixing it now. I'll send another mail, once I checked in a fix. Regards, Stephan -- Stephan Richter CBU Physics Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users