Changeset 193
- Timestamp:
- 06/24/02 13:03:01 (6 years ago)
- Files:
-
- trunk/RBFoundation/RBFoundation/XMLObjectify.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBFoundation/RBFoundation/XMLObjectify.py
r186 r193 236 236 The joinstr argument adjusts how the different lines of PCData are joined, and passing None will 237 237 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) 242 239 243 240 def __str__(self): 244 241 """Returns the PCData of the node in str format""" 245 return self ('')242 return self._getData('') 246 243 247 244 def __int__(self): 248 245 """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('')) 250 247 251 248 def __long__(self): 252 249 """Returns the PCData of the node in long format. Be prepared to catch exceptions in the face of incorrect data. (Or incorrect assumptions ;) ) 253 250 Warning: I think long type is being phased out? Not quite sure.""" 254 return long(self (''))251 return long(self._getData('')) 255 252 256 253 def __float__(self): 257 254 """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('')) 259 256 260 257 def __complex__(self): 261 258 """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('')) 263 260 264 261 def __repr__(self): … … 279 276 return result 280 277 else: 281 return cmp(other.__class__(self ('')), other)278 return cmp(other.__class__(self._getData('')), other) 282 279 283 280 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 359 356 self._clearData() 360 357 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 361 364 362 365 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
