collective / Products.PloneKeywordManager

Change, merge and delete keywords (AKA tags or subjects) in Plone.
https://pypi.org/project/Products.PloneKeywordManager/
4 stars 8 forks source link

not compatible with Dexterity-based content types #1

Closed hvelarde closed 11 years ago

hvelarde commented 12 years ago

when running on top of a Dexterity-based content type I've got this error message on merging keywords:

Traceback (innermost last):
  Module ZPublisher.Publish, line 126, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 46, in call_object
  Module Products.CMFFormController.FSControllerPageTemplate, line 91, in __call__
  Module Products.CMFFormController.BaseControllerPageTemplate, line 28, in _call
  Module Products.CMFFormController.ControllerBase, line 231, in getNext
  Module Products.CMFFormController.Actions.TraverseTo, line 38, in __call__
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 46, in call_object
  Module Products.CMFFormController.FSControllerPythonScript, line 105, in __call__
  Module Products.CMFFormController.Script, line 145, in __call__
  Module Products.CMFCore.FSPythonScript, line 127, in __call__
  Module Shared.DC.Scripts.Bindings, line 322, in __call__
  Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
  Module Products.PythonScripts.PythonScript, line 344, in _exec
  Module script, line 5, in prefs_keywords_action_change
   - <FSControllerPythonScript at /Plone/prefs_keywords_action_change>
   - Line 5
  Module Products.PloneKeywordManager.tool, line 86, in change
  Module Products.PloneKeywordManager.tool, line 233, in getSetter
AttributeError: getField
do3cc commented 11 years ago

Are you sure, this is not a problem with your content types? We use 1.9 with no issues

hvelarde commented 11 years ago

then it could be not compatible with Dexterity; I will test it and change the title of the issue...

leorochael commented 11 years ago

Problem is at this method::

     def getSetter(self, obj, indexName):
         """Gets the setter function for the field based on the index name.

         Returns None if it can't get the function
         """
         fieldName = self.fieldNameForIndex(indexName)
         fieldObj = obj.getField(fieldName) or obj.getField(fieldName.lower())
         if fieldObj is not None:
             return fieldObj.getMutator(obj)

         return None

It assumes the existence of a .getField() method, which is only present in Archetypes based types.

hvelarde commented 11 years ago

fixed in #4