pythonploneploneformgen

How to edit the data entry saved using uwosh.pfg.d2c adapter in plone?


I have used the ploneformgen for creating the input form. When I try to edit the saved data entry using the uwosk.pfg.d2c adapter in the form using the edit tab, I get the following error:

<FSControllerPythonScript at /MySite/update_version_on_edit used for /MySite/materials-requirement/material-requirement-form/requirement-for-approval/trial>
    Line 11
    Module Products.CMFEditions.utilities, line 109, in isObjectChanged
    Module Products.CMFEditions.CopyModifyMergeRepositoryTool, line 415, in isUpToDate
    Module Products.CMFEditions.ArchivistTool, line 396, in isUpToDate
    Module Products.CMFEditions.ZVCStorageTool, line 308, in getModificationDate
    Module Products.Archetypes.ExtensibleMetadata, line 455, in modified
    Module Products.Archetypes.BaseObject, line 237, in getField
    Module Products.Archetypes.BaseObject, line 821, in Schema
    Module zope.component.hooks, line 104, in adapter_hook
    Module archetypes.schemaextender.extender, line 146, in cachingInstanceSchemaFactory
    Module archetypes.schemaextender.extender, line 186, in instanceSchemaFactory
    Module plone.memoize.instance, line 51, in memogetter
    Module uwosh.pfg.d2c.extender, line 217, in getFields
    Module uwosh.pfg.d2c.content.dataentry, line 39, in getForm
    Module uwosh.pfg.d2c.content.dataentry, line 53, in getFormAdapter
    Module Products.CMFCore.utils, line 123, in getToolByName
    AttributeError: uid_catalog

How do I fix this error.I require the steps as I use the GUI, or ZMI only. I use plone 4.1, ploneformgen 1.7.1 and d2c adapter 2.1.5


Solution

  • It looks like the product breaks in combination with CMFEditions. Try editing uwosh.pfg.d2c.content.dataentry to add an import at the top, then alter line 53 to get to the uid_catalog by a different route.

    You'll need to find the file first; search for uwosh.pfg.d2c in the bin/instance script. That'll give you the location of the egg. Within the egg, locate the file uwosh/pfg/d2c/content/dataentry.py and open it in an editor.

    To the top, with the other import statements, add the following line:

    from zope.app.component.hooks import getSite
    

    and alter line 54 (was line 53, but you added a line to the top); it currenntly reads:

    catalog = getToolByName(self, 'uid_catalog')
    

    where you change self to getSite() to make it read:

    catalog = getToolByName(getSite(), 'uid_catalog')
    

    Altering the egg in this manner is not portable; you'd have to do so for each and every installation of your site. If the above alteration works for you, please report it to the author of the package so it can be fixed in a new release.

    There currently is an issue in the package issue tracker that seems to be related, see issue 7, where you could follow up on this. Alternatively, you could file a ticket in the new GitHub issue tracker for this package.

    Yes, the package author, Nathan van Gheem, frequents Stack Overflow as well, but you should not count on him discovering the issue here. Filing an issue in the supported locations mean more people can find it and help out, too