Thank you for your replies.
On Mon, Oct 5, 2009 at 1:15 PM, Martin Aspeli <
[hidden email]> wrote:
> Vincent Fretin wrote:
>> Hello,
>>
>> The optimization fix introduced in Products.PlonePAS 3.10 (Plone
>> 3.3.1) broke completely my products.
>
> That is a problem, probably enough to revert that fix, unless your
> products were doing something insane.
>
> Can you elaborate on what your product does?
Well I use context.get_local_roles() to retrieve a list of principals
(it can be a username or groupname)
then I need to retrieve properties from the user or group, so I use
getToolByName(self, 'portal_membership').getMemberById
and if this return None, then I try
getGroupById = getToolByName(self, 'portal_groups').getGroupById
>
>> The changelog entry is the following:
>> - Performance fix for searching in the mutable properties plugin:
>> when only searching on user id do not walk over all properties,
>> but only test if the user id is known. This fixes
>>
http://dev.plone.org/old/plone/ticket/9361>
> s/old//
I'll modify it.
>
>> [toutpt]
>
> That bug seems important to fix, though, if the benchmarks are to be
> believed!
>
>> The thing is that when you try to do
>> portal_membership.getMemberById("agroupid")
>
> Is this really kosher? I think you should use portal_groups instead, or
> just acl_users.getGroupById(). I'm not sure getMemberById() is meant to
> work on group principals.
I know. See the above note of my use case.
> I'd guess that the results of "undefined". What actually calls this, and
> why should it return None?
I think it should return empty tuple because we are in a User
enumeration plugin and not a Group Enumeration plugin.
>
>> which iterate on all IUserEnumerationPlugin (source_users and
>> mutable_properties)
>> source_users return nothing, that's fine
>> mutable_properties returns the properties of the group! We don't want
>> that! It should return nothing like in the PlonePAS 3.9.
>
> Mmm.... why? If there are properties, shouldn't we get the results?
Well you're right, this plugin should return properties for user or
group matching criteria from kw parameter, like before.
And return () if you do a search by id or login, like before.
>
> Bear in mind that at this point, you're deep enough into PAS to be
> dealing in "principals", not "users" and "groups" as separate entities.
Well, you have a differentiation in PAS, you have User and Group
Enumeration plugin.
but mutable_properties is special, the storage contains users and
groups properties.
>
>> But there is another thing that bother me, in PlonePAS 3.9 the
>> enumerationUsers function in plugins/property.py (mutable_properties)
>> will always return nothing, because
>> data dictionary doesn't contain an id key, so testMemberData will
>> return False right away for each principal in the storage.
>
> Always returning None definitely sounds like a bug. :)
Actually this plugin is only useful in Plone user search form. If you
search 'vincent' in the form, you get the following parameters:
id = None
login = None
exact_match = False
kw = {'fullname': 'vincent'}
Here the plugin will return something because id and login are None.
Having id and login in the criteria doesn't make sense because you
don't have thoses keys in the data dictionary and so testMemberData
will always return False.
I propose to revert the optimization fix in PlonePAS 3.10 and do the
following optimization fix:
--- /tmp/products.plonepas-3.9/Products/PlonePAS/plugins/property.py 2009-10-05
11:04:42.346879367 +0200
+++ plugins/property.py 2009-10-05 13:40:47.923638276 +0200
@@ -252,11 +252,10 @@
"""
plugin_id = self.getId()
+ if not kw:
+ return ()
+
criteria=copy.copy(kw)
- if id is not None:
- criteria["id"]=id
- if login is not None:
- criteria["login"]=login
users=[ (user,data) for (user,data) in self._storage.items()
if self.testMemberData(data, criteria, exact_match)]
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf_______________________________________________
Plone-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-developers