On Dec 15, 2008, at 7:01 PM, Dylan Jay wrote:

-----Original Message-----
From: Dylan Jay [mailto:[email protected]]
Sent: Tuesday, 16 December 2008 12:31 PM
To: [email protected]
Subject: reindex after updating member properties

Hi,

I'm updating user properties as follows
membershipTool = getToolByName(self.context, 'portal_membership')
       member = membershipTool.getMemberById(userId)
       if newprops:
           member.setMemberProperties(newprops)

The properties are being updated and indexed in the membrane catalog but
not
reindexed as normal content in portal_catalog. Anyone know if this is a
bug
or how I can workaround it?

I've managed a workaround with

           mbmember = membraneTool.getUserAuthProvider(login)
           if mbmember:
               mbmember.reindexObject()

small, unrelated nitpick... i generally try to avoid using "if some_object" when what i really mean is "if some_object is None". in Zope, folderish objects will evaluate to False if they contain no subobjects, so if you were using folderish members you might get a different result than you expect there.

but shouldn't membrane itself call reindexObject in its default properties
adaptor? (It doesn't at least in the version I'm using).

the properties adapter has nothing to do with the code above. you're retrieving and manipulating the member object, i.e. the site content, directly. if you were making calls to the _user_ object provided by acl_users, then the properties adapter would be used by the PAS plug-in.

you're using remember, right? i'm guessing so, b/c membrane doesn't provide any member objects, so there's no setMemberProperties method to call. anyway, setMemberProperties (which is just an alias for setProperties) just delegates to the update method, which is a core part of AT, and which does indeed call reindexObject upon completion. i'm not sure why that's not working for you. maybe you can step through the code to see what's going on? i'd put a pdb at L333 of member.py, where it says "self.update(**mapping)".

the first thing i'd guess is that the catalog multiplex stuff isn't set up right, that your member type is only registered with one catalog, not with both. but that wouldn't explain why it does get reindexed when you call reindexObject yourself.

-r



--
Archive: 
http://www.openplans.org/projects/remember/lists/remember/archive/2008/12/1229410881536
To unsubscribe send an email with subject "unsubscribe" to 
[email protected].  Please contact [email protected] for 
questions.

Reply via email to