How to set the Add factory method correctly?


As I mentioned last week I am moving the ARImport functionality into an addon, and the first task is to get the existing functionality working from the addon as is. But I’m stuck at the point of constructing an instance of the ARImport content type in a client. It throws a ValueError “Product factory for ARImport was invalid”.

Digging into CMFCore.TypesTool I see the Client container dispatcher does not have the addARImport factory method for the bika.lims or senaite.arimporter product. So clearly I need to configure the addon setuphandlers to tell Client to create (or link) the addARImport. But how does one do this in Plone? BTW, I have added ARImport to Client’s allow_content_types in s.arimporter’s setuphandler. I also set the factory property in ARImport.xml to point to the local definition of ARImport in the content directory.

Any and all pointers are welcome :slight_smile:

Thanks @lunga for finding my issue. In the ARImport content definition module, I was registering the ARImport class in senaite.core instead of senaite.arimporter.