[Zope] Five EditFrom and Fields appears broken
Does anyone successfully use zope.formlib.form Fields with Products.Five.formlib.formbase EditForm? I was trying to figure out why my form_fields.omit and custom_widget were being ignored. I followed it up the stack and found the method setUpEditWidgets in zope.app.form.utility never takes Fields into account and just looks at the schema and context to determine the fields. So I was starting to think maybe you don't use Fields with Five forms, but there is a unit test in Products.Five.formlib.tests view.py that actually thinks its using Fields. I don't think this is actually the case though, the test just doesn't touch omit or custom_widget functionality so it passes thinking Fields is working. The /Products/Five/form/__init__.py imports zope.app.form.utility setUpEditWidgets. zope.formlib has a different setUpEditWidgets method in zope/formlib/form.py that actually takes form_fields as the 1st param. So in summary, if you think your using Fields in Five try using omit or custom_widget and see if it works and you actually are really using Fields. If it works maybe I have something messed up on my end. TIA - Jim ___ Zope maillist - Zope@zope.org https://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Five and editform
Hi Mark Gibson, Do you develop this with egg ? throw Products namespace ? The zcml seems good. If you develop outside of the Products namespace don't forget to include your package in the site.zcml. You can verify this by making a mistake in the zcml and try to start zope. Does you content implements boring.interfaces.IBoring ? -- JeanMichel FRANCOIS Makina Corpus Le Friday 17 October 2008 05:51:34 Mark Gibson, vous avez écrit : I created a simple content type. I can create an object, but I can't call my view or edit form on it. If I try object/boring_editform or object/index.html I get a Not Found error. Here's what I have in my configure.zcml: --- browser:editform schema=boring.interfaces.IBoring for=boring.interfaces.IBoring name=boring_editform label=Edit Boring Folder permission=boring.ManageBoring / browser:page for=boring.interfaces.IBoring name=index.html template=view.pt permission=zope2.View menu=zmi_views title=View /browser:page --- What am I missing? Thanks, Mark ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Five and editform
Hi JeanMichel, thanks for our reply. This is not an egg - just a simple product I have in instance_home/lib/python. I'm working with Zope 2.9.7, not a buildout environment. I get the Boring product in the Add dropdown, and I can create the object. I do have the product included in site.zcml, and it does implement the IBoring interface. Any other ideas? I read somewhere that I have to include this: five:traversable class=.boring.Boring / And read somewhere else that five:traversable is deprecated. In any case, including or not including this makes no difference. Thanks, Mark JeanMichel FRANCOIS wrote: Hi Mark Gibson, Do you develop this with egg ? throw Products namespace ? The zcml seems good. If you develop outside of the Products namespace don't forget to include your package in the site.zcml. You can verify this by making a mistake in the zcml and try to start zope. Does you content implements boring.interfaces.IBoring ? -- JeanMichel FRANCOIS Makina Corpus Le Friday 17 October 2008 05:51:34 Mark Gibson, vous avez écrit : I created a simple content type. I can create an object, but I can't call my view or edit form on it. If I try object/boring_editform or object/index.html I get a Not Found error. Here's what I have in my configure.zcml: --- browser:editform schema=boring.interfaces.IBoring for=boring.interfaces.IBoring name=boring_editform label=Edit Boring Folder permission=boring.ManageBoring / browser:page for=boring.interfaces.IBoring name=index.html template=view.pt permission=zope2.View menu=zmi_views title=View /browser:page --- What am I missing? Thanks, Mark ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Five pointers
I'm developing a new product for a Zope 2.9.7 site (no CMF). I'd like to use Zope 3 technologies for this product. I've been looking around for a few days, most of what I see describes development for Zope 3, or Five in the context of Plone. Is there a tutorial or a product I can reference that describes how to build a few simple content types the Zope 3 way in Zope 2? ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Five and editform
I created a simple content type. I can create an object, but I can't call my view or edit form on it. If I try object/boring_editform or object/index.html I get a Not Found error. Here's what I have in my configure.zcml: --- browser:editform schema=boring.interfaces.IBoring for=boring.interfaces.IBoring name=boring_editform label=Edit Boring Folder permission=boring.ManageBoring / browser:page for=boring.interfaces.IBoring name=index.html template=view.pt permission=zope2.View menu=zmi_views title=View /browser:page --- What am I missing? Thanks, Mark ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Five events and webdav
Hi All, What event should I subscribe to in order to recatalog all of a folder's contents should that folder be renamed via webdav? (I guess I'd need to uncatalog from old path and then re-catalog from new path?) cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Five Point Capital, Searching for the Right Keywords through Staff Leasing Companies
Five Point Capital, Searching for the Right Keywords through Staff Leasing Companies A growing number of websites compete to be among the top ten listings in the search results. This position gives them a higher possibility of getting more customers compared with a lower rank. Web marketers use several tools to achieve high rankings, probably one of the most important although others don?t realize, is keyword research. There are many tactics for optimizing a site to have high search rankings. But since most visits to a site start with a search engine click, optimizing a site for the right keywords is really critical. This is why keyword research is so important, right? It is really important that you will be able to target all relevant keyword phrases to be able to be among the top rank websites. You just can?t afford to guess the keywords often searched by people, or else you?ll see your businesses slowly toppling down. Searching for the right keywords for your websites doesn?t simply take a day or two. It would sometimes take a week or more. If this is so, how can busy people maintain or increase the ranks of their websites. Yeah, maybe it can be done, but how sure that it is done systematically and professionally? Hiring a new employee to do this can also be costly for a company especially if it is just starting. Some resort to webmaster staffing? Getting someone from a webmaster staffing company to do professional keyword research and other services can do no harm to your business; it is to your advantage, in fact. The company wouldn?t have to provide office space for the staff as they will be working in their own place but still under your directions. Plus, you?re free from hiring and training costs. Staffs from webmaster staffing companies like Agents of Value are already well-trained and were able to pass extensive screening process to be able to provide world-class services. Opting to hire from a webmaster staffing company can lessen your overhead expenses like overtime. This companies also charge lower for their services compared to others so you will be able to save in your labor cost. Most outsourcing offices are found in places with lower cost of living. Keyword research may sound so easy but finding the right ones takes time and effort. Only people who have the time, knowledge and training can do this efficiently. If you want to get your sites on the top list, a webmaster staffing company is the best choice for you to look for someone who?ll work it for your business! Annie Rose Pantas is a webmaster working for Agents of value, an outsourcing company that offers programming, online marketing and graphic designing services. Visit these sites and ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Five 1.5.5 and menuItem - problem with 'filter' parameter
Hi, Am I doing anything wrong or filter parameter of browser:menuItem is just ignored? I have that problem in Plone but I suspect CMF ActionsTool if not Five itself. browser:menuItem for=Products.Archetypes.interfaces.IBaseObject menu=object title=synchronize action=synchronizeObject permission=cmf.ModifyPortalContent filter=string: object/whatever / I tried whatever Python Script, registered page view, etc. No success. Pawel ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] five browser:defaultView and webdav question
Hi I have an folder like object inherited from zope2 folder with some five additions (interfaces, views). Webdav support for this object works until I give it default view. I do it as follows: browser:defaultView for=.interfaces.IDocumentGroup name=view.html Then webdav support inherited from Folder breaks. How can I define this default view only for browser and not for webdav access? -- pozdrawiam Piotr Chamera ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] five zcml addview question
I am trying to create simple content type with zope 2.10.4 and five. I have performed the following: - created a content interface - created a content type class implementing the interface and extending both Persistent and SimpleItem - created zcml class entries for the content type - created zcml browser entries for 'addform' and 'editform' I am trying to get Zope to automatically create the forms based on the content schema. Once these steps were completed, I found my content type in the ZMI add menu. However, once I selected my content type, I got an error (see below). The error looks like it is missing a 'main_template' object. Any ideas what might be wrong? ERROR MESSAGE: 2007-11-07 12:31:01 ERROR Zope.SiteErrorLog http://localhost:8080/+/Password_add Traceback (innermost last): Module ZPublisher.Publish, line 119, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 42, in call_object Module Products.Five.browser.metaconfigure, line 417, in __call__ Module Shared.DC.Scripts.Bindings, line 313, in __call__ Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec Module Products.PageTemplates.PageTemplateFile, line 129, in _exec Module Products.PageTemplates.PageTemplate, line 89, in pt_render Module zope.pagetemplate.pagetemplate, line 117, in pt_render - Warning: Macro expansion failed - Warning: exceptions.KeyError: 'main_template' Module zope.tal.talinterpreter, line 271, in __call__ Module zope.tal.talinterpreter, line 346, in interpret Module zope.tal.talinterpreter, line 891, in do_useMacro Module zope.tal.talinterpreter, line 346, in interpret Module zope.tal.talinterpreter, line 536, in do_optTag_tal Module zope.tal.talinterpreter, line 521, in do_optTag Module zope.tal.talinterpreter, line 516, in no_tag Module zope.tal.talinterpreter, line 346, in interpret Module zope.tal.talinterpreter, line 870, in do_useMacro Module zope.tales.tales, line 696, in evaluate - URL: index - Line 2, Column 1 - Expression: PathExpr standard:'context/main_template/macros/master' - Names: {'container': + at /, 'context': + at /, 'default': object object at 0x0099F528, 'here': + at /, 'loop': {}, 'nothing': None, 'options': {'args': (Products.Five.metaclass.SimpleViewClass from add.pt object at 0x05D4C710,)}, 'repeat': Products.PageTemplates.Expressions.SafeMapping object at 0x05D 49D78, 'request': HTTPRequest, URL=http://localhost:8080/+/Password_add, 'root': Application at , 'template': ImplicitAcquirerWrapper object at 0x05D4CDB0, 'traverse_subpath': [], 'user': User 'admin', 'view': Products.Five.metaclass.SimpleViewClass from add.pt object at 0x 05D4C710, 'views': zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object at 0x05D4CD50} Module zope.tales.expressions, line 217, in __call__ Module Products.PageTemplates.Expressions, line 153, in _eval Module zope.tales.expressions, line 124, in _eval Module Products.PageTemplates.Expressions, line 100, in trustedBoboAwareZopeTr averse Module OFS.Traversable, line 284, in unrestrictedTraverse - __traceback_info__: ([], 'main_template') KeyError: 'main_template' ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Five: Adapter registry not working?
Hi list, I am clearly doing something wrong here. I try to use an Adapter from zope.app.session with an HTTPRequest object, but the Adapterregistry doesnt quite cooperate. Specifically, I try to adapt a HTTPRequest object to zope.app.session.interfaces.IClientId via the Adapter zope.app.session.session.ClientId A short demo: % ./zopectl debug [ ... ] Import stuff: from ZPublisher.HTTPRequest import * from StringIO import StringIO from zope.app.session.session import ClientId from zope.app.session.interfaces import IClientId from zope import component from zope.interface import * Create ourselves a faux request object: env = {'SERVER_NAME': '', 'SERVER_PORT' : ''} request = HTTPRequest(StringIO(), env, None) ClientId implements IClientId: list(implementedBy(ClientId)) [InterfaceClass zope.app.session.interfaces.IClientId] It seems ClientId is an Adapter for IRequest: component.adaptedBy(ClientId) (InterfaceClass zope.publisher.interfaces.IRequest,) request implements IBrowserRequest, which is a subclass of IRequest: list(providedBy(request)) [InterfaceClass zope.publisher.interfaces.browser.IBrowserRequest] issubclass(list(providedBy(request))[0], component.adaptedBy(ClientId) [0]) True ...so I'd expect to get ClientId as an Adapter for IClientId(request), but I dont: IClientId(request) Traceback (most recent call last): File stdin, line 1, in ? TypeError: ('Could not adapt', HTTPRequest, URL=http://:, InterfaceClass zope.app.session.interfaces.IClientId) Shouldnt this work? Obviously I am missing something here. This is on Zope 2.10.2 with the built-in Five, and Python 2.4.4 Any help greatly appreciated! - peter. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Five Documentation
Is there any documentation or howtos or example code available? I haven't spotted any.. Regards, john ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Five
Ah! I've found the site, not on zope.org at all Thx ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Five defaultView and REQUEST.URL0
Hi I've created simple view that just displays few lines of text (with national characters) and URL of the current page (which is received by call to my product method (code below)). I'm using UTF-8. I've used REQUEST.URL0 to generate url. The problem is when I'm accessing my object via it's name (I'mean when defaultView is used) like: http://localhost:8080/my_problem_object I get: 'ascii' codec can't decode byte 0xc4 in position 154: ordinal not in range(128) Suprisingly to me when I'm using: http://localhost:8080/my_problem_object/@@test_uni everything works correclty. Without national characters in Page Template it works OK. When I'm not using self.REQUEST.URL0 it works correctly too. When I use str(self.REQUEST.URL0) everything is good again. Can somebody tell me whether I'm doing something in a wrong way, or maybe it is a bug or feature? I dont understand why there is such a difference between view and default view? Below is a part of my code: ---main class--- class GeneralModule(Folder): GeneralModule (...) def get_obj_url(self): return self.REQUEST.URL0 (...) ---view is--- html xmlns=http://www.w3.org/1999/xhtml; lang=pl xml:lang=pl body h1 Some unicode characters here: łąka/h1 span tal:content=python: context.get_obj_url()/span /body /html ---configure.zcml:--- five:traversable class=.GeneralModule.GeneralModule / five:defaultViewable class=.GeneralModule.GeneralModule / browser:page for=.GeneralModule.IGeneralModule template=./zpt/test_uni.zpt name=test_uni permission=zope.Public / browser:defaultView for=.GeneralModule.IGeneralModule name=test_uni / ... -- Maciej Wisniowski ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] five i18n
does the zope/five/i18n machinery tell anything about it's startup phase (finding message catalogs etc.) in the logs or while watching runzope output? i don't see anything here, and still didn't get it to work. - what are the preconditions to get it working? i use plain zope page templates (no cmf/plone or cps)... - how can i set the target language for the translation in the zpt? - my configure.zcml: configure xmlns=http://namespaces.zope.org/zope; xmlns:i18n=http://namespaces.zope.org/i18n; i18n:registerTranslations directory=locales / /configure (must get parsed, because zope doesnt start up if i put some crap in :) - my subdir layout under the product dir for message catalogs: ./locales/ ./locales/de/LC_MESSAGES/blisspro.po ./locales/en/LC_MESSAGES/blisspro.po - do i have to compile the .pos to .mos by hand? or is it done automatically like PTS did? must be missing something... thanks in advance for your answers! regards, juergen On Tue, January 17, 2006 17:45, Lennart Regebro wrote: On 1/17/06, Jürgen Herrmann [EMAIL PROTECTED] wrote: hi all! does anybody have a five product that uses i18n that i can have a look at? i don't seem to get it right... Yeah, the CalZope trunk does it: http://svn.nuxeo.org/trac/pub/browser/CalZope/trunk/ -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ XLhost.de - eXperts in Linux hosting Jürgen Herrmann Bruderwöhrdstraße 15b, DE-93051 Regensburg Fon: +49 (0)700 XLHOSTDE [0700 95467833] Fax: +49 (0)721 151 463027 WEB: http://www.XLhost.de ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] five i18n
On 1/18/06, Jürgen Herrmann [EMAIL PROTECTED] wrote: does the zope/five/i18n machinery tell anything about it's startup phase (finding message catalogs etc.) in the logs or while watching runzope output? Nope. It would probably be good if the registerTranslations statement printed logs of what it found. - how can i set the target language for the translation in the zpt? That's tricky! :) You need either Localizer or the plone tool for that now, I think. But it's mentioned in the documentation. By default it just picks the language from the list of languages in your browser, I think? - do i have to compile the .pos to .mos by hand? Yes. -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] five i18n
On Wed, January 18, 2006 14:28, Lennart Regebro wrote: On 1/18/06, Jürgen Herrmann [EMAIL PROTECTED] wrote: does the zope/five/i18n machinery tell anything about it's startup phase (finding message catalogs etc.) in the logs or while watching runzope output? Nope. It would probably be good if the registerTranslations statement printed logs of what it found. - how can i set the target language for the translation in the zpt? That's tricky! :) You need either Localizer or the plone tool for that now, I think. But it's mentioned in the documentation. By default it just picks the language from the list of languages in your browser, I think? ok, first one. will investigate that. - do i have to compile the .pos to .mos by hand? Yes. second one. i'll report back :) -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ XLhost.de - eXperts in Linux hosting Jürgen Herrmann Bruderwöhrdstraße 15b, DE-93051 Regensburg Fon: +49 (0)700 XLHOSTDE [0700 95467833] Fax: +49 (0)721 151 463027 WEB: http://www.XLhost.de ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] five i18n
just tried this: hacked in a MyLanguages in five's i18n.py: class MyLanguages(object): fake implements(IUserPreferredLanguages) def __init__(self, context): self.context = context def getPreferredLanguages(self): return ('DE') and in my overrides.zcml added: adapter for=zope.publisher.interfaces.http.IHTTPRequest provides=zope.i18n.interfaces.IUserPreferredLanguages factory=Products.Five.i18n.MyLanguages / 1. is the return value correct? i.e. is a tuple ok? should it be ('DE') or ('de') - tried both to no avail :( 2. does the translation also work with page template files? regards, juergen On Wed, January 18, 2006 14:28, Lennart Regebro wrote: On 1/18/06, Jürgen Herrmann [EMAIL PROTECTED] wrote: does the zope/five/i18n machinery tell anything about it's startup phase (finding message catalogs etc.) in the logs or while watching runzope output? Nope. It would probably be good if the registerTranslations statement printed logs of what it found. - how can i set the target language for the translation in the zpt? That's tricky! :) You need either Localizer or the plone tool for that now, I think. But it's mentioned in the documentation. By default it just picks the language from the list of languages in your browser, I think? - do i have to compile the .pos to .mos by hand? Yes. -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ XLhost.de - eXperts in Linux hosting Jürgen Herrmann Bruderwöhrdstraße 15b, DE-93051 Regensburg Fon: +49 (0)700 XLHOSTDE [0700 95467833] Fax: +49 (0)721 151 463027 WEB: http://www.XLhost.de ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] five i18n (addendum)
i added a print statement in registerTranslations() and it shows me that it finds my message catalogs. On Wed, January 18, 2006 15:27, Jürgen Herrmann wrote: just tried this: hacked in a MyLanguages in five's i18n.py: class MyLanguages(object): fake implements(IUserPreferredLanguages) def __init__(self, context): self.context = context def getPreferredLanguages(self): return ('DE') and in my overrides.zcml added: adapter for=zope.publisher.interfaces.http.IHTTPRequest provides=zope.i18n.interfaces.IUserPreferredLanguages factory=Products.Five.i18n.MyLanguages / 1. is the return value correct? i.e. is a tuple ok? should it be ('DE') or ('de') - tried both to no avail :( 2. does the translation also work with page template files? regards, juergen On Wed, January 18, 2006 14:28, Lennart Regebro wrote: On 1/18/06, Jürgen Herrmann [EMAIL PROTECTED] wrote: does the zope/five/i18n machinery tell anything about it's startup phase (finding message catalogs etc.) in the logs or while watching runzope output? Nope. It would probably be good if the registerTranslations statement printed logs of what it found. - how can i set the target language for the translation in the zpt? That's tricky! :) You need either Localizer or the plone tool for that now, I think. But it's mentioned in the documentation. By default it just picks the language from the list of languages in your browser, I think? - do i have to compile the .pos to .mos by hand? Yes. -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ XLhost.de - eXperts in Linux hosting Jürgen Herrmann Bruderwöhrdstraße 15b, DE-93051 Regensburg Fon: +49 (0)700 XLHOSTDE [0700 95467833] Fax: +49 (0)721 151 463027 WEB: http://www.XLhost.de ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ XLhost.de - eXperts in Linux hosting Jürgen Herrmann Bruderwöhrdstraße 15b, DE-93051 Regensburg Fon: +49 (0)700 XLHOSTDE [0700 95467833] Fax: +49 (0)721 151 463027 WEB: http://www.XLhost.de ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] five i18n
On 1/18/06, Jürgen Herrmann [EMAIL PROTECTED] wrote: 2. does the translation also work with page template files? Yes. The work either when you use i18n.translate() from python, or when you do i18n:something in ZPT. -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] five i18n
Lennart Regebro wrote: On 1/18/06, Jürgen Herrmann [EMAIL PROTECTED] wrote: - how can i set the target language for the translation in the zpt? That's tricky! :) You need either Localizer or the plone tool for that now, I think. But it's mentioned in the documentation. By default it just picks the language from the list of languages in your browser, I think? Yeah, it does. In Silva 1.5, under development, I've overridden an adapter that negotates the language to also consult a cookie ('silva_language') and this appears to work. Here's the code: from zope.publisher.browser import BrowserLanguages # new language extractor that looks in the silva_language cookie first, # then fall back on browser setting class SilvaLanguages(BrowserLanguages): def getPreferredLanguages(self): languages = super( SilvaLanguages, self).getPreferredLanguages() cookie_language = self.request.cookies.get('silva_language') if cookie_language is not None: languages = [cookie_language] + languages return languages and then some ZCML in overrides.zcml in the product: adapter for=zope.publisher.interfaces.http.IHTTPRequest provides=zope.i18n.interfaces.IUserPreferredLanguages factory=.adapters.languageprovider.SilvaLanguages / It's not perfect that this override is global now, but I guess eventually we could make it a local adapter override for the Silva site.. Regards, Martijn ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] five i18n
Jürgen Herrmann wrote: just tried this: hacked in a MyLanguages in five's i18n.py: class MyLanguages(object): fake implements(IUserPreferredLanguages) def __init__(self, context): self.context = context def getPreferredLanguages(self): return ('DE') and in my overrides.zcml added: adapter for=zope.publisher.interfaces.http.IHTTPRequest provides=zope.i18n.interfaces.IUserPreferredLanguages factory=Products.Five.i18n.MyLanguages / Oh, I see you already did what I did in the sample code above. Regards, Martijn ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] five i18n
me again :) some more things i found out: 1. MyLanguages is instantiated on every http request but regardless of what i return (['DE'] or ['de']) i always get the english translation. weird?! 2. seems that only page templates served through an http request trigger the i18n stuff at all. if so, how can i circumvent this? (i want to generate xml and run it through trml2pdf to produce pdf output, which works excellent - but not with i18n) thanks for your help. regards, juergen On Wed, January 18, 2006 15:41, Martijn Faassen wrote: Jürgen Herrmann wrote: just tried this: hacked in a MyLanguages in five's i18n.py: class MyLanguages(object): fake implements(IUserPreferredLanguages) def __init__(self, context): self.context = context def getPreferredLanguages(self): return ('DE') and in my overrides.zcml added: adapter for=zope.publisher.interfaces.http.IHTTPRequest provides=zope.i18n.interfaces.IUserPreferredLanguages factory=Products.Five.i18n.MyLanguages / Oh, I see you already did what I did in the sample code above. Regards, Martijn ___ XLhost.de - eXperts in Linux hosting Jürgen Herrmann Bruderwöhrdstraße 15b, DE-93051 Regensburg Fon: +49 (0)700 XLHOSTDE [0700 95467833] Fax: +49 (0)721 151 463027 WEB: http://www.XLhost.de ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] five i18n
hi all! does anybody have a five product that uses i18n that i can have a look at? i don't seem to get it right... thanks regards, juergen ___ XLhost.de - eXperts in Linux hosting Jürgen Herrmann Bruderwöhrdstraße 15b, DE-93051 Regensburg Fon: +49 (0)700 XLHOSTDE [0700 95467833] Fax: +49 (0)721 151 463027 WEB: http://www.XLhost.de ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] five i18n
On 1/17/06, Jürgen Herrmann [EMAIL PROTECTED] wrote: hi all! does anybody have a five product that uses i18n that i can have a look at? i don't seem to get it right... Yeah, the CalZope trunk does it: http://svn.nuxeo.org/trac/pub/browser/CalZope/trunk/ -- Lennart Regebro, Nuxeo http://www.nuxeo.com/ CPS Content Management http://www.cps-project.org/ ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] five i18n
On 1/17/06, Jürgen Herrmann [EMAIL PROTECTED] wrote: does anybody have a five product that uses i18n that i can have a look at? i don't seem to get it right... See Philipps tutorial on the subject: http://worldcookery.com/files/fivei18n/ -- Martijn Pieters ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )