Opened 8 years ago
Closed 8 years ago
#12491 closed defect (fixed)
Python >= 2.6 should be required for recaptcha2 module
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | plugin - spam-filter |
Component: | plugin/spamfilter | Version: | |
Severity: | normal | Keywords: | stoecker |
Cc: | Branch: | ||
Release Notes: |
Require |
||
API Changes: | |||
Internal Changes: |
Description (last modified by )
Noted while reviewing gmessage:trac-users:ibiYYaqNok0/Sz_Nt6eTAAAJ, plugins/1.0/spam-filter/tracspamfilter/captcha/recaptcha2.py@14630:14 imports json
, which is only available in Python ≥ 2.6.
setup.py requires json
for the tracspamfilter.filters.blogspam
module, and json
requires Python ≥ 2.6.
It's possible we could address the issue found on the mailing list as well, with the following change (untested):
-
../spam-filter/setup.py
12 12 # individuals. For the exact contribution history, see the revision 13 13 # history and logs, available at http://projects.edgewall.com/trac/. 14 14 15 import sys 15 16 from setuptools import setup, find_packages 16 17 17 18 PACKAGE = 'TracSpamFilter' … … 60 61 'dns': ['dnspython>=1.3.5'], 61 62 'spambayes': ['spambayes'], 62 63 'pillow': ['pillow'], 63 'json': [' python>=2.6'],64 'json': ['simplejson' if sys.version_info < (2, 6) else ''], 64 65 'account': ['TracAccountManager >= 0.4'], 65 66 'oauth': ['oauth2'], 66 67 'httplib2': ['httplib2'] … … 98 99 spamfilter.captcha.expression = tracspamfilter.captcha.expression 99 100 spamfilter.captcha.rand = tracspamfilter.captcha.rand 100 101 spamfilter.captcha.recaptcha = tracspamfilter.captcha.recaptcha 101 spamfilter.captcha.recaptcha2 = tracspamfilter.captcha.recaptcha2 102 spamfilter.captcha.recaptcha2 = tracspamfilter.captcha.recaptcha2[json] 102 103 spamfilter.captcha.keycaptcha = tracspamfilter.captcha.keycaptcha 103 104 spamfilter.captcha.mollom = tracspamfilter.captcha.mollom[oauth,httplib2] 104 105 """, -
../spam-filter/tracspamfilter/captcha/recaptcha2.py
11 11 # individuals. For the exact contribution history, see the revision 12 12 # history and logs, available at http://projects.edgewall.com/trac/. 13 13 14 import json15 14 import urllib 16 15 import urllib2 17 16 from pkg_resources import get_distribution 17 try: 18 import json 19 except ImportError: 20 import simplejson as json 18 21 19 22 from trac import __version__ as TRAC_VERSION 20 23 from trac.config import Option -
../spam-filter/tracspamfilter/filters/blogspam.py
15 15 # Author: Dirk Stöcker <trac@dstoecker.de> 16 16 17 17 from email.Utils import parseaddr 18 import json19 18 from pkg_resources import get_distribution 19 try: 20 import json 21 except ImportError: 22 import simplejson as json 20 23 21 24 from trac import __version__ as TRAC_VERSION 22 25 from trac.config import IntOption, Option, ListOption
Attachments (0)
Change History (5)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Description: | modified (diff) |
---|
comment:4 by , 8 years ago
The following error is shown in logs on startup, confirming the finding on the mailing list:
10:40:03 PM Trac[loader] ERROR: Skipping "spamfilter.blogspam = tracspamfilter.filters.blogspam [json]": (version conflict "VersionConflict: (Python 2.7.11- (/usr/lib/python2.7/lib-dynload), Requirement.parse('python>=2.6'))")
Also, several errors like the following:
10:40:03 PM Trac[loader] ERROR: Skipping "tracopt.perm.authz_policy = tracopt.perm.authz_policy [configobj]": Traceback (most recent call last): File "/home/user/pve-2.7/local/lib/python2.7/site-packages/trac/loader.py", line 68, in _load_eggs entry.load(require=True) File "/home/user/pve-2.7/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2228, in load self.require(*args, **kwargs) File "/home/user/pve-2.7/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2245, in require items = working_set.resolve(reqs, env, installer) File "/home/user/pve-2.7/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 808, in resolve if not req_extras.markers_pass(req): File "/home/user/pve-2.7/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 993, in markers_pass return not req.marker or any(extra_evals) or req.marker.evaluate() File "/home/user/pve-2.7/local/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/markers.py", line 278, in evaluate return _evaluate_markers(self._markers, current_environment) File "/home/user/pve-2.7/local/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/markers.py", line 203, in _evaluate_markers lhs_value = _get_env(environment, lhs.value) File "/home/user/pve-2.7/local/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/markers.py", line 185, in _get_env "{0!r} does not exist in evaluation environment.".format(name) UndefinedEnvironmentName: 'extra' does not exist in evaluation environment.
comment:5 by , 8 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Fixed in [14813].
I noticed tracspamfilter for Trac 1.0 with Python 2.5 has syntax errors due to with keywords without
from __future__ import with_statement
.