diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 087407e2f..a81650e7d 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -4,7 +4,7 @@ * src/const.py.in: Add custom exception "ErrorSchemaInvalid" * src/GrampsMime.py (mime_type_is_defined): New method that returns True/False - * src/gramps_main.py (__init__) Catch "ErrorSchemaInvalid" exception + * src/gramps_main.py (__init__): Catch "ErrorSchemaInvalid" exception and check for installed MIME-type. Show error because installation is incomplete. @@ -14,6 +14,11 @@ * src/data/Makefile.am: Use defined GCONF_SCHEMA_FILE_DIR and SHARED_MIME_DIR, not the hardcoded paths. + * src/Errors.py (GConfSchemaError): Add new exception. + * src/const.py.in: Remove exception string "ErrorSchemaInvalid" + (replaced by new class). + * src/GrampsGconfKeys.py (get_bool,get_int,get_string): Raise exception. + 2005-03-17 Martin Hawlisch * src/Exporter.py (build_info_page): proofreading; (build_format_page): shrink the size of the window by using tooltips to display the diff --git a/gramps2/src/Errors.py b/gramps2/src/Errors.py index 7e814364f..0763e555c 100644 --- a/gramps2/src/Errors.py +++ b/gramps2/src/Errors.py @@ -81,3 +81,12 @@ class HandleError(Exception): def __str__(self): return self.value + +class GConfSchemaError(Exception): + """Error used to report the absence of expected GConf schema.""" + def __init__(self,value): + Exception.__init__(self) + self.value = value + + def __str__(self): + return self.value diff --git a/gramps2/src/GrampsGconfKeys.py b/gramps2/src/GrampsGconfKeys.py index a3c460dc7..a8484e093 100644 --- a/gramps2/src/GrampsGconfKeys.py +++ b/gramps2/src/GrampsGconfKeys.py @@ -38,7 +38,7 @@ except ImportError: import gobject import os -from const import ErrorSchemaInvalid +import Errors client = gconf.client_get_default() client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE) @@ -349,7 +349,7 @@ def get_bool(key): else: val = client.get_default_from_schema(key) if val == None: - raise ErrorSchemaInvalid, "No default value for key "+key + raise Errors.GConfSchemaError("No default value for key "+key) return val.get_bool() def set_bool(key,val): @@ -366,7 +366,7 @@ def get_int(key,correct_tuple=None): else: val = client.get_default_from_schema(key) if val == None: - raise ErrorSchemaInvalid, "No default value for key "+key + raise Errors.GConfSchemaError("No default value for key "+key) return val.get_int() def set_int(key,val,correct_tuple=None): @@ -383,7 +383,7 @@ def get_string(key,test_func=None): else: val = client.get_default_from_schema(key) if val == None: - raise ErrorSchemaInvalid, "No default value for key "+key + raise Errors.GConfSchemaError("No default value for key "+key) return val.get_string() def set_string(key,val,test_func=None): diff --git a/gramps2/src/const.py.in b/gramps2/src/const.py.in index c63ee28c2..b8bb55f94 100644 --- a/gramps2/src/const.py.in +++ b/gramps2/src/const.py.in @@ -154,13 +154,6 @@ documenters = [ translators = _('TRANSLATORS: Translate this to your name in your native language') -#------------------------------------------------------------------------- -# -# custom exception -# -#------------------------------------------------------------------------- -ErrorSchemaInvalid = "GConf schema not properly installed" - #------------------------------------------------------------------------- # # Constants