All pastes #976478 Raw Edit

Untitled

public text v1 · immutable
·published 2008-04-08 05:26 UTC
rendered paste body
Traceback (innermost last):
  Module ZPublisher.Publish, line 119, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 42, in call_object
  Module Products.ExternalMethod.ExternalMethod, line 231, in __call__
   - __traceback_info__: ((<Folder at /unapcict/portal_skins/custom>,), {}, None)
  Module /home/izhar/Devel/testinstance/Products/ResourcesTypes/Extensions/migrate.py, line 41, in migrate
  Module Products.contentmigration.basemigrator.walker, line 126, in go
  Module Products.contentmigration.basemigrator.walker, line 205, in migrate
MigrationError: MigrationError for obj at /unapcict/resources/ict-for-disaster-management (libraryitem -> ATResourceItem):
Traceback (most recent call last):
  File "/usr/lib/zope/lib/python/Products/contentmigration/basemigrator/walker.py", line 174, in migrate
    migrator.migrate()
  File "/usr/lib/zope/lib/python/Products/contentmigration/basemigrator/migrator.py", line 196, in migrate
    method()
  File "/usr/lib/zope/lib/python/Products/contentmigration/basemigrator/migrator.py", line 335, in migrate_withmap
    value = oldVal()
AttributeError: __call__





========== migrate.py ==============
from Products.CMFCore.utils import getToolByName
from StringIO import StringIO
from Products.contentmigration.basemigrator.walker import CatalogWalker
from Products.contentmigration.basemigrator.migrator import CMFFolderMigrator, CMFItemMigrator

class PageMigrator(CMFItemMigrator):
    walkerClass = CatalogWalker
    src_meta_type = 'libraryitem'
    src_portal_type = 'libraryitem'
    dst_meta_type = 'ATResourceItem'
    dst_portal_type = 'ATResourceItem'
    map = {
    'image':'image',
    'docauthor':'docauthor',
    'copyright':'copyright',
    'year':'year',
    'length':'length',
    'ISBN':'ISBN',
    'attachment1':'attachment1',
    'attachment2':'attachment2',
    'attachment3':'attachment3',
    'attachment4':'attachment4',
    'attachment5':'attachment5',
    'links':'links',
    'text':'text',
    }

def migrate(self):
    """Run the migration"""

    out = StringIO()
    print >> out, "Starting migration"

    portal_url = getToolByName(self, 'portal_url')
    portal = portal_url.getPortalObject()

    migrators = (PageMigrator,)

    for migrator in migrators:
        walker = migrator.walkerClass(portal, migrator)
        walker.go(out=out)
        print >> out, walker.getOutput()

    print >> out, "Migration finished"
    return out.getvalue()