Hi,

I'm working on incorporating some additions to the SQLPASPlugin that we're using here, which allow it to work with plain PAS, and also provide generic setup support etc...

There's one item that is preventing this from working "as planned": the way the PropertyProvider plugin returns a property sheet rather than just a dict of data (plain PAS explicitly requires the plugin to return a dict).

I think this can be avoided if the sheet type is determined in the userfactory plugin (PlonePAS/plugins/ufactory.py) rather than directly in the plugin. The following (untested) is the simplest change I can see that would preserve BBB whilst allowing the original PAS interface to be obeyed:

    def addPropertysheet(self, id, data):
        """ -> add a prop sheet, given data which is either
        a property sheet or a raw mapping.
        """
X       plugin = getattr( self.acl_users, id )

        if IPropertySheet.providedBy(data):
            sheet = data
X       elif IMutablePropertiesManager.providedBy(plugin):
X           isGroup = getattr(user, 'isGroup', lambda: None)()
X           schema = None
X           if hasattr(plugin, '_getSchema'):
X              schema = plugin._getSchema(isGroup)
X           if not schema:
X              schema = None
X           sheet = MutablePropertySheet(id, schema, **data)
        else:
            sheet = UserPropertySheet(id, **data)

        if self._propertysheets.get(id) is not None:
            raise KeyError, 'Duplicate property sheet: %s' % id

        self._propertysheets[id] = sheet

Does this seem like a reasonable change? I'd like to get some comments from anyone who knows more about PAS plugins than me, before I devote additional time to it.

Thanks,

Miles



_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to