Remove unused method

Also removes an import from outside the gen module.
This commit is contained in:
Nick Hall 2016-11-01 17:57:29 +00:00
parent 8d7c1945f1
commit 473d3aab48

View File

@ -257,36 +257,3 @@ class DbState(Callback):
pass pass
return (dirpath, locked, locked_by, backend) return (dirpath, locked, locked_by, backend)
return None return None
def import_from_filename(self, db, filename, user=None):
"""
Import the filename into the db.
"""
from .plug import BasePluginManager
from .const import PLUGINS_DIR, USER_PLUGINS
from gramps.cli.user import User
pmgr = BasePluginManager.get_instance()
if user is None:
user = User()
(name, ext) = os.path.splitext(os.path.basename(filename))
extension = ext[1:].lower()
import_list = pmgr.get_reg_importers()
if import_list == []:
# This might happen if using gramps from outside, and
# we haven't loaded plugins yet
pmgr.reg_plugins(PLUGINS_DIR, self, None)
pmgr.reg_plugins(USER_PLUGINS, self, None, load_on_reg=True)
import_list = pmgr.get_reg_importers()
for pdata in import_list:
if extension == pdata.extension:
mod = pmgr.load_plugin(pdata)
if not mod:
for item in pmgr.get_fail_list():
name, error_tuple, pdata = item
etype, exception, traceback = error_tuple
print("ERROR:", name, exception)
return False
import_function = getattr(mod, pdata.import_function)
results = import_function(db, filename, user)
return True
return False