Merge pull request #182 from prculley/logwarn
fix LOG.warn() deprecation warning
This commit is contained in:
commit
1abc0ad1fa
@ -335,7 +335,7 @@ class Gramplet:
|
||||
return False
|
||||
except Exception as e:
|
||||
import traceback
|
||||
LOG.warn("Gramplet gave an error: %s" % self.gui.title)
|
||||
LOG.warning("Gramplet gave an error: %s" % self.gui.title)
|
||||
traceback.print_exc()
|
||||
print("Continuing after gramplet error...")
|
||||
self._idle_id = 0
|
||||
|
@ -530,8 +530,8 @@ class GrampsLocale:
|
||||
os.path.exists(os.path.abspath(_first.localedir))):
|
||||
self.localedir = _first.localedir
|
||||
else:
|
||||
LOG.warn('Missing or invalid localedir %s; no translations will be available.', repr(localedir))
|
||||
|
||||
LOG.warning('Missing or invalid localedir %s; no translations'
|
||||
' will be available.', repr(localedir))
|
||||
self.lang = lang
|
||||
self.localedomain = domain or 'gramps'
|
||||
if languages:
|
||||
@ -864,7 +864,7 @@ class GrampsLocale:
|
||||
try:
|
||||
key = locale.strxfrm(string)
|
||||
except Exception as err:
|
||||
LOG.warn("Failed to obtain key for %s because %s",
|
||||
LOG.warning("Failed to obtain key for %s because %s",
|
||||
self.collation, str(err))
|
||||
return string
|
||||
return key
|
||||
|
@ -217,7 +217,7 @@ def __create_thumbnail_image(src_file, mtype=None, rectangle=None,
|
||||
pixbuf.savev(filename, "png", "", "")
|
||||
return True
|
||||
except Exception as err:
|
||||
LOG.warn("Error scaling image down: %s", str(err))
|
||||
LOG.warning("Error scaling image down: %s", str(err))
|
||||
return False
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -75,21 +75,21 @@ def EditObject(dbstate, uistate, track, obj_class, prop=None, value=None, callba
|
||||
try:
|
||||
EDITORS[obj_class](dbstate, uistate, track, obj, callback=callback)
|
||||
except Exception as msg:
|
||||
LOG.warn(str(msg))
|
||||
LOG.warning(str(msg))
|
||||
elif prop in ("gramps_id", "handle"):
|
||||
obj = dbstate.db.get_table_metadata(obj_class)[prop + "_func"](value)
|
||||
if obj:
|
||||
try:
|
||||
EDITORS[obj_class](dbstate, uistate, track, obj, callback=callback)
|
||||
except Exception as msg:
|
||||
LOG.warn(str(msg))
|
||||
LOG.warning(str(msg))
|
||||
else:
|
||||
LOG.warn("gramps://%s/%s/%s not found" %
|
||||
LOG.warning("gramps://%s/%s/%s not found" %
|
||||
(obj_class, prop, value))
|
||||
else:
|
||||
LOG.warn("unknown property to edit '%s'; "
|
||||
LOG.warning("unknown property to edit '%s'; "
|
||||
"should be 'gramps_id' or 'handle'" % prop)
|
||||
else:
|
||||
LOG.warn("unknown object to edit '%s'; "
|
||||
LOG.warning("unknown object to edit '%s'; "
|
||||
"should be one of %s" % (obj_class, list(EDITORS.keys())))
|
||||
|
||||
|
@ -852,13 +852,13 @@ class EditFamily(EditPrimary):
|
||||
self.obj.set_father_handle(person.get_handle())
|
||||
self.update_father(person.get_handle())
|
||||
except:
|
||||
log.warn("Failed to update father: \n"
|
||||
"obj returned from selector was: %s\n"
|
||||
% (repr(obj),))
|
||||
log.warning("Failed to update father: \n"
|
||||
"obj returned from selector was: %s\n"
|
||||
% (repr(obj),))
|
||||
raise
|
||||
|
||||
else:
|
||||
log.warn(
|
||||
log.warning(
|
||||
"Object selector returned obj.__class__ = %s, it should "
|
||||
"have been of type %s." % (obj.__class__.__name__,
|
||||
Person.__name__))
|
||||
|
@ -179,7 +179,8 @@ class Gramps:
|
||||
theme.append_search_path(IMAGE_DIR)
|
||||
|
||||
if lin() and glocale.lang != 'C' and not gettext.find(GTK_GETTEXT_DOMAIN):
|
||||
LOG.warn("GTK translations missing, GUI will be broken, especially for RTL languages!")
|
||||
LOG.warning("GTK translations missing, GUI will be broken, "
|
||||
"especially for RTL languages!")
|
||||
# Note: the warning dialog below will likely have wrong stock icons!
|
||||
# Translators: the current language will be the one you translate into.
|
||||
WarningDialog(
|
||||
|
@ -146,9 +146,12 @@ class Spell:
|
||||
# the language does not exist
|
||||
# and presumably if there is no dictionary
|
||||
if not self.gtkspell_spell.get_language_list():
|
||||
LOG.warn(_("You have no installed dictionaries. Either install one or disable spell checking"))
|
||||
LOG.warning(_("You have no installed dictionaries. "
|
||||
"Either install one or disable spell "
|
||||
"checking"))
|
||||
else:
|
||||
LOG.warn(_("Spelling checker initialization failed: %s"), err)
|
||||
LOG.warning(_("Spelling checker initialization "
|
||||
"failed: %s"), err)
|
||||
else:
|
||||
if spellcheck_code == 'on':
|
||||
return
|
||||
|
@ -936,7 +936,7 @@ class ViewManager(CLIManager):
|
||||
page = page_def(pdata, self.dbstate, self.uistate)
|
||||
except:
|
||||
import traceback
|
||||
LOG.warn("View '%s' failed to load." % pdata.id)
|
||||
LOG.warning("View '%s' failed to load." % pdata.id)
|
||||
traceback.print_exc()
|
||||
page = self.__create_dummy_page(pdata, traceback.format_exc())
|
||||
|
||||
|
@ -135,7 +135,7 @@ def get_gramplet_opts(name, opts):
|
||||
my_data.update(opts)
|
||||
return my_data
|
||||
else:
|
||||
LOG.warn("Unknown gramplet name: '%s'", name)
|
||||
LOG.warning("Unknown gramplet name: '%s'", name)
|
||||
return {}
|
||||
|
||||
def get_gramplet_options_by_name(name):
|
||||
@ -145,7 +145,7 @@ def get_gramplet_options_by_name(name):
|
||||
if name in AVAILABLE_GRAMPLETS():
|
||||
return GET_AVAILABLE_GRAMPLETS(name).copy()
|
||||
else:
|
||||
LOG.warn("Unknown gramplet name: '%s'", name)
|
||||
LOG.warning("Unknown gramplet name: '%s'", name)
|
||||
return None
|
||||
|
||||
def get_gramplet_options_by_tname(name):
|
||||
@ -155,7 +155,7 @@ def get_gramplet_options_by_tname(name):
|
||||
for key in AVAILABLE_GRAMPLETS():
|
||||
if GET_AVAILABLE_GRAMPLETS(key)["tname"] == name:
|
||||
return GET_AVAILABLE_GRAMPLETS(key).copy()
|
||||
LOG.warn("Unknown gramplet name: '%s'",name)
|
||||
LOG.warning("Unknown gramplet name: '%s'",name)
|
||||
return None
|
||||
|
||||
def make_requested_gramplet(gui_class, pane, opts, dbstate, uistate):
|
||||
@ -175,11 +175,11 @@ def make_requested_gramplet(gui_class, pane, opts, dbstate, uistate):
|
||||
if module:
|
||||
getattr(module, opts["content"])(gui)
|
||||
else:
|
||||
LOG.warn("Error loading gramplet '%s': skipping content",
|
||||
name)
|
||||
LOG.warning("Error loading gramplet '%s': "
|
||||
"skipping content", name)
|
||||
return gui
|
||||
else:
|
||||
LOG.warn("Error loading gramplet: unknown name")
|
||||
LOG.warning("Error loading gramplet: unknown name")
|
||||
return None
|
||||
|
||||
def logical_true(value):
|
||||
@ -515,7 +515,8 @@ class GuiGramplet:
|
||||
url = attributes["wiki"]
|
||||
self.link_region(start, stop, "WIKI", url) # tooltip?
|
||||
else:
|
||||
LOG.warn("warning: no url on link: '%s'", text[start, stop])
|
||||
LOG.warning("warning: no url on link: '%s'",
|
||||
text[start, stop])
|
||||
|
||||
def link_region(self, start, stop, link_type, url):
|
||||
link_data = (LinkTag(self.buffer), link_type, url, url)
|
||||
@ -1057,7 +1058,7 @@ class GrampletPane(Gtk.ScrolledWindow):
|
||||
self.gramplet_map[unique] = g
|
||||
self.frame_map[str(g.mainframe)] = g
|
||||
else:
|
||||
LOG.warn("Can't make gramplet of type '%s'.", name)
|
||||
LOG.warning("Can't make gramplet of type '%s'.", name)
|
||||
self.place_gramplets()
|
||||
|
||||
def show_all(self):
|
||||
@ -1259,7 +1260,7 @@ class GrampletPane(Gtk.ScrolledWindow):
|
||||
fp.write("%s=%s\n\n" % (key, base_opts[key]))
|
||||
|
||||
except IOError as err:
|
||||
LOG.warn("Failed to open %s because $s; gramplets not saved",
|
||||
LOG.warning("Failed to open %s because $s; gramplets not saved",
|
||||
filename, str(err))
|
||||
return
|
||||
|
||||
@ -1363,7 +1364,7 @@ class GrampletPane(Gtk.ScrolledWindow):
|
||||
self.gramplet_map[opts["title"]] = g
|
||||
self.frame_map[str(g.mainframe)] = g
|
||||
else:
|
||||
LOG.warn("Can't make gramplet of type '%s'.", name)
|
||||
LOG.warning("Can't make gramplet of type '%s'.", name)
|
||||
if g:
|
||||
gramplet = g
|
||||
gramplet.gstate = "maximized"
|
||||
@ -1387,8 +1388,8 @@ class GrampletPane(Gtk.ScrolledWindow):
|
||||
all_opts = get_gramplet_options_by_tname(tname)
|
||||
name = all_opts["name"]
|
||||
if all_opts is None:
|
||||
LOG.warn("Unknown gramplet type: '%s'; bad gramplets.ini file?",
|
||||
name)
|
||||
LOG.warning("Unknown gramplet type: '%s'; bad "
|
||||
"gramplets.ini file?", name)
|
||||
return
|
||||
if "title" not in all_opts:
|
||||
all_opts["title"] = "Untitled Gramplet"
|
||||
@ -1424,7 +1425,7 @@ class GrampletPane(Gtk.ScrolledWindow):
|
||||
gramplet.pui.active = True
|
||||
gramplet.pui.update()
|
||||
else:
|
||||
LOG.warn("Can't make gramplet of type '%s'.", name)
|
||||
LOG.warning("Can't make gramplet of type '%s'.", name)
|
||||
|
||||
def _button_press(self, obj, event):
|
||||
if is_right_click(event):
|
||||
|
@ -175,7 +175,7 @@ class PackageWriter:
|
||||
try:
|
||||
archive = tarfile.open(self.filename,'w:gz')
|
||||
except EnvironmentError as msg:
|
||||
log.warn(str(msg))
|
||||
LOG.warning(str(msg))
|
||||
self.user.notify_error(_('Failure writing %s') % self.filename, str(msg))
|
||||
return 0
|
||||
|
||||
|
@ -166,7 +166,7 @@ class GrampsXmlWriter(UpdateCallback):
|
||||
else:
|
||||
g = open(filename,"wb")
|
||||
except IOError as msg:
|
||||
LOG.warn(str(msg))
|
||||
LOG.warning(str(msg))
|
||||
raise DbWriteFailure(_('Failure writing %s') % filename,
|
||||
str(msg))
|
||||
return 0
|
||||
|
@ -88,7 +88,7 @@ def rd(line_number, row, col, key, default = None):
|
||||
""" Return Row data by column name """
|
||||
if key in col:
|
||||
if col[key] >= len(row):
|
||||
LOG.warn("missing '%s, on line %d" % (key, line_number))
|
||||
LOG.warning("missing '%s, on line %d" % (key, line_number))
|
||||
return default
|
||||
retval = row[col[key]].strip()
|
||||
if retval == "":
|
||||
@ -302,7 +302,7 @@ class CSVParser:
|
||||
else:
|
||||
return None
|
||||
else:
|
||||
LOG.warn("invalid lookup type in CSV import: '%s'" % type_)
|
||||
LOG.warning("invalid lookup type in CSV import: '%s'" % type_)
|
||||
return None
|
||||
|
||||
def storeup(self, type_, id_, object_):
|
||||
@ -320,7 +320,7 @@ class CSVParser:
|
||||
id_ = self.db.pid2user_format(id_)
|
||||
self.placeref[id_.lower()] = object_
|
||||
else:
|
||||
LOG.warn("invalid storeup type in CSV import: '%s'" % type_)
|
||||
LOG.warning("invalid storeup type in CSV import: '%s'" % type_)
|
||||
|
||||
def parse(self, filehandle):
|
||||
"""
|
||||
@ -391,7 +391,7 @@ class CSVParser:
|
||||
elif "place" in header:
|
||||
self._parse_place(line_number, row, col)
|
||||
else:
|
||||
LOG.warn("ignoring line %d" % line_number)
|
||||
LOG.warning("ignoring line %d" % line_number)
|
||||
return None
|
||||
|
||||
def _parse_marriage(self, line_number, row, col):
|
||||
@ -408,8 +408,8 @@ class CSVParser:
|
||||
husband = self.lookup("person", husband)
|
||||
if husband is None and wife is None:
|
||||
# might have children, so go ahead and add
|
||||
LOG.warn("no parents on line %d; adding family anyway" %
|
||||
line_number)
|
||||
LOG.warning("no parents on line %d; adding family anyway" %
|
||||
line_number)
|
||||
family = self.get_or_create_family(marriage_ref, husband, wife)
|
||||
# adjust gender, if not already provided
|
||||
if husband:
|
||||
@ -479,8 +479,8 @@ class CSVParser:
|
||||
"Parse the content of a family line"
|
||||
family_ref = rd(line_number, row, col, "family")
|
||||
if family_ref is None:
|
||||
LOG.warn("no family reference found for family on line %d" %
|
||||
line_number)
|
||||
LOG.warning("no family reference found for family on line %d" %
|
||||
line_number)
|
||||
return # required
|
||||
child = rd(line_number, row, col, "child")
|
||||
source = rd(line_number, row, col, "source")
|
||||
@ -489,12 +489,12 @@ class CSVParser:
|
||||
child = self.lookup("person", child)
|
||||
family = self.lookup("family", family_ref)
|
||||
if family is None:
|
||||
LOG.warn("no matching family reference found for family "
|
||||
"on line %d" % line_number)
|
||||
LOG.warning("no matching family reference found for family "
|
||||
"on line %d" % line_number)
|
||||
return
|
||||
if child is None:
|
||||
LOG.warn("no matching child reference found for family "
|
||||
"on line %d" % line_number)
|
||||
LOG.warning("no matching child reference found for family "
|
||||
"on line %d" % line_number)
|
||||
return
|
||||
# is this child already in this family? If so, don't add
|
||||
LOG.debug("children: %s", [ref.ref for ref in
|
||||
@ -586,8 +586,8 @@ class CSVParser:
|
||||
person = self.lookup("person", person_ref)
|
||||
if person is None:
|
||||
if surname is None:
|
||||
LOG.warn("empty surname for new person on line %d" %
|
||||
line_number)
|
||||
LOG.warning("empty surname for new person on line %d" %
|
||||
line_number)
|
||||
surname = ""
|
||||
# new person
|
||||
person = self.create_person()
|
||||
|
@ -750,8 +750,8 @@ class GrampsParser(UpdateCallback):
|
||||
self.import_handles[orig_handle][target][INSTANTIATED] = True
|
||||
return handle
|
||||
elif handle in self.import_handles:
|
||||
LOG.warn("The file you import contains duplicate handles "
|
||||
"which is illegal and being fixed now.")
|
||||
LOG.warning("The file you import contains duplicate handles "
|
||||
"which is illegal and being fixed now.")
|
||||
handle = create_id()
|
||||
while handle in self.import_handles:
|
||||
handle = create_id()
|
||||
@ -3205,7 +3205,7 @@ class GrampsParser(UpdateCallback):
|
||||
{'family' : family.gramps_id,
|
||||
'father' : father.gramps_id})
|
||||
self.info.add('unlinked-family', txt, None)
|
||||
LOG.warn(txt)
|
||||
LOG.warning(txt)
|
||||
|
||||
if mother_handle:
|
||||
mother = self.db.get_person_from_handle(mother_handle)
|
||||
@ -3221,7 +3221,7 @@ class GrampsParser(UpdateCallback):
|
||||
{'family' : family.gramps_id,
|
||||
'mother' : mother.gramps_id})
|
||||
self.info.add('unlinked-family', txt, None)
|
||||
LOG.warn(txt)
|
||||
LOG.warning(txt)
|
||||
|
||||
for child_ref in family.get_child_ref_list():
|
||||
child_handle = child_ref.ref
|
||||
@ -3243,7 +3243,7 @@ class GrampsParser(UpdateCallback):
|
||||
{'family' : family.gramps_id,
|
||||
'child' : child.gramps_id})
|
||||
self.info.add('unlinked-family', txt, None)
|
||||
LOG.warn(txt)
|
||||
LOG.warning(txt)
|
||||
|
||||
def append_value(orig, val):
|
||||
if orig:
|
||||
|
@ -1394,7 +1394,7 @@ class CairoDoc(BaseDoc, TextDoc, DrawDoc):
|
||||
elif fe[-1] != self.EXT:
|
||||
# NOTE: the warning will be bogus
|
||||
# if the EXT isn't properly overridden by derived class
|
||||
log.warn(_(
|
||||
LOG.warning(_(
|
||||
"""Mismatch between selected extension %(ext)s and actual format.
|
||||
Writing to %(filename)s in format %(impliedext)s.""") %
|
||||
{'ext' : fe[-1],
|
||||
|
Loading…
Reference in New Issue
Block a user