[Product-Developers] PlonePAS.utils.[de]cleanId ?

Maurits van Rees m.van.rees at zestsoftware.nl
Mon Feb 10 17:18:17 UTC 2014


Roel Bruggink schreef op 06-02-14 15:47:
> Does anyone know why PlonePAS.utils.[de]cleanId still exists? aka, can I
> go and delete these?
>
> portal_membership's getPersonalPortrait uses this, but this makes
> getting the portrait for users with a '-' in the userid impossible.
> The _getSafeMemberId method calls cleanId and that replaces '-' with
> '--'. Thus the key used for the portal_membership.portraits storage is
> now different.
>
> See
> https://github.com/plone/Products.PlonePAS/blob/master/Products/PlonePAS/tools/membership.py#L445

I did some changes there, around a year ago:
https://github.com/plone/Products.PlonePAS/commit/5112d757ec3c2c6f83b99e5b0c0e37c309d8bdd8

It includes added tests which should help clarify how to use this in the 
face of corner cases.  Note that with a user id of 'bob-jones', the 
portrait will have an id of 'bob--jones' with two dashes.

I would be surprised if (de)cleanId could be removed without breaking 
those tests.

If your use case is not handled properly, maybe you can add a failing 
test here and we can see what best to do about it.

Best,

-- 
Maurits van Rees: http://maurits.vanrees.org/
Zest Software: http://zestsoftware.nl



More information about the Product-Developers mailing list