eggification
[Photo.git] / Products / Photo / migration / toblob.py
1 # -*- coding: utf-8 -*-
2 """
3
4
5 Script de migration du stockage du fichier depuis l'attribut 'data'
6 vers l'attribut de type blob 'bdata'.
7 IMPORTANT :
8 les lignes 144 à 147 de blobbases.py doivent être commentéés
9 avant exécution.
10
11 147 | # data = property(_getLegacyData, _setLegacyData,
12 148 | # "Data Legacy attribute to ensure compatibility "
13 149 | # "with derived classes that access data by this way.")
14
15 """
16
17 from ZODB.blob import Blob
18
19 def migrate(self) :
20 if hasattr(self.aq_base, 'data') :
21 data = str(self.data)
22 self.bdata = Blob()
23 bf = self.bdata.open('w')
24 bf.write(data)
25 bf.close()
26 delattr(self, 'data')
27 return True
28 else :
29 assert hasattr(self.aq_base, 'bdata')
30 return False
31