diff roundup/cgi/PageTemplates/Expressions.py @ 5812:33b25e51e127

More fixes for: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
author John Rouillard <rouilj@ieee.org>
date Wed, 12 Jun 2019 21:46:31 -0400
parents 5a871a250670
children
line wrap: on
line diff
--- a/roundup/cgi/PageTemplates/Expressions.py	Wed Jun 12 21:32:46 2019 -0400
+++ b/roundup/cgi/PageTemplates/Expressions.py	Wed Jun 12 21:46:31 2019 -0400
@@ -22,7 +22,12 @@
 for Python expressions, string literals, and paths.
 """
 
-import collections, re, sys
+import re, sys
+try:
+    from collections.abc import Callable
+except ImportError:
+    from collections import Callable
+
 from .TALES import Engine, CompilerError, _valid_name, NAME_RE, \
      Undefined, Default, _parse_expr
 
@@ -86,7 +91,7 @@
         ob = call_with_ns(ob.__render_with_namespace__, ns)
     else:
         base = ob
-        if isinstance(base, collections.Callable):
+        if isinstance(base, Callable):
             try:
                 if getattr(base, 'isDocTemp', 0):
                     ob = call_with_ns(ob, ns, 2)

Roundup Issue Tracker: http://roundup-tracker.org/