def duplicate(self): # duplicate the attachment attachment = Attachment() attachment._key_name = self.tgt_key attachment.put() #duplicate the file parts for blobpart in self.blobparts: new_blobpart = BlobPart(parent=attachment) new_blobpart.blobEntity = attachment new_blobpart.content = blobpart.content new_blobpart.partNo = blobpart.partNo new_blobpart.put()
def get(self): # Get attachment from datastore self.attachment = Attachment().get_by_key_name(self.src_key) #self.blobpart = self.attachment.blobParts.get() #This above way does not get all attachments. self.blobparts = BlobPart.all().filter('blobEntity =', self.attachment).run()