[Setup] AT + mimetype related 2.0_final to 2.1.2 migration faliure

Daniel Dekany ddekany at freemail.hu
Mon Feb 13 05:35:44 UTC 2006


I'm trying to migrate a Plone site that uses some simple custom AT
based types, from 2.0_final to 2.1.2. I don't know Zope/Plone, and I
will look into how this AT thing works... but until that, you may
interested in this issue as something that might can be improved in
the migration stuff, or on the migration Web page. And, you might as
well tell me what to do... OK, that's was why I'm really writing. ;)

According to the feedback that I get in ZMI, upgrading to 2.0.5 is
successful, but then migration to 2.1 fails because:

File "/home/zope/instance1/Products/MimetypesRegistry/MimeTypesRegistry.py", line 447,
in split raise MimeTypeException('Malformed MIME type (%s)' % name)
MimeTypeException: Malformed MIME type (<MimeTypeItem instance at 4469ee30>)

(See the full trace at the end of the mail.)

Tracking it a bit back, AT Field tries to convert a filed value to
"text/plain", so it calls BaseUnit.transform(value, ...), and
value.mimetype is MimeTypeItem, while the programmer has expected it
to be string. It's converted to string automatically at a point
("<MimeTypeItem instance at 4469ee30>"), and hence "split" will see it
as a malformed MIME type name.


Looking into the event.log, a lot of "problem"-s are reported *before*
the "Starting the migration from version: 2.0-final" message, that is
before the real migration has started. These errors are all thrown
here in AT/BaseUnit:

    def update(self, data, instance, **kw):
        #Convert from str to unicode as needed
        mimetype = kw.get('mimetype', None)
        filename = kw.get('filename', None)
        encoding = kw.get('encoding', None)
        context  = kw.get('context', instance)

        adapter = getToolByName(context, 'mimetypes_registry')
        if not IMimetypesRegistry.isImplementedBy(adapter):
            raise RuntimeError, \
                '%s(%s) is not a valid mimetype registry: %s(%s)' % \
                (repr(adapter), adapter.__class__, repr(instance), aq_parent(instance))

This above error is thrown for a lot (all?) of the custom AT based
objects. They were working fine with AT 1.2.5-rc4 + Plone 2.0_final.

That's for now. Now some part copy-pased from the event.log:

This is what occurs a lot before the the real migration starts (the
path and type of the object varies of course, but it's always a custom
AT type):

------
2006-02-12T12:42:13 ERROR(200) ZCatalog Recataloging object at /epites/leirasok/epulet/energiagazdalkodas/elektromos_aramtermeles failed
Traceback (most recent call last):
  File "/home/zope/zope/lib/python/Products/ZCatalog/ZCatalog.py", line 287, in refreshCatalog
    self.catalog_object(obj, p)
  File "/home/zope/instance1/Products/CMFPlone/CatalogTool.py", line 412, in catalog_object
    ZCatalog.catalog_object(self, w, uid, idxs, update_metadata)
  File "/home/zope/zope/lib/python/Products/ZCatalog/ZCatalog.py", line 528, in catalog_object
    update_metadata=update_metadata)
  File "/home/zope/zope/lib/python/Products/ZCatalog/Catalog.py", line 360, in catalogObject
    index = self.updateMetadata(object, uid)
  File "/home/zope/zope/lib/python/Products/ZCatalog/Catalog.py", line 298, in updateMetadata
    newDataRecord = self.recordify(object)
  File "/home/zope/zope/lib/python/Products/ZCatalog/Catalog.py", line 436, in recordify
    attr=getattr(object, x, MV)
  File "/home/zope/instance1/Products/CMFPlone/CatalogTool.py", line 88, in __getattr__
    return registry[name](obj, portal=self._portal, vars=vars, **kwargs)
  File "/home/zope/instance1/Products/CMFPlone/CatalogTool.py", line 179, in getObjSize
    size = obj.get_size()
  File "/home/zope/instance1/Products/Archetypes/BaseObject.py", line 569, in get_size
    size+=field.get_size(self)
  File "/home/zope/instance1/Products/Archetypes/Field.py", line 1275, in get_size
    return len(self.getBaseUnit(instance))
  File "/home/zope/instance1/Products/Archetypes/Field.py", line 1269, in getBaseUnit
    return self.get(instance, raw=True)
  File "/home/zope/instance1/Products/Archetypes/Field.py", line 1242, in get
    value = self._wrapValue(instance, value)
  File "/home/zope/instance1/Products/Archetypes/Field.py", line 997, in _wrapValue
    file=value, instance=instance)
  File "/home/zope/instance1/Products/Archetypes/Field.py", line 1130, in _make_file
    return self.content_class(id, file=file, instance=instance)
  File "/home/zope/instance1/Products/Archetypes/BaseUnit.py", line 33, in __init__
    self.update(file, instance, **kw)
  File "/home/zope/instance1/Products/Archetypes/BaseUnit.py", line 52, in update
    raise RuntimeError, \
RuntimeError: <MimeTypesTool instance at 4214b620>(<extension class
Products.PortalTransforms.zope.MimeTypesTool.MimeTypesTool at 41b28980>)
is not a valid mimetype registry:
<FenntarthatoCikk at /epites/leirasok/epulet/energiagazdalkodas/elektromos_aramtermeles>(<PloneFolder
instance at 431312f0>)
------

This is how the migration fails at the end, after updating up to 2.0.5
was successfully done:

------
2006-02-12T13:06:44 INFO(0) Plone 
Attempting to upgrade from: 2.0.5
------
2006-02-12T13:06:44 ERROR(200) Plone 
Upgrade aborted
------
2006-02-12T13:06:44 ERROR(200) Plone 
Error type: Products.ATContentTypes.migration.walker.MigrationError
------
2006-02-12T13:06:44 ERROR(200) Plone
Error value: MigrationError for obj at /epites/oldaloldal (CMF Folder -> Folder):
Traceback (most recent call last):
  File "/home/zope/instance1/Products/ATContentTypes/migration/walker.py", line 174, in migrate
    migrator.migrate()
  File "/home/zope/instance1/Products/ATContentTypes/migration/migrator.py", line 196, in migrate
    method()
  File "/home/zope/instance1/Products/ATContentTypes/migration/migrator.py", line 517, in migrate_children
    self.new._setObject(id, obj, set_owner=0)
  File "/home/zope/zope/lib/python/OFS/ObjectManager.py", line 276, in _setObject
    object.manage_afterAdd(object, self)
  File "/home/zope/instance1/Products/CMFCore/CMFCatalogAware.py", line 199, in manage_afterAdd
    self.__recurse('manage_afterAdd', item, container)
  File "/home/zope/instance1/Products/CMFCore/CMFCatalogAware.py", line 235, in __recurse
    getattr(ob, name)(*args)
  File "/home/zope/instance1/Products/CMFCore/CMFCatalogAware.py", line 199, in manage_afterAdd
    self.__recurse('manage_afterAdd', item, container)
  File "/home/zope/instance1/Products/CMFCore/CMFCatalogAware.py", line 235, in __recurse
    getattr(ob, name)(*args)
  File "/home/zope/instance1/Products/Archetypes/BaseContent.py", line 38, in manage_afterAdd
    CatalogMultiplex.manage_afterAdd(self, item, container)
  File "/home/zope/instance1/Products/CMFCore/CMFCatalogAware.py", line 198, in manage_afterAdd
    self.indexObject()
  File "/home/zope/instance1/Products/Archetypes/CatalogMultiplex.py", line 26, in indexObject
    c.catalog_object(self, url)
  File "/home/zope/instance1/Products/CMFPlone/CatalogTool.py", line 412, in catalog_object
    ZCatalog.catalog_object(self, w, uid, idxs, update_metadata)
  File "/home/zope/zope/lib/python/Products/ZCatalog/ZCatalog.py", line 528, in catalog_object
    update_metadata=update_metadata)
  File "/home/zope/zope/lib/python/Products/ZCatalog/Catalog.py", line 381, in catalogObject
    blah = x.index_object(index, object, threshold)
  File "/home/zope/zope/lib/python/Products/ZCTextIndex/ZCTextIndex.py", line 175, in index_object
    text = text()
  File "/home/zope/instance1/Products/Archetypes/BaseObject.py", line 519, in SearchableText
    datum =  method(mimetype="text/plain")
  File "/home/zope/instance1/Products/Archetypes/ClassGen.py", line 58, in generatedAccessor
    return schema[name].get(self, **kw)
  File "/home/zope/instance1/Products/Archetypes/Field.py", line 1259, in get
    encoding=kwargs.get('encoding',None))
  File "/home/zope/instance1/Products/Archetypes/BaseUnit.py", line 103, in transform
    filename=self.filename)
  File "/home/zope/instance1/Products/PortalTransforms/TransformEngine.py", line 150, in convertTo
    filename=kwargs.get('filename'))
  File "/home/zope/instance1/Products/MimetypesRegistry/MimeTypesRegistry.py", line 307, in classify
    mt = self.lookup(mimetype)
  File "/home/zope/instance1/Products/MimetypesRegistry/MimeTypesRegistry.py", line 222, in lookup
    major, minor = split(str(mimetypestring))
  File "/home/zope/instance1/Products/MimetypesRegistry/MimeTypesRegistry.py", line 447, in split
    raise MimeTypeException('Malformed MIME type (%s)' % name)
MimeTypeException: Malformed MIME type (<MimeTypeItem instance at 4469ee30>)
------

-- 
Best regards,
 Daniel Dekany




More information about the Setup mailing list