Changeset 193

Show
Ignore:
Timestamp:
06/24/02 13:03:01 (6 years ago)
Author:
sholloway
Message:

Added _getData

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/RBFoundation/RBFoundation/XMLObjectify.py

    r186 r193  
    236236        The joinstr argument adjusts how the different lines of PCData are joined, and passing None will  
    237237        signal that the list should not be joined""" 
    238         result = [x[-1] for x in self._elements if not x[0][-1]] 
    239         if joinstr is not None: 
    240             return joinstr.join(result) 
    241         return result 
     238        return self._getData(joinstr) 
    242239     
    243240    def __str__(self): 
    244241        """Returns the PCData of the node in str format""" 
    245         return self('') 
     242        return self._getData('') 
    246243     
    247244    def __int__(self):  
    248245        """Returns the PCData of the node in int format.  Be prepared to catch exceptions in the face of incorrect data.  (Or incorrect assumptions ;) )""" 
    249         return int(self('')) 
     246        return int(self._getData('')) 
    250247 
    251248    def __long__(self):  
    252249        """Returns the PCData of the node in long format.  Be prepared to catch exceptions in the face of incorrect data.  (Or incorrect assumptions ;) ) 
    253250        Warning:  I think long type is being phased out?  Not quite sure.""" 
    254         return long(self(''))  
     251        return long(self._getData(''))  
    255252 
    256253    def __float__(self):  
    257254        """Returns the PCData of the node in float format.  Be prepared to catch exceptions in the face of incorrect data.  (Or incorrect assumptions ;) )""" 
    258         return float(self(''))  
     255        return float(self._getData(''))  
    259256 
    260257    def __complex__(self):  
    261258        """Returns the PCData of the node in complex format.  Be prepared to catch exceptions in the face of incorrect data.  (Or incorrect assumptions ;) )""" 
    262         return complex(self(''))  
     259        return complex(self._getData(''))  
    263260 
    264261    def __repr__(self): 
     
    279276            return result 
    280277        else: 
    281             return cmp(other.__class__(self('')), other) 
     278            return cmp(other.__class__(self._getData('')), other) 
    282279 
    283280    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     
    359356        self._clearData() 
    360357        self._addData(data) 
     358 
     359    def _getData(self, joinstr=''): 
     360        result = [x[-1] for x in self._elements if not x[0][-1]] 
     361        if joinstr is not None: 
     362            return joinstr.join(result) 
     363        return result 
    361364 
    362365    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~