good old sc.social.like needs to be updated to work in Plone 5; it kind of works already, but I have a problem with a new feature introduced in Plone 5: the social media configlet.
Plone 5 stores some information about Twitter and Facebook accounts associated with a site in registry records using the plone
prefix: plone.facebook_app_id
, plone.facebook_username
and plone.twitter_username
.
sc.social.like stores the same information on registry records using the ISocialLikeSettings interface. so, now I have 2 records for the same piece of information that can be updated from different places and are out of sync.
in the past I have managed to hack this using an invariant on the schema, to synchronize in one way:
and the updateWidgets()
method in the configlet edit form, to synchronize on the other:
I was trying to use the same approach here, but I'm not being able to access the mentioned field widgets from the updateWidgets()
because they are on a different fieldsets on the schema (facebook
and twitter
instead of default
):
(Pdb) self.widgets.keys()
['enabled_portal_types', 'plugins_enabled', 'typebutton', 'do_not_track']
(Pdb) self.groups
[<plone.z3cform.fieldsets.group.GroupFactory object at 0x7f2c86580850>, <plone.z3cform.fieldsets.group.GroupFactory object at 0x7f2c86580c50>]
(Pdb) self.groups[0].fields.items()
[('fbaction', <Field 'fbaction'>), ('facebook_username', <Field 'facebook_username'>), ('facebook_app_id', <Field 'facebook_app_id'>), ('fbbuttons', <Field 'fbbuttons'>), ('fbshowlikes', <Field 'fbshowlikes'>)]
so, my question is actually 2:
- is this a good approach or there is a saner way to mirror/synchronize the value of 2 different registry records
- if this approach is fine, how can I change the value of a widget that is not in the default fieldset?