commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r9948 - trunk/gnue-common/src/base


From: reinhard
Subject: [gnue] r9948 - trunk/gnue-common/src/base
Date: Thu, 8 Oct 2009 17:14:13 -0500 (CDT)

Author: reinhard
Date: 2009-10-08 17:14:12 -0500 (Thu, 08 Oct 2009)
New Revision: 9948

Modified:
   trunk/gnue-common/src/base/tree.py
Log:
Only store explicitly set attributes to be able to distinguish between
explicitly set attributes and attributes still carrying the default value.


Modified: trunk/gnue-common/src/base/tree.py
===================================================================
--- trunk/gnue-common/src/base/tree.py  2009-10-08 21:13:55 UTC (rev 9947)
+++ trunk/gnue-common/src/base/tree.py  2009-10-08 22:14:12 UTC (rev 9948)
@@ -758,13 +758,11 @@
         #: Attributes
         self.__attribs = {}
 
-        for (attrib, definition) in self._node_attribs_.items():
-            self.__attribs[attrib] = definition.get('default')
-
         # Set name attribute first so the object already has a nice string
         # representation in case setting any of the other attributes causes an
         # exception.
-        self.name = name
+        if name is not None:
+            self.name = name
 
         for (attrib, value) in kwargs.items():
             self.__set_attrib__(attrib, value)
@@ -817,11 +815,13 @@
         if not self._node_attribs_.has_key(name):
             raise AttributeError(name)
 
-        value = self.__attribs[name]
+        definition = self._node_attribs_[name]
 
+        value = self.__attribs.get(name, definition.get('default'))
+
         # If this is a reference to another node, look for it in the parent's
         # node dictionary
-        target_type = self._node_attribs_[name]['type']
+        target_type = definition['type']
         if issubclass(target_type, NamedNode):
             return self.__root__.__get_node_dict__(target_type)[value]
         else:





reply via email to

[Prev in Thread] Current Thread [Next in Thread]