Fwd: [Zope3-Users] How to publicly add object to Zope component
Hello Thanks very much for your pointer. I finally figure it out Basically in my $ZOPE_HOME/lib/python/my_project/browser/configure.zcml, I add browser:view for=isw.ConferenceGoer.IConferenceGoer name=+ class=zope.app.container.browser.adding.ContentAdding permission=isw.Register --- my own custom permission in permissions.zcml /browser:view That is how you can modify the permission for adding view (site/+/Add...) Martin 2005/10/28, Martin Margo [EMAIL PROTECTED]: Martijn thank you for responding. My response is below 2005/10/28, Martijn Faassen [EMAIL PROTECTED]: Martin Margo wrote: [snip] How do I make site/+/AddConferenceGoer.html= publicly available without being prompted for a password? Is there a configuration file somewhere I can set this up? I've ran into this one. The problem is that the '+' view registered by Zope 3 is not allowing access by people who don't have Zope management permission. Another point: I have tried granting zope.anybody Zope.ManageContent permission and site/+/AddConferenceGoer.html is now available but the user can manipulate the URL to go in and modify other people's info. I don't think this is a very good approach, as you'd give zope.anybody an awful lot of rights all of a sudden. I agree. I don't want to use this. I want to finegrained the permission for edit and add. I want to be able to assign a certain permission myown.Permission1 for add and myown.Permission2 (assuming that the 2 keyword are in permission.zcml) Anyway, this is how you can register your own adding (+) view for a particular content type: view for=path.to.ISomeInterface name=+ class=zope.app.container.browser.adding.ContentAdding permission=myownPermission /view I tried this and it complains because the parameter type is missing. Looking at von Weitershausen's book, identifier 'type' and 'factory' are needed. What should the value be for those variable if I want to overrride + view? Thanks in advance Martin of course if you make permission 'zope.Public', you'd still be exposing the add view for your particular content type (all the ones that implement ISomeInterface) to the whole world, so be careful not to do this to normal IFolder, for instance, unless you really really want that. Good luck! Regards, Martijn ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Complex Adapter Requirements - Named Adapters?
Hi, My project has an IAccommodation object type, representing a generic housing unit, from which we subclass several types of housing (ISharedHouse, IFamilyHouse, ILargerDevelopment,...). Now, we need to recognise various standards in relation to these accommodation units - these are standards that have been defined by various local councils etc, and an accommodation unit typically has to meet certain conditions before it can be deemed to meet that standard. A property that meets a standard is deemed to be better than one that doesn't. However, there is a degree of complexity to these standards... * Different standards will apply to different accommodation types. * Some accommodation types will have no relevant standard. * Some standards will apply to an accommodation type in some geographic areas but not other areas. One reason we want to handle these standards is to be able to rate the accommodation. E.g., a house that wasn't part of the Accreditation Scheme standard could appear lower in search results than one that was. Naturally, where there is no relevant standard for an accommodation to live up to, we do not want to penalise it in this way (or possibly would want it to appear below those that do meet a standard, and those that don't meet a standard but could...) Now, I believe I should be defining an interface or interfaces for standards and using adapters to adapt my Accommodation Objects to the 'standards' interface(s). My question is, how best to handle the complexity I've outlined above? One thought I had, was creating an interface IStandard, with attributes like meetsstandard and nameofstandard, and then subclass this, e.g. to IAccreditationScheme and INationalCode (where Accreditation Scheme and National Code are the names of two of the standards). But I get a little stuck conceptually at the point where I try to handle, for example, the fact that for some ISharedHouse objects, IAccreditationScheme would be suitable, whilst for others it wouldn't, because of their location. In fact it's likely that in the future we will need to recognise two or more standards for a particular accommodation type (so IAccreditationScheme and IHouseCheck chould both apply to ISharedHouse objects, in differect areas). I recalled reading in Philipp's book about Named Adapters, but looking back I can only find brief references to them. A 'search' through the PDF of Stephan's book reveals no instances of the phrase named adapter (or variations). Are these something I should be looking into, and if so, where can I read up on them? Or does anyone have any other suggestions on handling this? Many thanks, James ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Validation of schemas?
On Sunday 30 October 2005 04:45, Adam Summers wrote: How do I implement a validation rule that says either email or phone have to exist, but not necissarily both. You do that using invariants. Look at zope.interface/README.txt for details. 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
Re: [Zope3-Users] Help us! Calling a Python Script from ZPT
On Saturday 29 October 2005 20:50, Wade Leftwich wrote: Stephan Richter wrote: On Saturday 29 October 2005 11:35, Paolo Cilmo wrote: I need to develop a site using ZMI (Zope2 typical using) and especially i want to develop this applications: We do not support TTW development. 1- I've a package with a class and into the class a method 2- with browser:addMenuItem in zcml i can insert a package into zmi from add menu 3- I've a Page Template into ZMI ASK: how i call from the Page Template the script, passig parameters and to have a response from script? Why do you need to have this Page Template in ZMI? Why not on the file system? I'm working on an application where Page Templates belong in the ZMI, at least I think so. The content being displayed is a business directory, with suppliers, products, and categories for those products. We will be implementing 50 different directories, with the same basic content structure but very different designs. Each of those directories will use 5 or 6 page templates, which go in the ZMI. Why not have those templates on the file system? Is there a need for users to modify those templates? It seems like this is a common pattern for content management applications. Maybe, I don't know. Repeating my own posting from 10/9, here's how I made an adapter to use a file system view with a ZMI template: Again, we do not support TTW development. If you do such experiments that's great, but you cannot expect much help. 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
Re: [Zope3-Users] Help us! Calling a Python Script from ZPT
Stephan Richter wrote: On Saturday 29 October 2005 20:50, Wade Leftwich wrote: Stephan Richter wrote: On Saturday 29 October 2005 11:35, Paolo Cilmo wrote: I need to develop a site using ZMI (Zope2 typical using) and especially i want to develop this applications: We do not support TTW development. 1- I've a package with a class and into the class a method 2- with browser:addMenuItem in zcml i can insert a package into zmi from add menu 3- I've a Page Template into ZMI ASK: how i call from the Page Template the script, passig parameters and to have a response from script? Why do you need to have this Page Template in ZMI? Why not on the file system? I'm working on an application where Page Templates belong in the ZMI, at least I think so. The content being displayed is a business directory, with suppliers, products, and categories for those products. We will be implementing 50 different directories, with the same basic content structure but very different designs. Each of those directories will use 5 or 6 page templates, which go in the ZMI. Why not have those templates on the file system? Is there a need for users to modify those templates? Yes, users with the job description web producers, which is to say people who can do HTML and a bit of scripting, but who do not get access to the file system. Kind of like the Zope 2 model. We even use acquisition. Also, it seemed to me unwieldy to put 50 directories in the filesystem to contain the templates for all the sites. But because of my experience with Zope 2, I assumed TTW was the best way to customize the application for each site, and I guess I should re-examine that assumption. It seems like this is a common pattern for content management applications. Maybe, I don't know. Repeating my own posting from 10/9, here's how I made an adapter to use a file system view with a ZMI template: Again, we do not support TTW development. If you do such experiments that's great, but you cannot expect much help. Well, my project is _mostly_ filesystem, and only _partly_ TTW. But OK, I won't expect much help. Regards, Stephan Thanks Wade ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Validation of schemas?
On 10/31/05, Stephan Richter [EMAIL PROTECTED] wrote: On Sunday 30 October 2005 04:45, Adam Summers wrote: How do I implement a validation rule that says either email or phone have to exist, but not necissarily both. You do that using invariants. Look at zope.interface/README.txt for details. Just added this to FAQ (http://zissue.berlios.de/z3/z3faq.html). I expects more contribution in coming months. How to validate two or more fields simultaneously? ~~ Use `invariants` to control more fields. Look at zope.interface/README.txt for details. Let's consider this more specific question asked to list: How do I implement a validation rule that says either email or phone have to exist, but not necissarily both. Using the buddy demo as an example, with the following interface:: class IBuddy(zope.interface.Interface): Provides access to basic buddy information fullname = TextLine(title=_(Name)) email = TextLine(title=_(Email Address)) phone = TextLine(title=_(Phone Contact)) First we have to make a callable object, either a simple function or callable instance of a class:: def contacts_invariant(obj): if not (obj.email or obj.phone): raise Exception(At least one contact info is rquired) Now use `validateInvariants` method of the interface to validate:: buddy = Buddy() buddy.email = u[EMAIL PROTECTED] IBuddy.validateInvariants(buddy) Regards, Baiju M ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] MessageBoard tutorial deprecation warnings
The messageboard tutorial in the Zope 3 Developer's Handbook doesn't seem to work for me. I'm using the copy from svn co svn://svn.zope.org/repos/main/book/trunk The SVN url listed in the book didn't work, but I'm not sure this is the right one. Anyway, I'm using the step13 folder, and when I registered it with my Zope 3.1 instance on Ubuntu, and run Zope, I get the following in my transcript.log: ConfigurationError: ('Invalid value for', 'interface', Couldn't import zope.app.workflow.interfaces, No module named workflow.interfaces in zope.app.workflow.interfaces.IProcessInstanceContainerAdaptable) I wanted to see more detail on that error, so I imported the offending module at the Python interactive prompt. Along the way several deprecation warnings cropped up (see below). Is there a newer version of this tutorial I'm missing out on, or should I spend some time trying to clean this up? Thanks! [EMAIL PROTECTED]:/var/lib/zope3/instance/sandbox/lib/python$ python Python 2.4.2 (#2, Sep 30 2005, 21:19:01) [GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on linux2 Type help, copyright, credits or license for more information. import book.messageboard.browser.messageboard book/messageboard/browser/messageboard.py:22: DeprecationWarning: ActiveStatus: ActiveStatus is now available in zope.app.component.interfaces.registration. Will be gone in X3.3. from zope.app.registration.interfaces import ActiveStatus book/messageboard/browser/messageboard.py:23: DeprecationWarning: ISite: This interface has been moved to zope.app.component.interfaces. The reference will be gone in X3.3. from zope.app.site.interfaces import ISite book/messageboard/browser/messageboard.py:24: DeprecationWarning: SiteManager: This class has been moved to zope.app.component.site. The reference will be gone in X3.3. from zope.app.site.service import SiteManager, ServiceRegistration book/messageboard/browser/messageboard.py:24: DeprecationWarning: ServiceRegistration: The concept of services has been removed. Use utilities instead. The reference will be gone in X3.3. from zope.app.site.service import SiteManager, ServiceRegistration book/messageboard/browser/messageboard.py:25: DeprecationWarning: LocalUtilityService: Services have been removed. Use site manager API. The reference will be gone in X3.3. from zope.app.utility.utility import LocalUtilityService, UtilityRegistration book/messageboard/browser/messageboard.py:25: DeprecationWarning: UtilityRegistration: This class has been moved to zope.app.component.site. The reference will be gone in X3.3. from zope.app.utility.utility import LocalUtilityService, UtilityRegistration Traceback (most recent call last): File stdin, line 1, in ? File book/messageboard/browser/messageboard.py, line 26, in ? from zope.app.workflow.interfaces import IProcessDefinitionImportHandler ImportError: No module named workflow.interfaces ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] View with template
Frank Burkhardt wrote: Hi, a short introduction first: I'm Frank Burkhardt, working at the Max Planck Institute in Germany. My employer wants a new website to replace the old one (www.cbs.mpg.de - yes, it looks really really ugly). We chose Zope3 to implement it. Maybe there will be one or two questions on the way which is the reason why I joined this list :-) . Here is the first one: I assigned a view to my brandnew content class: browser:page for=.test.ITest name=index.html permission=zope.Public class=.test.TestView template=view.pt / This is what I think this xml-statement should do: When http://zope/test/index.html is called, the template view.pt is evaluated which has access to the View-class TestView. view.pt: html metal:use-macro=context/@@standard_macros/view div metal:fill-slot=body div tal:replace=view/div /div /html But whenever I define TestView.__call__ the template is not evaluated but the result of TestView.__call__ is returned directly. How can Zope be forced to use the template instead of __call__ing the TestView-Object? If you use the the browser:form, browser:edit and/or browser:add directive your TestView will be mixed in automatically during the setup. In your example you are going to overwrite the __call__ method of the mixed-in base class which is invoking the template. If you like to overwrite the __call__ method, you have to call you base class too: class TestView(object): def __call__(self): # do something else return super(TestView, self).__call__() Regards, Dominik begin:vcard fn:Dominik Huber n:Huber;Dominik email;internet:[EMAIL PROTECTED] tel;work:++41 56 534 77 30 x-mozilla-html:FALSE version:2.1 end:vcard ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users