Opened 8 years ago
Last modified 8 years ago
#12491 closed defect
Python >= 2.6 should be required for recaptcha2 module — at Version 2
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: | |||
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
Change History (2)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Description: | modified (diff) |
---|
Note:
See TracTickets
for help on using tickets.
I noticed tracspamfilter for Trac 1.0 with Python 2.5 has syntax errors due to with keywords without
from __future__ import with_statement
.