mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 11:14:02 +02:00
Fix patching of search engines module not working
This commit is contained in:
parent
a76a438f92
commit
348d6cecce
1 changed files with 13 additions and 1 deletions
|
|
@ -43,6 +43,18 @@ def load_plugin(src):
|
|||
return x
|
||||
|
||||
|
||||
class PatchedSearchEngines(object):
|
||||
|
||||
def __init__(self, ns):
|
||||
self.__ns = ns
|
||||
|
||||
def __getattr__(self, attr):
|
||||
try:
|
||||
return self.__ns[attr]
|
||||
except KeyError:
|
||||
raise AttributeError('{} not present in search_engines_module'.format(attr))
|
||||
|
||||
|
||||
def patch_search_engines(src):
|
||||
global current_search_engines
|
||||
src = src.encode('utf-8')
|
||||
|
|
@ -54,7 +66,7 @@ def patch_search_engines(src):
|
|||
cv = ns.get('current_version')
|
||||
if cv is None or cv <= builtin_search_engines.current_version:
|
||||
return
|
||||
current_search_engines = ns
|
||||
current_search_engines = PatchedSearchEngines(ns)
|
||||
|
||||
|
||||
def patch_plugins():
|
||||
|
|
|
|||
Loading…
Reference in a new issue