Changes to imports - part 6
svn: r20491
This commit is contained in:
parent
80fbfd4d8c
commit
e96d4dd43f
@ -52,7 +52,7 @@ LOG = logging.getLogger(".clidbman")
|
|||||||
# gramps modules
|
# gramps modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import gen.db
|
from gramps.gen.db import DbBsddb
|
||||||
from gen.plug import BasePluginManager
|
from gen.plug import BasePluginManager
|
||||||
from gen.config import config
|
from gen.config import config
|
||||||
from gen.constfunc import win
|
from gen.constfunc import win
|
||||||
@ -266,7 +266,7 @@ class CLIDbManager(object):
|
|||||||
name_file.close()
|
name_file.close()
|
||||||
|
|
||||||
# write the version number into metadata
|
# write the version number into metadata
|
||||||
newdb = gen.db.DbBsddb()
|
newdb = DbBsddb()
|
||||||
newdb.write_version(new_path)
|
newdb.write_version(new_path)
|
||||||
|
|
||||||
(tval, last) = time_val(new_path)
|
(tval, last) = time_val(new_path)
|
||||||
@ -325,7 +325,7 @@ class CLIDbManager(object):
|
|||||||
|
|
||||||
# Create a new database
|
# Create a new database
|
||||||
self.__start_cursor(_("Importing data..."))
|
self.__start_cursor(_("Importing data..."))
|
||||||
dbclass = gen.db.DbBsddb
|
dbclass = DbBsddb
|
||||||
dbase = dbclass()
|
dbase = dbclass()
|
||||||
dbase.load(new_path, user.callback)
|
dbase.load(new_path, user.callback)
|
||||||
|
|
||||||
|
@ -51,7 +51,8 @@ from gen.const import PLUGINS_DIR, USER_PLUGINS
|
|||||||
from gen.errors import DbError
|
from gen.errors import DbError
|
||||||
from gen.dbstate import DbState
|
from gen.dbstate import DbState
|
||||||
from gen.db import DbBsddb
|
from gen.db import DbBsddb
|
||||||
import gen.db.exceptions
|
from gramps.gen.db.exceptions import (DbUpgradeRequiredError,
|
||||||
|
DbVersionError)
|
||||||
from gen.plug import BasePluginManager
|
from gen.plug import BasePluginManager
|
||||||
from gen.utils.config import get_researcher
|
from gen.utils.config import get_researcher
|
||||||
from gen.recentfiles import recent_files
|
from gen.recentfiles import recent_files
|
||||||
@ -153,10 +154,10 @@ class CLIDbLoader(object):
|
|||||||
dbclass.load(filename, self._pulse_progress, mode)
|
dbclass.load(filename, self._pulse_progress, mode)
|
||||||
dbclass.set_save_path(filename)
|
dbclass.set_save_path(filename)
|
||||||
self.dbstate.change_database(dbclass())
|
self.dbstate.change_database(dbclass())
|
||||||
except gen.db.exceptions.DbUpgradeRequiredError, msg:
|
except DbUpgradeRequiredError, msg:
|
||||||
self.dbstate.no_database()
|
self.dbstate.no_database()
|
||||||
self._errordialog( _("Cannot open database"), str(msg))
|
self._errordialog( _("Cannot open database"), str(msg))
|
||||||
except gen.db.exceptions.DbVersionError, msg:
|
except DbVersionError, msg:
|
||||||
self.dbstate.no_database()
|
self.dbstate.no_database()
|
||||||
self._errordialog( _("Cannot open database"), str(msg))
|
self._errordialog( _("Cannot open database"), str(msg))
|
||||||
except OSError, msg:
|
except OSError, msg:
|
||||||
|
@ -36,7 +36,7 @@ import sys
|
|||||||
# Gramps Modules
|
# Gramps Modules
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import gen.user
|
import gramps.gen.user
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -50,10 +50,10 @@ _SPINNER = ['|', '/', '-', '\\']
|
|||||||
# User class
|
# User class
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class User(gen.user.User):
|
class User(gramps.gen.user.User):
|
||||||
"""
|
"""
|
||||||
This class provides a means to interact with the user via CLI.
|
This class provides a means to interact with the user via CLI.
|
||||||
It implements the interface in gen.user.User()
|
It implements the interface in gramps.gen.user.User()
|
||||||
"""
|
"""
|
||||||
def __init__(self, callback=None, error=None):
|
def __init__(self, callback=None, error=None):
|
||||||
self.steps = 0;
|
self.steps = 0;
|
||||||
|
@ -56,7 +56,11 @@ from gi.repository import GObject
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from cli.grampscli import CLIDbLoader
|
from cli.grampscli import CLIDbLoader
|
||||||
from gen.config import config
|
from gen.config import config
|
||||||
import gen.db
|
from gramps.gen.db import DbBsddb
|
||||||
|
from gramps.gen.db.exceptions import (DbUpgradeRequiredError,
|
||||||
|
BsddbDowngradeError,
|
||||||
|
DbVersionError,
|
||||||
|
DbEnvironmentError)
|
||||||
from gen.utils.file import get_unicode_path_from_file_chooser
|
from gen.utils.file import get_unicode_path_from_file_chooser
|
||||||
from gui.pluginmanager import GuiPluginManager
|
from gui.pluginmanager import GuiPluginManager
|
||||||
from gui.dialog import (DBErrorDialog, ErrorDialog, QuestionDialog2,
|
from gui.dialog import (DBErrorDialog, ErrorDialog, QuestionDialog2,
|
||||||
@ -291,7 +295,7 @@ class DbLoader(CLIDbLoader):
|
|||||||
else:
|
else:
|
||||||
mode = 'w'
|
mode = 'w'
|
||||||
|
|
||||||
db = gen.db.DbBsddb()
|
db = DbBsddb()
|
||||||
db.disable_signals()
|
db.disable_signals()
|
||||||
self.dbstate.no_database()
|
self.dbstate.no_database()
|
||||||
|
|
||||||
@ -302,7 +306,7 @@ class DbLoader(CLIDbLoader):
|
|||||||
db.load(filename, self._pulse_progress,
|
db.load(filename, self._pulse_progress,
|
||||||
mode, upgrade=False)
|
mode, upgrade=False)
|
||||||
self.dbstate.change_database(db)
|
self.dbstate.change_database(db)
|
||||||
except gen.db.exceptions.DbUpgradeRequiredError, msg:
|
except DbUpgradeRequiredError, msg:
|
||||||
if QuestionDialog2(_("Need to upgrade database!"),
|
if QuestionDialog2(_("Need to upgrade database!"),
|
||||||
str(msg),
|
str(msg),
|
||||||
_("Upgrade now"),
|
_("Upgrade now"),
|
||||||
@ -315,13 +319,13 @@ class DbLoader(CLIDbLoader):
|
|||||||
self.dbstate.change_database(db)
|
self.dbstate.change_database(db)
|
||||||
else:
|
else:
|
||||||
self.dbstate.no_database()
|
self.dbstate.no_database()
|
||||||
except gen.db.exceptions.BsddbDowngradeError, msg:
|
except BsddbDowngradeError, msg:
|
||||||
self.dbstate.no_database()
|
self.dbstate.no_database()
|
||||||
self._errordialog( _("Cannot open database"), str(msg))
|
self._errordialog( _("Cannot open database"), str(msg))
|
||||||
except gen.db.exceptions.DbVersionError, msg:
|
except DbVersionError, msg:
|
||||||
self.dbstate.no_database()
|
self.dbstate.no_database()
|
||||||
self._errordialog( _("Cannot open database"), str(msg))
|
self._errordialog( _("Cannot open database"), str(msg))
|
||||||
except gen.db.exceptions.DbEnvironmentError, msg:
|
except DbEnvironmentError, msg:
|
||||||
self.dbstate.no_database()
|
self.dbstate.no_database()
|
||||||
self._errordialog( _("Cannot open database"), str(msg))
|
self._errordialog( _("Cannot open database"), str(msg))
|
||||||
except OSError, msg:
|
except OSError, msg:
|
||||||
|
@ -21,10 +21,10 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import gen.filters
|
|
||||||
from gui.editors import EditFilter
|
from gui.editors import EditFilter
|
||||||
from gen.const import CUSTOM_FILTERS
|
from gen.const import CUSTOM_FILTERS
|
||||||
from gen.filters import reload_custom_filters
|
from gramps.gen.filters import (rules, FilterList, GenericFilterFactory,
|
||||||
|
reload_custom_filters)
|
||||||
from gen.ggettext import sgettext as _
|
from gen.ggettext import sgettext as _
|
||||||
|
|
||||||
def make_filter(dbstate, uistate, objclass, gramps_ids, title=None):
|
def make_filter(dbstate, uistate, objclass, gramps_ids, title=None):
|
||||||
@ -34,8 +34,8 @@ def make_filter(dbstate, uistate, objclass, gramps_ids, title=None):
|
|||||||
|
|
||||||
>>> make_filter(dbstate, uistate, 'Person', ['I0003', ...])
|
>>> make_filter(dbstate, uistate, 'Person', ['I0003', ...])
|
||||||
"""
|
"""
|
||||||
FilterClass = gen.filters.GenericFilterFactory(objclass)
|
FilterClass = GenericFilterFactory(objclass)
|
||||||
rule = getattr(getattr(gen.filters.rules, objclass),'RegExpIdOf')
|
rule = getattr(getattr(rules, objclass),'RegExpIdOf')
|
||||||
filter = FilterClass()
|
filter = FilterClass()
|
||||||
if title is None:
|
if title is None:
|
||||||
title = _("Filter %s from Clipboard") % objclass
|
title = _("Filter %s from Clipboard") % objclass
|
||||||
@ -49,7 +49,7 @@ def make_filter(dbstate, uistate, objclass, gramps_ids, title=None):
|
|||||||
'day': struct_time.tm_mday})
|
'day': struct_time.tm_mday})
|
||||||
re = "|".join(["^%s$" % gid for gid in sorted(gramps_ids)])
|
re = "|".join(["^%s$" % gid for gid in sorted(gramps_ids)])
|
||||||
filter.add_rule(rule([re]))
|
filter.add_rule(rule([re]))
|
||||||
filterdb = gen.filters.FilterList(CUSTOM_FILTERS)
|
filterdb = FilterList(CUSTOM_FILTERS)
|
||||||
filterdb.load()
|
filterdb.load()
|
||||||
EditFilter(objclass, dbstate, uistate, [],
|
EditFilter(objclass, dbstate, uistate, [],
|
||||||
filter, filterdb,
|
filter, filterdb,
|
||||||
|
@ -41,6 +41,10 @@ from gen.config import config
|
|||||||
from gen.display.name import displayer as name_displayer
|
from gen.display.name import displayer as name_displayer
|
||||||
from gen.filters import GenericFilter, rules
|
from gen.filters import GenericFilter, rules
|
||||||
from gui.utils import ProgressMeter
|
from gui.utils import ProgressMeter
|
||||||
|
from gramps.gen.proxy import (PrivateProxyDb,
|
||||||
|
LivingProxyDb,
|
||||||
|
FilterProxyDb,
|
||||||
|
ReferencedBySelectionProxyDb)
|
||||||
|
|
||||||
class Progress(object):
|
class Progress(object):
|
||||||
"""
|
"""
|
||||||
@ -553,14 +557,13 @@ class WriterOptionBox(object):
|
|||||||
["person", "note", "privacy", "living", "reference"]
|
["person", "note", "privacy", "living", "reference"]
|
||||||
"""
|
"""
|
||||||
# If the private flag is set, apply the PrivateProxyDb
|
# If the private flag is set, apply the PrivateProxyDb
|
||||||
import gen.proxy
|
|
||||||
if proxy_name == "privacy":
|
if proxy_name == "privacy":
|
||||||
if self.private:
|
if self.private:
|
||||||
if progress:
|
if progress:
|
||||||
progress.reset(_("Filtering private data"))
|
progress.reset(_("Filtering private data"))
|
||||||
progress.progress_cnt += 1
|
progress.progress_cnt += 1
|
||||||
progress.update(progress.progress_cnt)
|
progress.update(progress.progress_cnt)
|
||||||
dbase = gen.proxy.PrivateProxyDb(dbase)
|
dbase = PrivateProxyDb(dbase)
|
||||||
|
|
||||||
# If the restrict flag is set, apply the LivingProxyDb
|
# If the restrict flag is set, apply the LivingProxyDb
|
||||||
elif proxy_name == "living":
|
elif proxy_name == "living":
|
||||||
@ -570,10 +573,10 @@ class WriterOptionBox(object):
|
|||||||
progress.progress_cnt += 1
|
progress.progress_cnt += 1
|
||||||
progress.update(progress.progress_cnt)
|
progress.update(progress.progress_cnt)
|
||||||
mode = [None, # include living
|
mode = [None, # include living
|
||||||
gen.proxy.LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY,
|
LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY,
|
||||||
gen.proxy.LivingProxyDb.MODE_EXCLUDE_ALL,
|
LivingProxyDb.MODE_EXCLUDE_ALL,
|
||||||
][self.restrict_num]
|
][self.restrict_num]
|
||||||
dbase = gen.proxy.LivingProxyDb(
|
dbase = LivingProxyDb(
|
||||||
dbase,
|
dbase,
|
||||||
mode) #
|
mode) #
|
||||||
|
|
||||||
@ -585,7 +588,7 @@ class WriterOptionBox(object):
|
|||||||
progress.reset(_("Applying selected person filter"))
|
progress.reset(_("Applying selected person filter"))
|
||||||
progress.progress_cnt += 1
|
progress.progress_cnt += 1
|
||||||
progress.update(progress.progress_cnt)
|
progress.update(progress.progress_cnt)
|
||||||
dbase = gen.proxy.FilterProxyDb(
|
dbase = FilterProxyDb(
|
||||||
dbase, self.cfilter)
|
dbase, self.cfilter)
|
||||||
|
|
||||||
# Apply the Note Filter
|
# Apply the Note Filter
|
||||||
@ -595,7 +598,7 @@ class WriterOptionBox(object):
|
|||||||
progress.reset(_("Applying selected note filter"))
|
progress.reset(_("Applying selected note filter"))
|
||||||
progress.progress_cnt += 1
|
progress.progress_cnt += 1
|
||||||
progress.update(progress.progress_cnt)
|
progress.update(progress.progress_cnt)
|
||||||
dbase = gen.proxy.FilterProxyDb(
|
dbase = FilterProxyDb(
|
||||||
dbase, note_filter=self.nfilter)
|
dbase, note_filter=self.nfilter)
|
||||||
|
|
||||||
# Apply the ReferencedBySelection
|
# Apply the ReferencedBySelection
|
||||||
@ -607,8 +610,8 @@ class WriterOptionBox(object):
|
|||||||
if self.reference_num == 0:
|
if self.reference_num == 0:
|
||||||
pass
|
pass
|
||||||
elif self.reference_num == 1:
|
elif self.reference_num == 1:
|
||||||
dbase = gen.proxy.ReferencedBySelectionProxyDb(dbase,
|
dbase = ReferencedBySelectionProxyDb(dbase,
|
||||||
all_people=True)
|
all_people=True)
|
||||||
else:
|
else:
|
||||||
raise AttributeError("no such proxy '%s'" % proxy_name)
|
raise AttributeError("no such proxy '%s'" % proxy_name)
|
||||||
|
|
||||||
|
@ -50,8 +50,8 @@ from gen.config import config
|
|||||||
from gen.plug.report import CATEGORY_GRAPHVIZ
|
from gen.plug.report import CATEGORY_GRAPHVIZ
|
||||||
from _reportdialog import ReportDialog
|
from _reportdialog import ReportDialog
|
||||||
from _papermenu import PaperFrame
|
from _papermenu import PaperFrame
|
||||||
import gen.plug.docgen.graphdoc as graphdoc
|
import gramps.gen.plug.docgen.graphdoc as graphdoc
|
||||||
import gen.plug
|
from gramps.gen.plug.menu import Menu
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -128,7 +128,7 @@ class GraphvizReportDialog(ReportDialog):
|
|||||||
except TypeError:
|
except TypeError:
|
||||||
self.options = option_class
|
self.options = option_class
|
||||||
|
|
||||||
menu = gen.plug.menu.Menu()
|
menu = Menu()
|
||||||
self.__gvoptions.add_menu_options(menu)
|
self.__gvoptions.add_menu_options(menu)
|
||||||
|
|
||||||
for category in menu.get_categories():
|
for category in menu.get_categories():
|
||||||
|
@ -36,7 +36,7 @@ import sys
|
|||||||
# Gramps modules
|
# Gramps modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import gen.user
|
import gramps.gen.user
|
||||||
from gui.utils import ProgressMeter
|
from gui.utils import ProgressMeter
|
||||||
from gui.dialog import (WarningDialog, ErrorDialog, DBErrorDialog,
|
from gui.dialog import (WarningDialog, ErrorDialog, DBErrorDialog,
|
||||||
InfoDialog)
|
InfoDialog)
|
||||||
@ -45,10 +45,10 @@ from gui.dialog import (WarningDialog, ErrorDialog, DBErrorDialog,
|
|||||||
# User class
|
# User class
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class User(gen.user.User):
|
class User(gramps.gen.user.User):
|
||||||
"""
|
"""
|
||||||
This class provides a means to interact with the user via GTK.
|
This class provides a means to interact with the user via GTK.
|
||||||
It implements the interface in gen.user.User()
|
It implements the interface in gramps.gen.user.User()
|
||||||
"""
|
"""
|
||||||
def __init__(self, callback=None, error=None):
|
def __init__(self, callback=None, error=None):
|
||||||
self.progress = None
|
self.progress = None
|
||||||
|
@ -57,7 +57,7 @@ LOG = logging.getLogger(".WriteXML")
|
|||||||
# load Gramps libraries
|
# load Gramps libraries
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import gen.lib
|
from gramps.gen.lib import Date, Person
|
||||||
from gen.updatecallback import UpdateCallback
|
from gen.updatecallback import UpdateCallback
|
||||||
from gen.db.exceptions import DbWriteFailure
|
from gen.db.exceptions import DbWriteFailure
|
||||||
from gen.const import VERSION
|
from gen.const import VERSION
|
||||||
@ -501,9 +501,9 @@ class GrampsXmlWriter(UpdateCallback):
|
|||||||
def write_person(self,person,index=1):
|
def write_person(self,person,index=1):
|
||||||
sp = " "*index
|
sp = " "*index
|
||||||
self.write_primary_tag("person",person,index)
|
self.write_primary_tag("person",person,index)
|
||||||
if person.get_gender() == gen.lib.Person.MALE:
|
if person.get_gender() == Person.MALE:
|
||||||
self.write_line("gender","M",index+1)
|
self.write_line("gender","M",index+1)
|
||||||
elif person.get_gender() == gen.lib.Person.FEMALE:
|
elif person.get_gender() == Person.FEMALE:
|
||||||
self.write_line("gender","F",index+1)
|
self.write_line("gender","F",index+1)
|
||||||
else:
|
else:
|
||||||
self.write_line("gender","U",index+1)
|
self.write_line("gender","U",index+1)
|
||||||
@ -862,15 +862,15 @@ class GrampsXmlWriter(UpdateCallback):
|
|||||||
sp = ' '*indent
|
sp = ' '*indent
|
||||||
|
|
||||||
cal= date.get_calendar()
|
cal= date.get_calendar()
|
||||||
if cal != gen.lib.Date.CAL_GREGORIAN:
|
if cal != Date.CAL_GREGORIAN:
|
||||||
calstr = ' cformat="%s"' % gen.lib.Date.calendar_names[cal]
|
calstr = ' cformat="%s"' % Date.calendar_names[cal]
|
||||||
else:
|
else:
|
||||||
calstr = ''
|
calstr = ''
|
||||||
|
|
||||||
qual = date.get_quality()
|
qual = date.get_quality()
|
||||||
if qual == gen.lib.Date.QUAL_ESTIMATED:
|
if qual == Date.QUAL_ESTIMATED:
|
||||||
qual_str = ' quality="estimated"'
|
qual_str = ' quality="estimated"'
|
||||||
elif qual == gen.lib.Date.QUAL_CALCULATED:
|
elif qual == Date.QUAL_CALCULATED:
|
||||||
qual_str = ' quality="calculated"'
|
qual_str = ' quality="calculated"'
|
||||||
else:
|
else:
|
||||||
qual_str = ""
|
qual_str = ""
|
||||||
@ -890,7 +890,7 @@ class GrampsXmlWriter(UpdateCallback):
|
|||||||
mode = date.get_modifier()
|
mode = date.get_modifier()
|
||||||
|
|
||||||
if date.is_compound():
|
if date.is_compound():
|
||||||
if mode == gen.lib.Date.MOD_RANGE:
|
if mode == Date.MOD_RANGE:
|
||||||
tagname = 'daterange'
|
tagname = 'daterange'
|
||||||
else:
|
else:
|
||||||
tagname = 'datespan'
|
tagname = 'datespan'
|
||||||
@ -901,16 +901,16 @@ class GrampsXmlWriter(UpdateCallback):
|
|||||||
self.g.write('%s<%s start="%s" stop="%s"%s%s%s%s/>\n'
|
self.g.write('%s<%s start="%s" stop="%s"%s%s%s%s/>\n'
|
||||||
% (sp,tagname,d1,d2,qual_str,calstr,
|
% (sp,tagname,d1,d2,qual_str,calstr,
|
||||||
dualdated_str, newyear_str))
|
dualdated_str, newyear_str))
|
||||||
elif mode != gen.lib.Date.MOD_TEXTONLY:
|
elif mode != Date.MOD_TEXTONLY:
|
||||||
date_str = self.get_iso_date(date.get_start_date())
|
date_str = self.get_iso_date(date.get_start_date())
|
||||||
if date_str == "":
|
if date_str == "":
|
||||||
return
|
return
|
||||||
|
|
||||||
if mode == gen.lib.Date.MOD_BEFORE:
|
if mode == Date.MOD_BEFORE:
|
||||||
mode_str = ' type="before"'
|
mode_str = ' type="before"'
|
||||||
elif mode == gen.lib.Date.MOD_AFTER:
|
elif mode == Date.MOD_AFTER:
|
||||||
mode_str = ' type="after"'
|
mode_str = ' type="after"'
|
||||||
elif mode == gen.lib.Date.MOD_ABOUT:
|
elif mode == Date.MOD_ABOUT:
|
||||||
mode_str = ' type="about"'
|
mode_str = ' type="about"'
|
||||||
else:
|
else:
|
||||||
mode_str = ""
|
mode_str = ""
|
||||||
|
@ -59,8 +59,7 @@ from webapp.utils import _, build_args
|
|||||||
from webapp.grampsdb.models import *
|
from webapp.grampsdb.models import *
|
||||||
from webapp.grampsdb.view import *
|
from webapp.grampsdb.view import *
|
||||||
from webapp.dbdjango import DbDjango
|
from webapp.dbdjango import DbDjango
|
||||||
import cli.user
|
from gramps.cli.user import User
|
||||||
import gen.proxy
|
|
||||||
from gen.const import VERSION_TUPLE
|
from gen.const import VERSION_TUPLE
|
||||||
from gen.utils.svn import get_svn_revision
|
from gen.utils.svn import get_svn_revision
|
||||||
|
|
||||||
@ -216,7 +215,7 @@ def process_report_run(request, handle):
|
|||||||
mimetype = 'application/%s' % args["off"]
|
mimetype = 'application/%s' % args["off"]
|
||||||
elif report.report_type == "export":
|
elif report.report_type == "export":
|
||||||
filename = "/tmp/%s-%s.%s" % (str(profile.user.username), str(handle), args["off"])
|
filename = "/tmp/%s-%s.%s" % (str(profile.user.username), str(handle), args["off"])
|
||||||
export_file(db, filename, cli.user.User()) # callback
|
export_file(db, filename, User()) # callback
|
||||||
mimetype = 'text/plain'
|
mimetype = 'text/plain'
|
||||||
elif report.report_type == "import":
|
elif report.report_type == "import":
|
||||||
filename = download(args["i"], "/tmp/%s-%s.%s" % (str(profile.user.username),
|
filename = download(args["i"], "/tmp/%s-%s.%s" % (str(profile.user.username),
|
||||||
@ -227,14 +226,14 @@ def process_report_run(request, handle):
|
|||||||
import threading
|
import threading
|
||||||
def background():
|
def background():
|
||||||
try:
|
try:
|
||||||
import_file(db, filename, cli.user.User()) # callback
|
import_file(db, filename, User()) # callback
|
||||||
except:
|
except:
|
||||||
make_message(request, "import_file failed: " + traceback.format_exc())
|
make_message(request, "import_file failed: " + traceback.format_exc())
|
||||||
threading.Thread(target=background).start()
|
threading.Thread(target=background).start()
|
||||||
make_message(request, "Your data is now being imported...")
|
make_message(request, "Your data is now being imported...")
|
||||||
return redirect("/report/")
|
return redirect("/report/")
|
||||||
else:
|
else:
|
||||||
success = import_file(db, filename, cli.user.User()) # callback
|
success = import_file(db, filename, User()) # callback
|
||||||
if not success:
|
if not success:
|
||||||
make_message(request, "Failed to load imported.")
|
make_message(request, "Failed to load imported.")
|
||||||
return redirect("/report/")
|
return redirect("/report/")
|
||||||
|
Loading…
Reference in New Issue
Block a user