mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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:
parent
365592d066
commit
2ad45afdb2
@ -14,7 +14,7 @@ from calibre.constants import preferred_encoding
|
|||||||
from calibre import isbytestring, force_unicode
|
from calibre import isbytestring, force_unicode
|
||||||
from calibre.utils.config import prefs, tweaks
|
from calibre.utils.config import prefs, tweaks
|
||||||
from calibre.utils.icu import strcmp
|
from calibre.utils.icu import strcmp
|
||||||
from calibre.utils.formatter import eval_formatter
|
from calibre.utils.formatter import EvalFormatter
|
||||||
|
|
||||||
class Book(Metadata):
|
class Book(Metadata):
|
||||||
def __init__(self, prefix, lpath, size=None, other=None):
|
def __init__(self, prefix, lpath, size=None, other=None):
|
||||||
@ -116,7 +116,7 @@ class CollectionsBookList(BookList):
|
|||||||
field_name = field_meta['name']
|
field_name = field_meta['name']
|
||||||
else:
|
else:
|
||||||
field_name = ''
|
field_name = ''
|
||||||
cat_name = eval_formatter.safe_format(
|
cat_name = EvalFormatter().safe_format(
|
||||||
fmt=tweaks['sony_collection_name_template'],
|
fmt=tweaks['sony_collection_name_template'],
|
||||||
kwargs={'category':field_name, 'value':field_value},
|
kwargs={'category':field_name, 'value':field_value},
|
||||||
error_value='GET_CATEGORY', book=None)
|
error_value='GET_CATEGORY', book=None)
|
||||||
|
@ -347,5 +347,6 @@ class EvalFormatter(TemplateFormatter):
|
|||||||
key = key.lower()
|
key = key.lower()
|
||||||
return kwargs.get(key, _('No such variable ') + key)
|
return kwargs.get(key, _('No such variable ') + key)
|
||||||
|
|
||||||
|
# DEPRECATED. This is not thread safe. Do not use.
|
||||||
eval_formatter = EvalFormatter()
|
eval_formatter = EvalFormatter()
|
||||||
|
|
||||||
|
@ -202,9 +202,9 @@ class BuiltinEval(BuiltinFormatterFunction):
|
|||||||
'results from local variables.')
|
'results from local variables.')
|
||||||
|
|
||||||
def evaluate(self, formatter, kwargs, mi, locals, template):
|
def evaluate(self, formatter, kwargs, mi, locals, template):
|
||||||
from formatter import eval_formatter
|
from formatter import EvalFormatter
|
||||||
template = template.replace('[[', '{').replace(']]', '}')
|
template = template.replace('[[', '{').replace(']]', '}')
|
||||||
return eval_formatter.safe_format(template, locals, 'EVAL', None)
|
return EvalFormatter().safe_format(template, locals, 'EVAL', None)
|
||||||
|
|
||||||
class BuiltinAssign(BuiltinFormatterFunction):
|
class BuiltinAssign(BuiltinFormatterFunction):
|
||||||
name = 'assign'
|
name = 'assign'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user