Edgewall Software
Modify

Opened 4 years ago

Closed 13 months ago

#13321 closed defect (fixed)

SpamFilter plugin still using ITemplateStreamFilter

Reported by: paul@… 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)

t13321.diff (3.9 KB ) - added by Jun Omae 22 months ago.
t13321-preprocess.diff (3.2 KB ) - added by Jun Omae 22 months ago.

Download all attachments as: .zip

Change History (12)

comment:1 by Ryan J Ollos, 4 years ago

Keywords: bitesized added

comment:2 by Jun Omae, 22 months ago

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….

by Jun Omae, 22 months ago

Attachment: t13321.diff added

by Jun Omae, 22 months ago

Attachment: t13321-preprocess.diff added

in reply to:  2 comment:3 by Jun Omae, 22 months 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:4 by Dirk Stöcker, 22 months ago

I'm still waiting for an actual release of newest Trac version…

comment:5 by Jun Omae, 14 months ago

#13617 was closed as duplicate. The newest Trac version has been released.

comment:6 by Dirk Stöcker, 13 months ago

Work in progress. Should start already and maybe work also. Two config pages are converted yet. Other stuff will follow.

comment:7 by Dirk Stöcker, 13 months ago

#13622 is probably obsolete, when the code from #13321 works in principle. Will try tomorrow to integrate it.

comment:8 by Dirk Stöcker, 13 months 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 Dirk Stöcker, 13 months 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 Dirk Stöcker, 13 months ago

Resolution: fixed
Status: newclosed

SpamFilter is available for 1.6. Report any issues as new tickets. ATM only German translation is complete.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Dirk Stöcker.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Dirk Stöcker to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.