View Single Post
Old 06-26-2011, 09:53 AM   #1
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
composite_formatter and eval_formatter APIs deprecated

The template formatter instance ebooks.metadata.book.base.composite_formatter has been deprecated. It is a static instance of SafeFormat. SafeFormat is not thread safe, making using the static instance problematic. The composite_formatter declaration will be removed after a release or two.

If you use composite_formatter, then replace your code that looks like
Code:
composite_formatter.safe_format(...)
with
Code:
from ebooks.metadata.book.base import SafeFormat
...
SafeFormat().safe_format(...)
You can make a local instance of SafeFormat if you wish, as long as you can guarantee that the local instance will never be used simultaneously by multiple threads.

utils.formatter.eval_formatter has the same problem, and should be fixed in a similar way.
chaley is offline   Reply With Quote