Ticket #198: type_map_cache.diff
| File type_map_cache.diff, 1.1 KB (added by akaihola, 11 months ago) |
|---|
-
pyamf/__init__.py
537 537 raise TypeError, "context must be of type %s.%s" % ( 538 538 self.context_class.__module__, self.context_class.__name__) 539 539 540 def _writeElementFunc(self, data): 540 self._write_elem_func_cache = {} 541 542 def _getWriteElementFunc(self, data): 541 543 """ 542 544 Gets a function used to encode the data. 543 545 … … 565 567 566 568 return None 567 569 570 def _writeElementFunc(self, data): 571 """ 572 Gets a function used to encode the data. 573 574 @type data: C{mixed} 575 @param data: Python data. 576 @rtype: callable or C{None}. 577 @return: The function used to encode data to the stream. 578 """ 579 key = data.__class__ 580 if key not in self._write_elem_func_cache: 581 self._write_elem_func_cache[key] = self._getWriteElementFunc(data) 582 return self._write_elem_func_cache[key] 583 568 584 def writeElement(self, data): 569 585 """ 570 586 Writes the data.
