def _get_object(self, elt): ## TODO optimize using self._object_cache or new API for ## passing on objects in the tree type = elt.attrib.get('type') if elt.tag == OBJECT and type: return ObjectManager.get_object(type, elt.attrib, elt.text) else: return None
def _get_object(self, elt): ## TODO optimize using self._object_cache or new API for ## passing on objects in the tree type = elt.attrib.get('type') if elt.tag == OBJECT and type: return ObjectManager.get_object(type, elt.attrib, elt.text) else: return None
def dump_object(self, tag, attrib, strings=None): '''Dumps object using proper ObjectManager''' format = str(self.__class__.__module__).split('.')[-1] if 'type' in attrib: obj = ObjectManager.get_object(attrib['type'], attrib, u''.join(strings)) output = obj.dump(format, self, self.linker) if output is not None: return [output] return self.dump_object_fallback(tag, attrib, strings)
def dump_object(self, tag, attrib, strings=None): '''Dumps object using proper ObjectManager''' format = str(self.__class__.__module__).split('.')[-1] if 'type' in attrib: obj = ObjectManager.get_object(attrib['type'], attrib, u''.join(strings)) output = obj.dump(format, self, self.linker) if output is not None: return [output] return self.dump_object_fallback(tag, attrib, strings)
def _action_handler(self, action): try: name = action.get_name()[7:] # len('insert_') = 7 obj = ObjectManager.get_object(name) try: attrib, data = obj.new_object_interactive(self.pageview) except ValueError: return # dialog cancelled self.pageview.insert_object(attrib, data) except: zim.errors.exception_handler('Exception during action: %s' % tool.name)
def dump_object(self, tag, attrib, strings=[]): '''Dumps objects defined by L{InsertedObjectType}''' format = str(self.__class__.__module__).split('.')[-1] try: obj = ObjectManager.get_object(attrib['type']) except KeyError: pass else: try: output = obj.format(format, self, attrib, ''.join(strings)) except ValueError: pass else: assert isinstance(output, list) return output return self.dump_object_fallback(tag, attrib, strings)