Ticket #4332 (closed Bug: invalid)
Opened 7 years ago
PloneUtilities needs to import generator.i18n
| Reported by: | krid | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | Past |
| Component: | Infrastructure | Keywords: | |
| Cc: |
Description
PloneUtilities is deprecated, but imports its former methods from utils.py. However, several methods were moved to generator.i18n, but are not imported. This causes needless breakage in, for instance, CMFBoard.
The attached patch imports the missing methods, and allows CMFBoard to run unmodified.
Change History
comment:2 Changed 7 years ago by krid
I was too hasty in filing my original bug report. Here's a much clearer explanation:
In Plone 2.0.5, PloneUtilities defines the following methods:
def log_deprecated(message, summary='Deprecation Warning', def log(message,summary=,severity=0): def getGlobalTranslationService(): def translate_wrapper(domain, msgid, mapping=None, context=None, def null_translate(domain, msgid, mapping=None, context=None, def initialize(): def initial_translate(domain, msgid, mapping=None, context=None, def localized_time(time = None, long_format = None, context = None):
def getProductContext(self, context): def getPack(self, context): def getIcon(self, context, path): def initialize(self, context):
def _createObjectByType(type_name, container, id, *args, kw):
In Plone 2.1, PloneUtilities is deprecated, but imports all the methods from utils.py, presumably for backwards compatibility. However, utils.py does not implement 'translate_wrapper', 'null_translate', or "initial_translate'. Thus, when I unpacked CMFBoard, and tried to start Zope with 'zopectl', it crashed. When I used 'runzope', I got the following message:
File "/opt/zope_site/Products/CMFBoard/uihelpers/init.py", line 15, in?
from Products.CMFPlone.PloneUtilities import translate_wrapper
ImportError: cannot import name translate_wrapper
So, I believe that PloneUtilities.py should be patched to import from generator.i18n, to preserve backwards compatibility.

Nope. This is not correct. Nothing was moved to generator and neither is utils a true (verbatim) replacement of PloneUtilities.