Esempio n. 1
0
 def attachmentNode(self, attachment):
     node = self.baseNode(attachment, 'attachment')
     node.setAttribute('type', attachment.type_)
     data = attachment.data()
     if data is None:
         node.setAttribute('location', attachment.location())
     else:
         dataNode = self.textNode('data', data.encode('base64'))
         dataNode.setAttribute('extension',
                               os.path.splitext(attachment.location())[-1])
         node.appendChild(dataNode)
     for note in attachment.notes():
         node.appendChild(self.noteNode(note))
     return node
Esempio n. 2
0
 def noteImageIndex(self, attachment, which):
     if attachment.notes():
         return self.imageIndex['note'] 
     else:
         return -1