Opened 10 years ago
Closed 10 years ago
#12330 closed defect (fixed)
running bdist_egg on svn checkout of TracSpamFilter does not include translations, which causes a crash
| Reported by: | Owned by: | Ryan J Ollos | |
|---|---|---|---|
| Priority: | normal | Milestone: | plugin - spam-filter |
| Component: | plugin/spamfilter | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: |
Fixed |
||
| API Changes: | |||
| Internal Changes: | |||
Description
Setup.py includes locale/*/LC_MESSAGES/*.mo, however python setup.py bdist_egg does not compile the .po files to .mo files, so nothing gets included in the artifact. This causes trac to crash with the following error:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 522, in dispatch_request
return _dispatch_request(req, env, env_error)
File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 561, in _dispatch_request
send_internal_error(env, req, sys.exc_info())
File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 679, in send_internal_error
req.send_error(exc_info, status=500, env=env, data=data)
File "/usr/lib/python2.7/dist-packages/trac/web/api.py", line 589, in send_error
self.write(data)
File "/usr/lib/python2.7/dist-packages/trac/web/api.py", line 679, in write
for chunk in data:
File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 554, in _dispatch_request
dispatcher.dispatch(req)
File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 247, in dispatch
resp = chosen_handler.process_request(req)
File "/usr/lib/python2.7/dist-packages/trac/wiki/web_ui.py", line 134, in process_request
req.perm(versioned_page.resource).require('WIKI_VIEW')
File "/usr/lib/python2.7/dist-packages/trac/perm.py", line 585, in require
if not self._has_permission(action, resource):
File "/usr/lib/python2.7/dist-packages/trac/perm.py", line 576, in _has_permission
check_permission(action, perm.username, resource, perm)
File "/usr/lib/python2.7/dist-packages/trac/perm.py", line 468, in check_permission
perm)
File "/usr/lib/python2.7/dist-packages/trac/perm.py", line 302, in check_permission
get_user_permissions(username)
File "/usr/lib/python2.7/dist-packages/trac/perm.py", line 397, in get_user_permissions
actions = self.get_actions_dict()
File "/usr/lib/python2.7/dist-packages/trac/perm.py", line 365, in get_actions_dict
for requestor in self.requestors:
File "/usr/lib/python2.7/dist-packages/trac/core.py", line 78, in extensions
components = [component.compmgr[cls] for cls in classes]
File "/usr/lib/python2.7/dist-packages/trac/core.py", line 204, in __getitem__
component = cls(self)
File "/usr/lib/python2.7/dist-packages/trac/core.py", line 140, in __call__
self.__init__()
File "<path to plugins>/TracSpamFilter-1.0.6.dev0-py2.7.egg/tracspamfilter/filtersystem.py", line 117, in __init__
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 954, in resource_filename
self, resource_name
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1652, in get_resource_filename
return self._extract_resource(manager, zip_path)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1673, in _extract_resource
timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
KeyError: 'tracspamfilter/locale'
Attachments (0)
Change History (5)
comment:1 by , 10 years ago
| Component: | general → plugin/spamfilter |
|---|---|
| Owner: | set to |
| Status: | new → assigned |
comment:2 by , 10 years ago
I tried again with a clean working copy of tracspamfilter and I can reproduce now.
comment:3 by , 10 years ago
More details: I can reproduce in the case that tracspamfilter is created before babel is installed. Workaround is to recreate tracspamfilter after installing babel.
comment:4 by , 10 years ago
Proposed solution is same as in th:comment:7:ticket:11606:
-
tracspamfilter/filtersystem.py
114 114 115 115 def __init__(self): 116 116 """Set up translation domain""" 117 locale_dir = resource_filename(__name__, 'locale') 118 add_domain(self.env.path, locale_dir) 117 try: 118 locale_dir = resource_filename(__name__, 'locale') 119 except KeyError: 120 pass 121 else: 122 add_domain(self.env.path, locale_dir) 119 123 120 124 # IRejectHandler methods
comment:5 by , 10 years ago
| Release Notes: | modified (diff) |
|---|---|
| Resolution: | → fixed |
| Status: | assigned → closed |
Fixed in [14503].



I cannot reproduce. Are you using the latest version installed from the 1.0 branch?
I tried in a new virtual environment: