Re: [Zope-dev] Getting translation of python code string to work
Hi Morten, Hi Leonard, On Tue, May 31, 2011 at 13:19, li...@nidelven-it.no wrote: Hi, I have a oldschool style Zope 2 product, which has an i18n directory containing translations. Using i18n:domain=SimpleChat in this product works fine in the page templates, Well, ZPTs generate message objects automatically from translated content, but they also explicitly translate all the message objects they get during interpolation between the literal parts of the template and the dynamically generated ones. but when I start translating text in a Python module using _(Translate me) I just get English text (instead of Norwegian, which is what I want). When you say I just get English text, what does exactly get mean in terms of code? Mind you, if you simple call unicode(message) you'll most likely only get the English version back. Same thing if you do: usome other string: %s % message To get an actual translation, you need to call zope.i18n.translate(message), eventually passing the target_languate=... parameter. Take a look at the zope.i18n module for details, specifically the translate() and negotiate() functions. OK. Well I have this function now: def _(msgid, request): language = request['LANGUAGE'] return translate(msgid, domain='SimpleChat', target_language=language) Which sends all the relevant bits to the translate function. But, this doesn't work either, and I can see it is because the interpolate function call is used in translate. So do I need to setup some utility? -Morten ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Metaclass resolution for InterfaceClass
On 1 May 2011 20:28, Laurence Rowe l...@lrowe.co.uk wrote: While experimenting with my InterfaceClass subclass I noticed that it was only being used when it was specified as the first of the bases. I believe this is because InterfaceClass is not a subclass of ``type``, so the normal metaclass derivation logic is not applied. The attached patch implements that logic in InterfaceClass.__new__, picking from the base metaclasses that metaclass which subclasses all other base metaclasses. I've reported this as https://bugs.launchpad.net/zope.interface/+bug/791218 so it does not get lost. Laurence ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Strange Cut/Paste or Copy/Paste or Import/Export behavior
Hi all, I have to containers old_container and new_container that accept objects of the same type. The two containers are actually instances of different classes in the same product. I want to move all the objects from old_container to new_container. I have tried with only one object: 1. To move it with a simple Cut/Paste operation through ZMI: the object is moved successfully, but has missing properties 2. I have used Import/Export to move the same object: the object is imported successfully, but also has missing properties 3. Even tried a simple Copy/Paste: same result, no errors but missing properties Basically, the code for the object to be moved is like this: class Country(Discussion, Folder): _properties = ( Discussion._properties + ( {'id': 'body', 'type': 'text', 'mode': 'w'}, ) ) def __init__(self, id, title, body, comments, flg_notify): self.id = id self.title = title self.body = body Discussion.__dict__['__init__'](self, comments, flg_notify) def check_properties(self): print hasattr(self, 'body') print hasattr(self, 'comments') and class Discussion: _properties = ( ( {'id': 'comments', 'type': 'int', 'mode': 'w'}, {'id': 'flg_notify', 'type': 'int', 'mode': 'w'}, ) ) def __init__(self, comments, flg_notify): self.comments = comments self.flg_notify = flg_notify If i run the method check_properties before move/copy/import it prints True+True. After step 1/2/3 the result is True+False. So the missing property is 'comments', that comes from the extended class Discussion. If a I trie to acces the Propeties tab, manage_propertiesForm method, I get: 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 Shared.DC.Scripts.Bindings, line 313, in __call__ Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec Module App.special_dtml, line 178, in _exec Module DocumentTemplate.DT_In, line 703, in renderwob Module DocumentTemplate.DT_Let, line 76, in render Module DocumentTemplate.DT_Util, line 196, in eval - __traceback_info__: id Module string, line 0, in ? Module OFS.PropertyManager, line 151, in getProperty AttributeError: comments Am I doing something wrong? Any idea is highly appreciated. Thank you very much, Dragos -- Dragos Chirila objectval...@gmail.com (+4) 0722 395375 ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
[Zope] Strange Cut/Paste or Copy/Paste or Import/Export behavior
Hi all, I have to containers old_container and new_container that accept objects of the same type. The two containers are actually instances of different classes in the same product. I want to move all the objects from old_container to new_container. I have tried with only one object: 1. To move it with a simple Cut/Paste operation through ZMI: the object is moved successfully, but has missing properties 2. I have used Import/Export to move the same object: the object is imported successfully, but also has missing properties 3. Even tried a simple Copy/Paste: same result, no errors but missing properties Basically, the code for the object to be moved is like this: class Country(Discussion, Folder): _properties = ( Discussion._properties + ( {'id': 'body', 'type': 'text', 'mode': 'w'}, ) ) def __init__(self, id, title, body, comments, flg_notify): self.id = id self.title = title self.body = body Discussion.__dict__['__init__'](self, comments, flg_notify) def check_properties(self): print hasattr(self, 'body') print hasattr(self, 'comments') and class Discussion: _properties = ( ( {'id': 'comments', 'type': 'int', 'mode': 'w'}, {'id': 'flg_notify', 'type': 'int', 'mode': 'w'}, ) ) def __init__(self, comments, flg_notify): self.comments = comments self.flg_notify = flg_notify If i run the method check_properties before move/copy/import it prints True+True. After step 1/2/3 the result is True+False. So the missing property is 'comments', that comes from the extended class Discussion. If a I trie to acces the Propeties tab, manage_propertiesForm method, I get: 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 Shared.DC.Scripts.Bindings, line 313, in __call__ Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec Module App.special_dtml, line 178, in _exec Module DocumentTemplate.DT_In, line 703, in renderwob Module DocumentTemplate.DT_Let, line 76, in render Module DocumentTemplate.DT_Util, line 196, in eval - __traceback_info__: id Module string, line 0, in ? Module OFS.PropertyManager, line 151, in getProperty AttributeError: comments Am I doing something wrong? Any idea is highly appreciated. Thank you very much, Dragos -- Dragos Chirila objectval...@gmail.com (+4) 0722 395375 ___ 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 )
[Zope-CMF] cmf-tests - OK: 4
This is the summary for test reports received on the cmf-tests list between 2011-05-31 00:00:00 UTC and 2011-06-01 00:00:00 UTC: See the footnotes for test reports of unsuccessful builds. An up-to date view of the builders is also available in our buildbot documentation: http://docs.zope.org/zopetoolkit/process/buildbots.html#the-nightly-builds Reports received CMF-2.2 Zope-2.12 Python-2.6.6 : Linux CMF-2.2 Zope-2.13 Python-2.6.6 : Linux CMF-trunk Zope-2.13 Python-2.6.6 : Linux CMF-trunk Zope-trunk Python-2.6.6 : Linux Non-OK results -- ___ Zope-CMF maillist - Zope-CMF@zope.org https://mail.zope.org/mailman/listinfo/zope-cmf See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests