acl_users and portal_membership are out of sync
This reared its head in Plone 4.0.5 when a search on acl_users using the email attribute was still finding dictionary attributes for members ('pluginid': 'mutable_properties'...) that had been deleted as above.
users = context.acl_users.searchUsers(email='sample@email.co.uk') for user in users: userobj = context.acl_users.getUserById(user['userid'])
but userobj did not exist...
There is some relevant documentation here
And here is how to clean it up. We're not using remember or membrane but still.
In debug mode (We're using zeo)...
Solutions: #bin/plonectl server start #bin/plonectl client1 debug >>> mp = app.ploneinstance.acl_users.plugins.mutable_properties >>> mp.deleteUser('sample@email.co.uk') >>> mp.deleteUser('sample1@email.co.ukt') >>> import transaction >>> transaction.get().commit()
Even though there are still some ghost (username: Not found) entries left in acl_user portal groups dictionaries at least the .searchUser fails as expected now.