Opened 5 years ago
Closed 2 years ago
#13321 closed defect (fixed)
SpamFilter plugin still using ITemplateStreamFilter
| Reported by: | Owned by: | Dirk Stöcker | |
|---|---|---|---|
| Priority: | normal | Milestone: | plugin - spam-filter |
| Component: | plugin/spamfilter | Version: | |
| Severity: | normal | Keywords: | bitesized |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
The SpamFilter plugin is still using the deprecated ITemplateStreamFilter API and so won't work with trac 1.5.x:
running build_ext
Traceback (most recent call last):
File "setup.py", line 95, in <module>
**extra
File "/usr/lib/python2.7/site-packages/setuptools/__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/usr/lib64/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/site-packages/setuptools/command/test.py", line 229, in run
self.run_tests()
File "/usr/lib/python2.7/site-packages/setuptools/command/test.py", line 251, in run_tests
exit=False,
File "/usr/lib64/python2.7/unittest/main.py", line 94, in __init__
self.parseArgs(argv)
File "/usr/lib64/python2.7/unittest/main.py", line 149, in parseArgs
self.createTests()
File "/usr/lib64/python2.7/unittest/main.py", line 158, in createTests
self.module)
File "/usr/lib64/python2.7/unittest/loader.py", line 130, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "/usr/lib64/python2.7/unittest/loader.py", line 91, in loadTestsFromName
module = __import__('.'.join(parts_copy))
File "/builddir/build/BUILD/TracSpamFilter-1.5.0dev-r17344/tracspamfilter/__init__.py", line 17, in <module>
from tracspamfilter.filtersystem import *
File "/builddir/build/BUILD/TracSpamFilter-1.5.0dev-r17344/tracspamfilter/filtersystem.py", line 37, in <module>
from tracspamfilter.filters.trapfield import TrapFieldFilterStrategy
File "/builddir/build/BUILD/TracSpamFilter-1.5.0dev-r17344/tracspamfilter/filters/trapfield.py", line 19, in <module>
from trac.web.api import ITemplateStreamFilter
ImportError: cannot import name ITemplateStreamFilter
Fedora Linux 33 (due for release in October) will have trac 1.5.1 or later so the SpamFilter plugin won't be able to work there as things stand.
Attachments (2)
Change History (12)
comment:1 by , 5 years ago
| Keywords: | bitesized added |
|---|
follow-up: 3 comment:2 by , 3 years ago
by , 3 years ago
| Attachment: | t13321.diff added |
|---|
by , 3 years ago
| Attachment: | t13321-preprocess.diff added |
|---|
comment:3 by , 3 years ago
Replying to Jun Omae:
Proposed changes in t13321.diff using Jinja2 extension API to inject trap fields before
<div class="buttons">.
Reconsidering, it is simple using Extension.preprocess() rather than Extension.filter_stream(): t13321-preprocess.diff.
Also, the templates in the plugin should be ported from Genshi template to Jinja2 template in order to make compatible with Trac 1.5.x.
comment:5 by , 2 years ago
#13617 was closed as duplicate. The newest Trac version has been released.
comment:6 by , 2 years ago
Work in progress. Should start already and maybe work also. Two config pages are converted yet. Other stuff will follow.
comment:7 by , 2 years ago
comment:8 by , 2 years ago
See r17733 for Trapfield code. Thanks Jun for the basic idea. Finetuned to restrict to relevant pages to get rid of some nasty side effects of the current code.
comment:9 by , 2 years ago
Jinja and Python 3 conversion is done. I only tested parts, so there will be errors. If you want to help, please test and post errors here if possible with a solution.
Errors likely:
- issues in the Jinja templates (missing functionality or mixed conditions)
- Decoding/encoding issues of bytes/char/unicode (there are slight differences between python 2 and 3 here, which have not been addressed by automatic conversion)
- Tests fail (probably because of point 2)
Translations are not yet adapted, so many translations will be missings ATM.
comment:10 by , 2 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
SpamFilter is available for 1.6. Report any issues as new tickets. ATM only German translation is complete.



Proposed changes in t13321.diff using Jinja2 extension API to inject trap fields before
<div class="buttons">. IMO, I don't consider that is bitesized….