mirror of
https://github.com/beetbox/beets.git
synced 2025-12-29 20:12:33 +01:00
functemplate AST: enable the compiler on py3
This commit is contained in:
parent
6234da31a8
commit
2cc7225805
1 changed files with 5 additions and 8 deletions
|
|
@ -534,8 +534,7 @@ class Template(object):
|
|||
def __init__(self, template):
|
||||
self.expr = _parse(template)
|
||||
self.original = template
|
||||
if six.PY2: # FIXME Compiler is broken on Python 3.
|
||||
self.compiled = self.translate()
|
||||
self.compiled = self.translate()
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.original == other.original
|
||||
|
|
@ -551,13 +550,11 @@ class Template(object):
|
|||
def substitute(self, values={}, functions={}):
|
||||
"""Evaluate the template given the values and functions.
|
||||
"""
|
||||
if six.PY2: # FIXME As above.
|
||||
try:
|
||||
res = self.compiled(values, functions)
|
||||
except: # Handle any exceptions thrown by compiled version.
|
||||
res = self.interpret(values, functions)
|
||||
else:
|
||||
try:
|
||||
res = self.compiled(values, functions)
|
||||
except: # Handle any exceptions thrown by compiled version.
|
||||
res = self.interpret(values, functions)
|
||||
|
||||
return res
|
||||
|
||||
def translate(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue