Logo Search packages:      
Sourcecode: zope-attachmentfield version File versions  Download package

def AttachmentField::FlexStorage::FlexStorage::changeFlexStorageBackend (   self,
  instance,
  newStorageName,
  typesWithAF 
)

    Change the backend used to store data. Migrate the already existing
    fields.

Definition at line 143 of file FlexStorage.py.

00143                                                                              :
        """
            Change the backend used to store data. Migrate the already existing
            fields.
        """
        aTool = getToolByName(instance, 'portal_attachment')
        if aTool.currentFlexStorageBackend == newStorageName:
            return
        oldStorage = self.getFlexStorageBackend(instance)
        aTool.currentFlexStorageBackend = newStorageName
        newStorage = self.getFlexStorageBackend(instance)

        cat = getToolByName(instance, 'portal_catalog')
        brains = cat({'portal_type': typesWithAF.keys()})
        out = StringIO.StringIO()
        for b in brains:
            o = b.getObject()
            fields = typesWithAF[o.portal_type]
            self.migrateContent(oldStorage, newStorage, o, fields, out)
            print >> out, ""

        return out.getvalue()

    security.declarePrivate('migrateContent')
    def migrateContent(self, oldStorage, newStorage, content, fieldNames, out):


Generated by  Doxygen 1.6.0   Back to index