Remove references to eval_formatter. Note that the tag browser uses it, but has not been changed because it is in the middle of re-architecture.

This commit is contained in:
Charles Haley 2011-06-26 14:51:58 +01:00
parent 365592d066
commit 2ad45afdb2
3 changed files with 5 additions and 4 deletions

View File

@ -14,7 +14,7 @@ from calibre.constants import preferred_encoding
from calibre import isbytestring, force_unicode
from calibre.utils.config import prefs, tweaks
from calibre.utils.icu import strcmp
from calibre.utils.formatter import eval_formatter
from calibre.utils.formatter import EvalFormatter
class Book(Metadata):
def __init__(self, prefix, lpath, size=None, other=None):
@ -116,7 +116,7 @@ class CollectionsBookList(BookList):
field_name = field_meta['name']
else:
field_name = ''
cat_name = eval_formatter.safe_format(
cat_name = EvalFormatter().safe_format(
fmt=tweaks['sony_collection_name_template'],
kwargs={'category':field_name, 'value':field_value},
error_value='GET_CATEGORY', book=None)

View File

@ -347,5 +347,6 @@ class EvalFormatter(TemplateFormatter):
key = key.lower()
return kwargs.get(key, _('No such variable ') + key)
# DEPRECATED. This is not thread safe. Do not use.
eval_formatter = EvalFormatter()

View File

@ -202,9 +202,9 @@ class BuiltinEval(BuiltinFormatterFunction):
'results from local variables.')
def evaluate(self, formatter, kwargs, mi, locals, template):
from formatter import eval_formatter
from formatter import EvalFormatter
template = template.replace('[[', '{').replace(']]', '}')
return eval_formatter.safe_format(template, locals, 'EVAL', None)
return EvalFormatter().safe_format(template, locals, 'EVAL', None)
class BuiltinAssign(BuiltinFormatterFunction):
name = 'assign'