Changeset - 626644bc5d43
[Not reviewed]
stable
0 1 0
Mads Kiilerich (mads) - 4 years ago 2021-09-28 15:59:54
mads@kiilerich.com
webutils: monkeypatch to make webhelpers2 work with Python 3.10

Webhelpers2 is apparently a dead project and is using collections.Sequence directly.
1 file changed with 5 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/webutils.py
Show inline comments
 
@@ -11,24 +11,25 @@
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
"""
 
kallithea.lib.webutils
 
~~~~~~~~~~~~~~~~~~~~~~
 

	
 
Helper functions that may rely on the current WSGI request, exposed in the TG2
 
thread-local "global" variables. It should have few dependencies so it can be
 
imported anywhere - just like the global variables can be used everywhere.
 
"""
 

	
 
import collections
 
import datetime
 
import json
 
import logging
 
import random
 
import re
 

	
 
from dateutil import relativedelta
 
from tg import request, session
 
from tg.i18n import ugettext as _
 
from tg.i18n import ungettext
 
from webhelpers2.html import HTML, escape, literal
 
from webhelpers2.html.tags import NotGiven, Option, Options, _input
 
@@ -57,24 +58,28 @@ assert format_byte_size
 
assert link_to
 
assert literal
 
assert password
 
assert radio
 
assert safeid
 
assert submit
 
assert text
 
assert textarea
 
assert truncate
 
assert wrap_paragraphs
 

	
 

	
 
# work around webhelpers2 being a dead project that doesn't support Python 3.10
 
collections.Sequence = collections.abc.Sequence
 

	
 

	
 
#
 
# General Kallithea URL handling
 
#
 

	
 
class UrlGenerator(object):
 
    """Emulate pylons.url in providing a wrapper around routes.url
 

	
 
    This code was added during migration from Pylons to Turbogears2. Pylons
 
    already provided a wrapper like this, but Turbogears2 does not.
 

	
 
    When the routing of Kallithea is changed to use less Routes and more
 
    Turbogears2-style routing, this class may disappear or change.
0 comments (0 inline, 0 general)