dabo Commit
Revision 3470
Date: 2007-10-14 05:19:37 -0700 (Sun, 14 Oct 2007)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/3470

Changed:
U   trunk/dabo/dPref.py

Log:
Added the 'get()' method; this is simply a public interface for the 
__getattr__() method. It will return the subkey that matches the passed name, 
or, if no such key exists, it will create it and return that.

Added the FullPath property (read-only). This returns the dot-separated, 
fully-qualified path to the preference object.


Diff:
Modified: trunk/dabo/dPref.py
===================================================================
--- trunk/dabo/dPref.py 2007-10-13 23:10:02 UTC (rev 3469)
+++ trunk/dabo/dPref.py 2007-10-14 12:19:37 UTC (rev 3470)
@@ -21,7 +21,7 @@
 regularAtts = ("AutoPersist", "__base__", "__bases__", "__basicsize__", 
"__call__", 
                "__cmp__", "_deletionCache", "__dictoffset__", "__flags__", 
"__itemsize__", 
                "__members__", "__methods__", "__mro__", "__name__", 
"__subclasses__", 
-               "__weakrefoffset__", "_autoPersist", "_cache", "_cursor", 
"_cxn", 
+               "__weakrefoffset__", "_autoPersist", "_cache", "_cursor", 
"_cxn", "get",
                "_getAttributeNames", "_key", "_noneType", "_parent", 
"_persistAll", "_typeDict", "mro")
 
 
@@ -129,6 +129,13 @@
                if persist:
                        self._persist(att, val)
                self._cache[att] = val
+       
+       
+       def get(self, att):
+               """If the specified name is a subkey, it is returned. If it is 
a value, the value is 
+               returned. If it doesn't exist, a new subkey is created with 
that name.
+               """
+               return self.__getattr__(att)
                
        
        def _getKey(self):
@@ -443,9 +450,17 @@
                self._autoPersist = val
 
 
+       def _getFullPath(self):
+               return self._getKey()
+
+
        AutoPersist = property(_getAutoPersist, _setAutoPersist, None,
                        _("Do property assignments automatically save 
themselves? Default=True  (bool)"))
        
+       FullPath = property(_getFullPath, None, None,
+                       _("""The fully-qualified path to this object, 
consisting of all ancestor 
+                       names along with this name, joined by periods 
(read-only) (str)"""))
+       
 
 
                        




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/dabo-dev/[EMAIL PROTECTED]

Reply via email to