diff --git a/themis/libellioimport/configure.zcml b/themis/libellioimport/configure.zcml index 68653c0..1b72980 100644 --- a/themis/libellioimport/configure.zcml +++ b/themis/libellioimport/configure.zcml @@ -35,4 +35,11 @@ permission="cmf.ManagePortal" /> + + diff --git a/themis/libellioimport/migration.py b/themis/libellioimport/migration.py index a6bf796..abf1cf1 100644 --- a/themis/libellioimport/migration.py +++ b/themis/libellioimport/migration.py @@ -467,3 +467,18 @@ class FixRelatedDocs(BrowserView): setattr(object, attr, [v]) +class UpdateToBlobs(BrowserView): + def __call__(self): + catalog = getToolByName(self.context, 'portal_catalog') + for brain in catalog.search({'portal_type': ['bqrD', 'bulletintravauxD'}): + object = brain.getObject() + for attr in ("fichier", "document_imprime"): + try: + v = getattr(object, attr) + except AttributeError: + continue + if v is None: + continue + print 'transforming file in', object.id + newv = NamedFile(v.data, filemane=v.filename) + setattr(object, attr, newv)