[svn] commit: r866 - in /branches/jelte-configuration/src/lib/config/python/isc/config: config_test.in module_spec.py
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Feb 18 10:38:48 UTC 2010
Author: jelte
Date: Thu Feb 18 10:38:48 2010
New Revision: 866
Log:
docstrings
Modified:
branches/jelte-configuration/src/lib/config/python/isc/config/config_test.in
branches/jelte-configuration/src/lib/config/python/isc/config/module_spec.py
Modified: branches/jelte-configuration/src/lib/config/python/isc/config/config_test.in
==============================================================================
--- branches/jelte-configuration/src/lib/config/python/isc/config/config_test.in (original)
+++ branches/jelte-configuration/src/lib/config/python/isc/config/config_test.in Thu Feb 18 10:38:48 2010
@@ -17,4 +17,3 @@
${PYTHON_EXEC} -O ${CONFIG_PATH}/module_spec_test.py $*
${PYTHON_EXEC} -O ${CONFIG_PATH}/cfgmgr_test.py $*
-
Modified: branches/jelte-configuration/src/lib/config/python/isc/config/module_spec.py
==============================================================================
--- branches/jelte-configuration/src/lib/config/python/isc/config/module_spec.py (original)
+++ branches/jelte-configuration/src/lib/config/python/isc/config/module_spec.py Thu Feb 18 10:38:48 2010
@@ -25,9 +25,15 @@
# import that so we can check those types
class ModuleSpecError(Exception):
+ """This exception is raised it the ModuleSpec fails to initialize
+ or if there is a failure or parse error reading the specification
+ file"""
pass
def module_spec_from_file(spec_file, check = True):
+ """Returns a ModuleSpec object defined by the file at spec_file.
+ If check is True, the contents are verified. If there is an error
+ in those contents, a ModuleSpecError is raised."""
module_spec = None
if hasattr(spec_file, 'read'):
module_spec = ast.literal_eval(spec_file.read(-1))
@@ -44,6 +50,10 @@
class ModuleSpec:
def __init__(self, module_spec, check = True):
+ """Initializes a ModuleSpec object from the specification in
+ the given module_spec (which must be a dict). If check is
+ True, the contents are verified. Raises a ModuleSpec error
+ if there is something wrong with the contents of the dict""".
if type(module_spec) != dict:
raise ModuleSpecError("module_spec is of type " + str(type(module_spec)) + ", not dict")
if check:
@@ -65,6 +75,8 @@
def get_module_name(self):
+ """Returns a string containing the name of the module as
+ specified by the specification given at __init__"""
return self._module_spec['module_name']
def get_full_spec(self):
More information about the bind10-changes
mailing list