Set UID for Dexterity Type

When using collective.disqus in Plone, Disqus API by default looks for UID to identify the posts (comments). For the case to manually migrate Archetypes items, I need to set UID property for Dexterity items. Here is how it works:

$ bin/plonectl debug

>>> from plone.uuid.interfaces import IUUID
>>> IUUID(app.mysite.myfolder['a-sample-item'])
>>> from plone.uuid.interfaces import ATTRIBUTE_NAME
>>> setattr(app.mysite.myfolder['a-sample-item'], ATTRIBUTE_NAME, 'bc8a2fac032e4ae39c700730ac79df8f')
>>> IUUID(app.mysite.myfolder['a-sample-item'])
>>> import transaction
>>> transaction.commit()

Of course, transmogrifer would be more decent way for such case.

No comments: