Transmogrifier Missing Parameter Error

I am running into a problem running collective transmogrifier on Plone 5.0.10. I have been using this version since it was able to run Archetypes addons. When I attempted to migrate from Archetypes to Dexterity, this error came up:

Traceback (innermost last):
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module Products.GenericSetup.tool, line 579, in manage_importAllSteps
Module Products.GenericSetup.tool, line 388, in runAllImportStepsFromProfile

  • traceback_info: profile-facultycv.migration.import:import_content
    Module Products.GenericSetup.tool, line 1469, in _runImportStepsFromContext
    Module Products.GenericSetup.tool, line 1281, in _doRunImportStep
  • traceback_info: transmogrifier
    Module collective.transmogrifier.genericsetup, line 31, in importTransmogrifier
    Module collective.transmogrifier.transmogrifier, line 65, in call
    Module collective.transmogrifier.sections.manipulator, line 29, in iter
    Module collective.transmogrifier.sections.inserter, line 23, in iter
    Module collective.transmogrifier.sections.inserter, line 23, in iter
    Module collective.transmogrifier.sections.inserter, line 23, in iter
    Module collective.jsonmigrator.blueprints.partialcommit, line 22, in iter
    Module collective.jsonmigrator.blueprints.workflowhistory, line 53, in iter
    Module transmogrify.dexterity.schemaupdater, line 138, in iter
    Module transmogrify.dexterity.serializer, line 67, in iter
    Module collective.transmogrifier.sections.manipulator, line 29, in iter
    Module collective.transmogrifier.sections.constructor, line 65, in iter
    Module Products.CMFCore.TypesTool, line 569, in _constructInstance
    Module Products.BTreeFolder2.BTreeFolder2, line 461, in _setObject
    Module zope.event, line 31, in notify
    Module zope.component.event, line 24, in dispatch
    Module zope.component._api, line 136, in subscribers
    Module zope.component.registry, line 321, in subscribers
    Module zope.interface.adapter, line 585, in subscribers
    Module zope.component.event, line 32, in objectEventNotify
    Module zope.component._api, line 136, in subscribers
    Module zope.component.registry, line 321, in subscribers
    Module zope.interface.adapter, line 585, in subscribers
    Module Products.CMFCore.CMFCatalogAware, line 262, in handleContentishEvent
    Module Products.CMFCore.CMFCatalogAware, line 188, in notifyWorkflowCreated
    Module Products.CMFCore.WorkflowTool, line 289, in notifyCreated
    Module Products.CMFCore.WorkflowTool, line 635, in _reindexWorkflowVariables
    Module Products.CMFCore.CMFCatalogAware, line 88, in reindexObject
    Module Products.CMFCore.CatalogTool, line 301, in reindexObject
    Module Products.CMFPlone.CatalogTool, line 351, in catalog_object
    Module Products.ZCatalog.ZCatalog, line 476, in catalog_object
    Module Products.ZCatalog.Catalog, line 341, in catalogObject
    Module Products.ZCatalog.Catalog, line 292, in updateMetadata
    Module Products.ZCatalog.Catalog, line 415, in recordify
    Module yc.facultycv.content.faculty, line 883, in Description
    Module yc.facultycv.content.faculty, line 886, in computeDescription
    Module , line 2, in get
    Module plone.api.validation, line 114, in wrapped
    Module , line 2, in get
    Module plone.api.validation, line 148, in wrapped
    MissingParameterError: At least one of these parameters must be supplied: userid, username.

Is there a way to get the userid to transfer over from the archetypes to dexterity content type? I was able to get it working by using the following python code for example in the implementer, however the title fields and other member fields were displaying as blank in the views:

def computeTitle(self):
    user = api.user.get_current()
    first_name = user.getProperty('first_name') or ' '
    last_name = user.getProperty('last_name') or ' '
    space = ', '
    return "%s%s%s" % (last_name, space, first_name)

I am currently trying to use the following in my code:

def computeTitle(self):
    user = api.user.get(username=self.userid)
    first_name = user.getProperty('first_name') or ' '
    last_name = user.getProperty('last_name') or ' '
    space = ', '
    return "%s%s%s" % (last_name, space, first_name)

What needs to change?

I thank you kindly for your help.

@rbrown12

There seems to be something off in Module yc.facultycv.content.faculty, line 886, in **computeDescription**.

Could you copy/paste that code please?

def computeDescription(self):
    user = api.user.get(username=self.userid)
    first_name = user.getProperty('first_name') or ' '
    last_name = user.getProperty('last_name') or ' '
    dept = user.getProperty('department') or ' '
    teachingTitle = user.getProperty('functionalTitle') or ' '
    officePhone = user.getProperty('phone') or ' '
    email = user.getProperty('email') or ' '
    space = ' '
    of = ' - '
    return "%s%s%s%s%s%s%s%s%s%s%s" % (
        first_name, space, last_name, space, teachingTitle, of, dept, of, officePhone, of, email)

That seems right.
You're passing in username, so that should not trigger that error.

I want to make sure that this the actual computeDescription.
If you add raise ValueError('hello') just before user = api.user.get(username=self.userid) in computeDescription, what happens?

This is the error I get:

Traceback (innermost last):

Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module Products.GenericSetup.tool, line 579, in manage_importAllSteps
Module Products.GenericSetup.tool, line 388, in runAllImportStepsFromProfile
__traceback_info__: profile-facultycv.migration.import:import_content
Module Products.GenericSetup.tool, line 1469, in _runImportStepsFromContext
Module Products.GenericSetup.tool, line 1281, in _doRunImportStep
__traceback_info__: transmogrifier
Module collective.transmogrifier.genericsetup, line 31, in importTransmogrifier
Module collective.transmogrifier.transmogrifier, line 65, in __call__
Module collective.transmogrifier.sections.manipulator, line 29, in __iter__
Module collective.transmogrifier.sections.inserter, line 23, in __iter__
Module collective.transmogrifier.sections.inserter, line 23, in __iter__
Module collective.transmogrifier.sections.inserter, line 23, in __iter__
Module collective.jsonmigrator.blueprints.partialcommit, line 22, in __iter__
Module collective.jsonmigrator.blueprints.workflowhistory, line 53, in __iter__
Module transmogrify.dexterity.schemaupdater, line 171, in __iter__
Module zope.event, line 31, in notify
Module zope.component.event, line 24, in dispatch
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 585, in subscribers
Module zope.component.event, line 32, in objectEventNotify
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 585, in subscribers
Module plone.dexterity.content, line 774, in reindexOnModify
Module Products.CMFCore.CMFCatalogAware, line 88, in reindexObject
Module Products.CMFCore.CatalogTool, line 301, in reindexObject
Module Products.CMFPlone.CatalogTool, line 351, in catalog_object
Module Products.ZCatalog.ZCatalog, line 476, in catalog_object
Module Products.ZCatalog.Catalog, line 341, in catalogObject
Module Products.ZCatalog.Catalog, line 292, in updateMetadata
Module Products.ZCatalog.Catalog, line 415, in recordify
Module yc.facultycv.content.faculty, line 883, in Description
Module yc.facultycv.content.faculty, line 886, in computeDescription

ValueError: hello

So it is the right method, thanks!
I'm sorry, but it all seems a-ok. I don't see what is wrong here.
If you now remove the raise ValueError, what happens?

I'm wondering if you changed computeDescription to use username=blah, but didn't restart the instance by accident.

I got a different error:

Traceback (innermost last):
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module Products.GenericSetup.tool, line 579, in manage_importAllSteps
Module Products.GenericSetup.tool, line 388, in runAllImportStepsFromProfile

  • traceback_info: profile-facultycv.migration.import:import_content
    Module Products.GenericSetup.tool, line 1469, in _runImportStepsFromContext
    Module Products.GenericSetup.tool, line 1281, in _doRunImportStep
  • traceback_info: transmogrifier
    Module collective.transmogrifier.genericsetup, line 31, in importTransmogrifier
    Module collective.transmogrifier.transmogrifier, line 65, in call
    Module collective.transmogrifier.sections.manipulator, line 29, in iter
    Module collective.transmogrifier.sections.inserter, line 23, in iter
    Module collective.transmogrifier.sections.inserter, line 23, in iter
    Module collective.transmogrifier.sections.inserter, line 23, in iter
    Module collective.jsonmigrator.blueprints.partialcommit, line 22, in iter
    Module collective.jsonmigrator.blueprints.workflowhistory, line 53, in iter
    Module transmogrify.dexterity.schemaupdater, line 138, in iter
    Module transmogrify.dexterity.serializer, line 67, in iter
    Module collective.transmogrifier.sections.manipulator, line 29, in iter
    Module collective.transmogrifier.sections.constructor, line 65, in iter
    Module Products.CMFCore.TypesTool, line 569, in _constructInstance
    Module Products.BTreeFolder2.BTreeFolder2, line 461, in _setObject
    Module zope.event, line 31, in notify
    Module zope.component.event, line 24, in dispatch
    Module zope.component._api, line 136, in subscribers
    Module zope.component.registry, line 321, in subscribers
    Module zope.interface.adapter, line 585, in subscribers
    Module zope.component.event, line 32, in objectEventNotify
    Module zope.component._api, line 136, in subscribers
    Module zope.component.registry, line 321, in subscribers
    Module zope.interface.adapter, line 585, in subscribers
    Module Products.CMFCore.CMFCatalogAware, line 262, in handleContentishEvent
    Module Products.CMFCore.CMFCatalogAware, line 188, in notifyWorkflowCreated
    Module Products.CMFCore.WorkflowTool, line 289, in notifyCreated
    Module Products.CMFCore.WorkflowTool, line 635, in _reindexWorkflowVariables
    Module Products.CMFCore.CMFCatalogAware, line 88, in reindexObject
    Module Products.CMFCore.CatalogTool, line 301, in reindexObject
    Module Products.CMFPlone.CatalogTool, line 351, in catalog_object
    Module Products.ZCatalog.ZCatalog, line 476, in catalog_object
    Module Products.ZCatalog.Catalog, line 341, in catalogObject
    Module Products.ZCatalog.Catalog, line 292, in updateMetadata
    Module Products.ZCatalog.Catalog, line 415, in recordify
    Module yc.facultycv.content.faculty, line 883, in Description
    Module yc.facultycv.content.faculty, line 887, in computeDescription
    AttributeError: 'NoneType' object has no attribute 'getProperty'

That means that user is None, from user = api.user.get(username=self.userid).

I'm guessing that either self.userid is a non-existing username, or that you need to use userid instead of username: https://docs.plone.org/develop/plone.api/docs/api/user.html#plone.api.user.get

Thanks for your help.

Did we solve the problem?