+# -*- coding: utf-8 -*-
+"""
+
+
+Script de migration du stockage du fichier depuis l'attribut 'data'
+vers l'attribut de type blob 'bdata'.
+IMPORTANT :
+les lignes 144 à 147 de blobbases.py doivent être commentéés
+avant exécution.
+
+147 | # data = property(_getLegacyData, _setLegacyData,
+148 | # "Data Legacy attribute to ensure compatibility "
+149 | # "with derived classes that access data by this way.")
+
+"""
+
+from ZODB.blob import Blob
+
+def migrate(self) :
+ if hasattr(self.aq_base, 'data') :
+ data = str(self.data)
+ self.bdata = Blob()
+ bf = self.bdata.open('w')
+ bf.write(data)
+ bf.close()
+ delattr(self, 'data')
+ return True
+ else :
+ assert hasattr(self.aq_base, 'bdata')
+ return False
+
\ No newline at end of file