Modify ↓
#13027 closed defect (fixed)
[patch] MilestoneTemplates: fix error 'ImportError: cannot import name _' for trac 1.2
| Reported by: | komar | Owned by: | komar |
|---|---|---|---|
| Priority: | normal | Component: | MilestoneTemplatePlugin |
| Severity: | normal | Keywords: | |
| Cc: | Trac Release: |
Description
After upgrading trac to 1.2 I get error:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/trac/loader.py", line 68, in _load_eggs
entry.load(require=True)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2291, in load
return self.resolve()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2297, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python2.7/dist-packages/milestonetemplate/web_ui.py", line 10, in <module>
from trac.util.text import _
ImportError: cannot import name _
there is a patch
--- a/web_ui.py 2017-01-04 16:06:01.733012868 +0100
+++ b/web_ui.py 2017-01-04 16:06:07.000000000 +0100
@@ -7,7 +7,7 @@
from trac.ticket.admin import MilestoneAdminPanel
from trac.ticket.model import Milestone
from trac.util.datefmt import parse_date
-from trac.util.text import _
+from trac.util.translation import _
from trac.web.api import IRequestFilter
from trac.web.chrome import add_notice, add_script, add_script_data, add_stylesheet, \
ITemplateProvider, ITemplateStreamFilter
Attachments (0)
Change History (2)
comment:1 Changed 9 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:2 Changed 9 years ago by
| Owner: | changed from Cinc-th to komar |
|---|
The fix was straightforward, so I took the liberty to push it. I hope that is okay.
The _ function has always been in the module trac.util.translation, so I imagine this only worked in Trac 1.0.x due to a transitive import.
Note: See
TracTickets for help on using
tickets.



In 16172: