Changeset 2911

Show
Ignore:
Timestamp:
03/14/07 08:35:41 (2 years ago)
Author:
ed
Message:

Removed the BaseClassDisplay? property, as I hadn't intended on committing that version. Instead, I've implemented a repr() function that will give a more readable version of an object for displaying to the user.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dabo/dObject.py

    r2910 r2911  
    3434 
    3535    def __init__(self, properties=None, *args, **kwargs): 
    36         self._baseClassDisplay = None 
    3736        self._properties = {} 
    3837        if self._call_beforeInit: 
     
    7271 
    7372    def __repr__(self): 
    74         classname = self._getBaseClassDisplay() 
     73        bc = self.BaseClass 
     74        if bc is None: 
     75            bc = self.__class__ 
     76        strval = "%s" % bc 
     77        classname = strval.split("'")[1] 
    7578        try: 
    7679            ret = "%s (%s)" % (self.Name, classname) 
     
    7881            ret = classname 
    7982        return ret 
    80          
    81          
     83 
     84 
    8285    def beforeInit(self, *args, **kwargs): 
    8386        """ Subclass hook. Called before the object is fully instantiated. 
     
    228231 
    229232         
    230     def _getBaseClassDisplay(self): 
    231         """If the underlying _baseClassDisplay attribute is not set,  
    232         parse the string representation of the BaseClass to get the 
    233         appropriate string. 
    234         """ 
    235         if self._baseClassDisplay is None: 
    236             bc = self.BaseClass 
    237             if bc is None: 
    238                 bc = self.__class__ 
    239             strval = "%s" % bc 
    240             self._baseClassDisplay = strval.split("'")[1] 
    241         return self._baseClassDisplay 
    242  
    243          
    244233    def _getBasePrefKey(self): 
    245234        try: 
     
    336325            _("The base Dabo class of the object. Read-only.  (class)")) 
    337326     
    338     BaseClassDisplay = property(_getBaseClassDisplay, None, None,  
    339             _("The human-readable string representing the BaseClass. Read-only.  (str)")) 
    340      
    341327    BasePrefKey = property(_getBasePrefKey, _setBasePrefKey, None, 
    342328            _("Base key used when saving/restoring preferences  (str)"))