[Zope3-Users] overriding single resources from resourcedirectories
Hi, is it possible to override single resources from a previously defined resourcedirectory? I have let's say a 3rd party product defining ... resourceDirectory name=mycss directory=resources permission=zope.Public / ... Now I need to override a single css-file provided by the resource-directory. What would the directive be? overrides.zcml: ... resource name=mycss/single.css file=single.css permission=zope.Public / ... I tried that, but without success. Is there a solution beside of copying the whole directory to my new product? Thanks, -Tom ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] imports cleanup
Hi Christophe, you may want to take a look at pylint. www.logilab.org/project/name/pylint It is a coding standard checker, finding unused imports as well but does much more. Cheers -Tom Christophe Combelles wrote: Hello, As I'm experimenting with various components, I'm adding more and more imports in the beginning of the python files, but at the end, most of them are unused. Is there a tool or a method to automatically clean or detect unused imports ? regards, Christophe ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Zope 3 and menus
Hi there, I override BrowserMenu from zope.app.publisher.browser.menu and add a entry 'abs_action' to the resulting dictionary. Something like: class MyBrowserMenu(BrowserMenu): def modify(self, menu, request): siteurl = absoluteURL(hooks.getSite(), request) for item in menu: item['abs_action'] = siteurl + '/' + item['action'] submenu = item.get('submenu', None) if submenu is not None: self.modify(submenu, request) def getMenuItems(self, obj, request): menu = super(MyBrowserMenu, self).getMenuItems(obj, request) self.modify(menu, request) return menu browser:menu id=monitor_menu title=menu description here class=.MyBrowserMenu / div id=monitor_menu class=box ul li tal:repeat=item context/@@view_get_menu/monitor_menu a href= tal:attributes=href item/abs_action; title item/description tal:content=item/title/a /li /ul /div Cheers -Tom eXt wrote: Hi I've got a problem with menus. I'd like to define a global menu, and then add some options to it depending on actual context (view registered for specific interface). The problem is that when I define global menu element link like: action=/index.html it generates url which omits my folder structure which shold be: root/my_site/index.html and creates: root/index.html. On the other side when i use: action=index.html the url which is created is always relative. I'd like to be able to define my_site (which is in fact a Site object) to be root for actions. What is the correct solution for that? Should I edit global urls before displaying them (add my_site part)? Look at third code snippet below - it generates urls so I can easly change some strings. Is this a proper solution? My code: Menu definition: browser:menu id=monitor_menu title=menu description here / Global menu action (snippet from worldcookery.com code): browser:menuItem for=* menu=monitor_menu title=Start action=/index.html permission=zope.View / Context dependent action: browser:page name=edit.html for=..interfaces.IMonitorConfDB class=.monitor_conf_db_view.MonitorConfDBEditForm permission=zope.View menu=monitor_menu title=Edit config / I display menu using viewlet with template (iirc code from worldcookery book): div id=monitor_menu class=box ul li tal:repeat=item context/@@view_get_menu/monitor_menu a href= tal:attributes=href item/action; title item/description tal:content=item/title/a /li /ul /div ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] objectwidget help
Hi Ivan, the demos are all together quite outdated. In your case there's a wrong url provided in the index-template it should be: a href=/@@contents.html?type_name=BrowserAdd__zope3demos.otherdemos.formlib2.demo.OrderCreate Formlib2 Demo Object/a instead of a href=/@@contents.html?type_name=BrowserAdd__zope3demos.formlib2.demo.OrderCreate Formlib2 Demo Object/a You can create the object via the 'Add:'-Navigation. Choose 'Formlib Demo Object' there. -Tom Ivan Horvath wrote: Hi Tom, yes, but i made another checkout to another folder, renamed the previous one. it is the same on the index page http://localhost:8080/@@z3d.index.html i have the following contents (below) and e.g. Create Formlib2 Demo Object http://localhost:8080/@@contents.html?type_name=BrowserAdd__zope3demos.formlib2.demo.Order link doesn't work, after entering a name to create new object gives ComponentLookupError: (InterfaceClass zope.component.interfaces.IFactory, u'Br owserAdd__zope3demos.formlib2.demo.Order') exception -- index start -- Viewlet/Contentprovider Examples * Viewlet 1 http://localhost:8080/@@z3d.demo1.index.html * Viewlet 2 http://localhost:8080/@@z3d.demo2.index.html Add content to root folder for next two demos. * Viewlet 3 http://localhost:8080/@@z3d.demo3.index.html * Viewlet 4 http://localhost:8080/@@z3d.demo4.index.html * Contentprovider 1 http://localhost:8080/@@cpdemo1.html Masterpage Examples An exploration of alternatives to macros using viewlets and content providers * Masterpages without macros 1 http://localhost:8080/@@z3d.mpdemo1.index.html * Juergen Masterpages without macros 2 http://localhost:8080/@@z3d.mpdemo2.index.html * Jurgen Masterpages stripped down o @@z3d.mpdemo3.page1.html http://localhost:8080/@@z3d.mpdemo3.page1.html o @@z3d.mpdemo3.page2.html http://localhost:8080/@@z3d.mpdemo3.page2.html * Masterpages demo4 http://localhost:8080/@@z3d.mpdemo4.index.html based on this blog posting http://blogs.lovelysystems.com/srichter/2006/09/20/the-skin-browser-and-lovely-systems-new-development-workflow/ by Stephan Richter see also viewtemplate example. Viewtemplate Example z3c.viewtemplate seperates the zpt template from the view class. * ++skin++MySkin/@@viewtemplate1.html http://localhost:8080/++skin++MySkin/@@viewtemplate1.html * ++skin++MySkin2/@@viewtemplate1.html http://localhost:8080/++skin++MySkin2/@@viewtemplate1.html Formlib Demo * /@@z3d.formlib1.page1.html http://localhost:8080/@@z3d.formlib1.page1.html * /@@z3d.formlib1.page1-length.html http://localhost:8080/@@z3d.formlib1.page1-length.html * /@@z3d.formlib1.page1-name.html http://localhost:8080/@@z3d.formlib1.page1-name.html * /@@z3d.formlib1.page2.html http://localhost:8080/@@z3d.formlib1.page2.html * /@@z3d.formlib1.page3.html http://localhost:8080/@@z3d.formlib1.page3.html * Formlib2 Demo o Create Formlib2 Demo Object http://localhost:8080/@@contents.html?type_name=BrowserAdd__zope3demos.formlib2.demo.Order o Visit the new object o Edit the new object -- index end -- Tom Gross wrote: Hi Ivan, did you get the code from the repository? It's: svn checkout http://zope3demos.googlecode.com/svn/trunk/ zope3demos Cheers -Tom Ivan Horvath wrote: thank you Tom! i downloaded, but unfortunately i cannot see it in my browser. what is the url for the otherdemos objectsofobject2 package? Tom Gross wrote: Hi Ivan, I might be wrong, but I think there's an example for listwidgets containing objects in the zope3demos-package: http://code.google.com/p/zope3demos/ Maybe it helps. Cheers -Tom Ivan Horvath wrote: Dear All, in my implementation there is an object. one of this object properties is a List. containing other objects. the class which inherits ObjectWidget receives always the same context, actually that object which contains the object property. class MyDispFieldsWidgetDisplay(ObjectWidget): i cannot find the way how to tell to MyDispFieldsWidgetDisplay object which element should read from the List object property this is my viewclass: class DKRviewReportView(myBrowserView): - myBrowserView is almost the same as the zope BrowserView class fields_widget = CustomWidgetFactory(SequenceDisplayTableWidget, subwidget=MyDispFieldsWidgetDisplay) -- Best Regards, Iván Horváth Chief Programmer Alcatel NSD PMS 2000 Product Team H-1116, Budapest Kondorfa u. 10. Tel.: +36 1 209 9546 Fax.: +36 1 209 9599 Mobil: +36 30 257 0235 E-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Check my Web Page http://www.freeweb.hu/pillesoft /Anyone who has never made a mistake has never tried anything new./ / /Albert Einstein/ / -- Best Regards, Iván
Re: [Zope3-Users] objectwidget help
Hi Ivan, I might be wrong, but I think there's an example for listwidgets containing objects in the zope3demos-package: http://code.google.com/p/zope3demos/ Maybe it helps. Cheers -Tom Ivan Horvath wrote: Dear All, in my implementation there is an object. one of this object properties is a List. containing other objects. the class which inherits ObjectWidget receives always the same context, actually that object which contains the object property. class MyDispFieldsWidgetDisplay(ObjectWidget): i cannot find the way how to tell to MyDispFieldsWidgetDisplay object which element should read from the List object property this is my viewclass: class DKRviewReportView(myBrowserView): - myBrowserView is almost the same as the zope BrowserView class fields_widget = CustomWidgetFactory(SequenceDisplayTableWidget, subwidget=MyDispFieldsWidgetDisplay) ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] objectwidget help
Hi Ivan, did you get the code from the repository? It's: svn checkout http://zope3demos.googlecode.com/svn/trunk/ zope3demos Cheers -Tom Ivan Horvath wrote: thank you Tom! i downloaded, but unfortunately i cannot see it in my browser. what is the url for the otherdemos objectsofobject2 package? Tom Gross wrote: Hi Ivan, I might be wrong, but I think there's an example for listwidgets containing objects in the zope3demos-package: http://code.google.com/p/zope3demos/ Maybe it helps. Cheers -Tom Ivan Horvath wrote: Dear All, in my implementation there is an object. one of this object properties is a List. containing other objects. the class which inherits ObjectWidget receives always the same context, actually that object which contains the object property. class MyDispFieldsWidgetDisplay(ObjectWidget): i cannot find the way how to tell to MyDispFieldsWidgetDisplay object which element should read from the List object property this is my viewclass: class DKRviewReportView(myBrowserView): - myBrowserView is almost the same as the zope BrowserView class fields_widget = CustomWidgetFactory(SequenceDisplayTableWidget, subwidget=MyDispFieldsWidgetDisplay) -- Best Regards, Iván Horváth Chief Programmer Alcatel NSD PMS 2000 Product Team H-1116, Budapest Kondorfa u. 10. Tel.: +36 1 209 9546 Fax.: +36 1 209 9599 Mobil: +36 30 257 0235 E-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Check my Web Page http://www.freeweb.hu/pillesoft /Anyone who has never made a mistake has never tried anything new./ / /Albert Einstein/ / ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Customized NotFound-Page
Hi, I created a customized 'NotFound'-Page which displays fine itself. Now the page should render in a skin with some security sensitive viewlets. These viewlets disappear when rendering the 'NotFound'-Page. Is there a known solution to the problem? Thanks, Tom ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Registered utility is never found
Hi Frank, is your InitIndicator-instance implementing the IInitIndicatorFB-interface. This is absolutely necessary for providing it as an utility. There's an easy test for this: from zope.interface.verify import verifyObject ii = InitIndicator() verifyObject(IInitIndicatorFB, ii) True I usually put this in the docstring of classes I want to use as utilities. Just to make sure :-). -Tom wrote: Hi, On Tue, Dec 12, 2006 at 07:56:53AM +1100, Tom Dossis wrote: FB wrote: Hi, is there any reason why a registered utility which is persistently stored inside the site manager is never found via zapi.getUtility(IMyInterface) ? More information: I wrote a package ( fb ) containing some components making the developer's life easier. The package provides a class fb.init.indicator.InitIndicator. A application depending on the fb package is supposed to make an instance of the InitIndicator, put it into the site manager and register it. As soon as the InitIndicator exists, the annoying This site is not initialized, yet-message provided by the fb package's skin (which just checks if zapi.getUtility(IInitIndicator) is not None) disappears. But: It *doesn't work* and a don't have the slightest clue why. This is, what my application's initialisation routine does: def initApplication(root): sm=getSiteManager() df=sm['default'] initindicator=InitIndicator('mpgsite','http://zope3.mpg.de/topic/MpgSite',uno info) df['initindicator']=initindicator sm.registerUtility(df['initindicator'],IInitIndicator,'','') [...] test=zapi.getUtility(IInitIndicator) # Works! [...] Querying the IInitIndicator component works directly after the registration but *nowhere* else in my application. Have you 'browsed' the utility via the ZMI 'Manage Site'? Is there an instance there (in the site you expect it to be)? If so the 'Registration' page could provide some useful info. Yes. The instance is there, the registration tab shows the registration as expected, the site root folder itself lists the registration in site.registrations lists the registration as expected. Registering via browser doesn't work either :-( . BTW: I've got dozens of other utilities registered that are working perfectly. Frank ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Registered utility is never found
Hi Frank, you are trying to lookup the utility with the name None. If you don't specify a name when registering the utility, omit the second parameter: zapi.getUtility(IInitIndicator) Cheers -Tom FB wrote: On Tue, Dec 12, 2006 at 05:29:55PM +0300, Garanin Michael wrote: FB wrote: On Tue, Dec 12, 2006 at 04:42:56PM +0300, Garanin Michael wrote: traceback, please. Hmm ... how? It just doesn't return the utility as expected (it returns None). There is no error shown in any way. from APIDOC: * *|getUtility(interface, name='', context=None)| * . If one is not found, raises ComponentLookupError. must be EXCEPTION !!! There are not ComponenLookupError exception? Why you find bug in getUtility? ;-) Sorry - my fault :-) I'm using queryUtility all the time. Here's the traceback: File /var/lib/zope3/instance/lib/python/fb/init/tales.py, line 29, in warn indicator=zapi.getUtility(IInitIndicator,None) File /ZOPE/zope3/src/zope/component/_api.py, line 207, in getUtility raise ComponentLookupError(interface, name) ComponentLookupError: (InterfaceClass fb.init.interfaces.IInitIndicator, None) Regards, Frank ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Custom Content Container
Hi David, I found another workaround. I defined a dummy Widget for the abstract Field-field. Something like this: from zope.app.form.browser.widget import SimpleInputWidget class DummyWidget(SimpleInputWidget): def __call__(self): pass and additional in zcml: view type=zope.publisher.interfaces.browser.IBrowserRequest for=zope.schema.interfaces.IField provides=zope.app.form.interfaces.IInputWidget factory=.DummyWidget permission=zope.Public / Although it's a workaround it looks a bit nicer in the code :). You can use container constraints the intended way. Cheers -Tom David Johnson wrote: I figured out the problem. In my interfaces I was using the contains and containers methods. When I stuck to the more tedious __parent__ = ... approach as outlined in Stephan's book, all was solved. Thanks. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Johnson Sent: Tuesday, November 28, 2006 2:21 PM To: 'Tom Gross' Cc: zope3-users@zope.org Subject: RE: [Zope3-Users] Custom Content Container Yes indeed. I'm only using 1 Text and 3 TextLine fields. This is my first attempt at this so I'm trying to keep it fairly simple. -Original Message- From: Tom Gross [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 28, 2006 2:05 PM To: David Johnson Cc: zope3-users@zope.org Subject: Re: [Zope3-Users] Custom Content Container Hi David, which fields does your IOwner-interface consist of? You get this error if you call an auto generated form from a List-field, without having value_type specified, but there are other scenarios, so this information would be helpful. Cheers -Tom David Johnson wrote: I created a custom content container that reads entries from a MySQL database and allows editing of the container objects. Or at least that is my desire... The content container by itself seems to work well. However when I click on an object in the contents ZMI view, I receive the following exception: ComponentLookupError: ((zope.schema._bootstrapfields.Field object at 0x420f450c, zope.publisher.browser.BrowserRequest instance URL=http://192.168.81.89:8070/++etc++site/default/TPM%20on%20Dev/4/@@editT PMOwner.html), InterfaceClass zope.app.form.interfaces.IInputWidget, u'') I'm not quite sure why IInputWidget is being looked up, though I suppose it has something to do with the form I am creating, and I'm not sure why it is not finding what it is looking for. editTPMOwner.html is simply a browser:editform ZCML directive that uses schema IOwner. Any ideas or thoughts? Thanks so kindly in advance. -- David Johnson -- -- ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Custom Content Container
Hi David, which fields does your IOwner-interface consist of? You get this error if you call an auto generated form from a List-field, without having value_type specified, but there are other scenarios, so this information would be helpful. Cheers -Tom David Johnson wrote: I created a custom content container that reads entries from a MySQL database and allows editing of the container objects. Or at least that is my desire... The content container by itself “seems” to work well. However when I click on an object in the contents ZMI view, I receive the following exception: ComponentLookupError: ((zope.schema._bootstrapfields.Field object at 0x420f450c, zope.publisher.browser.BrowserRequest instance URL=http://192.168.81.89:8070/++etc++site/default/TPM%20on%20Dev/4/@@editTPMOwner.html), InterfaceClass zope.app.form.interfaces.IInputWidget, u'') I’m not quite sure why “IInputWidget” is being looked up, though I suppose it has something to do with the form I am creating, and I’m not sure why it is not finding what it is looking for. editTPMOwner.html is simply a browser:editform ZCML directive that uses schema IOwner. Any ideas or thoughts? Thanks so kindly in advance. -- David Johnson ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] how to know which port zope is runnning on?
Hi Shailesh, try request.get('SERVER_PORT'). Cheers -Tom Shailesh Kumar wrote: Hi, Is it possible for the application code to figure out the port number on which zope is running? What is the suitable api for that? With regards, -shailesh ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] question about MailDir folder for queuedDelivery on windows
Hi Shailesh, just make sure there are three subdirectories available in the directory of your mailqueue: cur, tmp, new. This is the common maildir format. see: man 5 maildir *THE* *MAILDIR* *STRUCTURE* A directory in /maildir/ format has three subdirectories, all on the same filesystem: *tmp*, *new*, and *cur*. Each file in *new* is a newly delivered mail message. The modification time of the file is the delivery date of the message. The message is delivered /without/ an extra UUCP- style *From_* line, /without/ any *From* quoting, and /without/ an extra blank line at the end. The message is normally in RFC 822 format, starting with a *Return-Path* line and a *Delivered-To* line, but it could contain arbitrary binary data. It might not even end with a newline. Files in *cur* are just like files in *new*. The big difference is that files in *cur* are no longer new mail: they have been seen by the user's mail-reading program. Cheers -Tom Shailesh Kumar wrote: Hi, I am trying to use mail:queuedDelivery. It says that the /...\lib\python\baton\mail_queue is not a Maildir folder/ I am using Zope on Windows-XP box. How can I setup a Maildir folder? With regards, -shailesh ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] how to access the root folder in normal operation
Hi Shailesh, take a look at zope.app.appsetup. You could subscribe to the DatabaseOpenedWithRoot-event. Cheers -Tom Shailesh Kumar wrote: Hi, zope.traversing.api.getRoot returns the root of a given object. What I wanted to do was that when zope starts, I would like to create a few content objects inside the root folder. Something like: root = getRootFolder() #using some way I don't know. root['etc'] = Folder() root['var'] = Folder() ... Is it possible to do that? With regards, -shailesh On 11/15/06, *Tom Gross* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi Shailesh, have a look at zope.traversing.api. There's a getRoot-method. Cheers -Tom Shailesh Kumar wrote: Hi, In a functional test setup, one can access the root folder using getRootFolder() of FunctionalTestSetup. How can I access the root folder in a nomal operation mode? Is there some mechanism to do that? Thank you very much. With regards, -shailesh ___ Zope3-users mailing list Zope3-users@zope.org mailto:Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] how to access the root folder in normal operation
Hi Shailesh, have a look at zope.traversing.api. There's a getRoot-method. Cheers -Tom Shailesh Kumar wrote: Hi, In a functional test setup, one can access the root folder using getRootFolder() of FunctionalTestSetup. How can I access the root folder in a nomal operation mode? Is there some mechanism to do that? Thank you very much. With regards, -shailesh ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users