SF.net SVN: fclient: [214] trunk/sandbox/fcp/fcp2_0_config.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <ju...@us...> - 2008-02-16 10:06:21
|
Revision: 214
http://fclient.svn.sourceforge.net/fclient/?rev=214&view=rev
Author: jurner
Date: 2008-02-16 02:06:20 -0800 (Sat, 16 Feb 2008)
Log Message:
-----------
added logging for unknown config params
Modified Paths:
--------------
trunk/sandbox/fcp/fcp2_0_config.py
Modified: trunk/sandbox/fcp/fcp2_0_config.py
===================================================================
--- trunk/sandbox/fcp/fcp2_0_config.py 2008-02-16 10:05:34 UTC (rev 213)
+++ trunk/sandbox/fcp/fcp2_0_config.py 2008-02-16 10:06:20 UTC (rev 214)
@@ -1,6 +1,7 @@
"""Sketch for fcp config tree"""
-
+import logging
+import fcp2_0_consts as consts
import fcp2_0_types as types
#****************************************************************************************
#
@@ -67,6 +68,7 @@
self.name = None
self.children = {}
self._configMessageParams = types.ConfigMessageParams()
+ self._log = logging.getLogger(consts.LoggerNames.Config)
if configDataMsg is not None:
for key, value in configDataMsg.params.items():
@@ -93,13 +95,17 @@
"""Adds a value to an item
@param key: (str) key to add the value to (including ParamClass prefix)
@param value to associate
+ @return: (bool) True if the key has been added, False otherwise
+
@note: if the item does not exist, it is created
+ @note: if the key is unknown its type will always be set to L{types.FcpType}
"""
paramClass, components = self._configMessageParams.splitParamClass(key)
paramType = self._configMessageParams.get(key, None)
if paramType is None:
- raise ValueError('Unknown key: %r' % components)
-
+ paramType = types.FcpType
+ self._log.warning('Unknown key: %r' % components)
+
# find or create new config item if necessary
components = self._configMessageParams.splitAll(components)
parent = self
@@ -110,9 +116,9 @@
parent.children[component] = item
parent = item
parent.values[paramClass] = (value, paramType)
-
+
+
-
def removeParamClass(self, key):
"""Removes the paramClass component if necessary
@param key: (str) key to remove the param class from
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|