Changeset 468
- Timestamp:
- 03/05/03 18:08:53 (6 years ago)
- Files:
-
- trunk/RBFoundation/RBFoundation/DateUtils.py (added)
- trunk/RBFoundation/RBFoundation/Utilities.py (modified) (1 diff)
- trunk/RBFoundation/RBFoundation/XMLNode.py (modified) (2 diffs)
- trunk/RBTelepathy/RBTelepathy/Packet/URIAddress.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/RBFoundation/RBFoundation/Utilities.py
r290 r468 61 61 return cleanupstrlst(data.split(splitchar), *args, **kw) 62 62 63 #~ iso formated time information ~~~~~~~~~~~~~~~~~~~~ 64 65 def fromisoformat(strtime, sectionsep='T', datesep='-', timesep=':'): 66 """ISO 8601 format, YYYY-MM-DDTHH:MM:SS 67 returns (YYYY, MM, DD, HH, MM, SS, -1, -1, -1) 68 compatible with time module's mktime method.""" 69 datesent, timesent = strtime.split(sectionsep)[:2] 70 datesent = map(int, datesent.split(datesep)[:3]) 71 timesent = map(int, timesent.split(timesep)[:3]) 72 return tuple(datesent + timesent + (-1,-1,-1)) 73 74 def fromisoformat_date(strtime, datesep='-'): 75 """ISO 8601 format, YYYY-MM-DDTHH:MM:SS 76 returns (YYYY, MM, DD)""" 77 datesent = map(int, datesent.split(datesep)[:3]) 78 return tuple(datesent) 79 80 def fromisoformat_time(strtime, timesep=':'): 81 """ISO 8601 format, YYYY-MM-DDTHH:MM:SS 82 returns (HH, MM, SS)""" 83 timesent = map(int, timesent.split(timesep)[:3]) 84 return tuple(datesent) 63 85 64 86 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ trunk/RBFoundation/RBFoundation/XMLNode.py
r459 r468 237 237 return self.addnode(*elem) 238 238 239 def insertelem(self, idx, elem): 240 if isinstance(elem, basestring): 241 return self.insertdata(elem) 242 elif isinstance(elem, xmlnodebase): 243 # For elements that are prebuilt 244 self.elems.insert(idx, elem) 245 return elem 246 else: 247 # For building from tuples and lists 248 return self.insertnode(*elem) 249 239 250 def setxmlns(self, *args, **kw): 240 251 return self.namespaces.setxmlns(*args, **kw) … … 273 284 for idx in dellist: 274 285 del self.elems[idx] 286 287 def data(self, joinstr=''): 288 return joinstr.join(map(type(joinstr), self.iterdata(None))) 275 289 276 290 def hasdata(self, *args, **kw): trunk/RBTelepathy/RBTelepathy/Packet/URIAddress.py
r442 r468 50 50 """ 51 51 52 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 53 #~ Special 54 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 55 56 def __cmp__(self, other): 57 return cmp(self.astuple(), other.astuple()) 58 59 def astuple(self): 60 return (self.scheme, self.network, self.acount, self.path, self.query, self.fragment) 61 62 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 63 #~ Protected Methods 64 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 65 52 66 def _getAuthority(self): 53 67 if self.network is not None:
