mirror of
https://github.com/beetbox/beets.git
synced 2025-12-15 21:14:19 +01:00
disable compiled functemplates if not using PY2
The AST code needs rewritten for PY3. This is tracked in https://github.com/beetbox/beets/issues/2058
This commit is contained in:
parent
9f6b07fe1f
commit
fd3f0b5159
1 changed files with 8 additions and 4 deletions
|
|
@ -508,7 +508,8 @@ class Template(object):
|
|||
def __init__(self, template):
|
||||
self.expr = _parse(template)
|
||||
self.original = template
|
||||
self.compiled = self.translate()
|
||||
if six.PY2:
|
||||
self.compiled = self.translate()
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.original == other.original
|
||||
|
|
@ -524,9 +525,12 @@ class Template(object):
|
|||
def substitute(self, values={}, functions={}):
|
||||
"""Evaluate the template given the values and functions.
|
||||
"""
|
||||
try:
|
||||
res = self.compiled(values, functions)
|
||||
except: # Handle any exceptions thrown by compiled version.
|
||||
if six.PY2:
|
||||
try:
|
||||
res = self.compiled(values, functions)
|
||||
except: # Handle any exceptions thrown by compiled version.
|
||||
res = self.interpret(values, functions)
|
||||
else:
|
||||
res = self.interpret(values, functions)
|
||||
return res
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue