mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix patching of search engines module not working
This commit is contained in:
parent
a76a438f92
commit
348d6cecce
@ -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…
x
Reference in New Issue
Block a user