On Dec 16, 2008, at 4:59 AM, Dylan Jay wrote:

-----Original Message-----
From: Rob Miller [mailto:[email protected]]

Hi Rob,

Thanks for your time answering. I think I didn't make it clear enough
however...

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.

Thanks, I never knew that about Folderish.

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,

It does have to do with the code above.

membershipTool = getToolByName(self.context,'portal_membership')
member = membershipTool.getMemberById(userId)
member.setMemberProperties(newprops)

This is the code I had originally and what I'd expect to work.
MembershipTool is PlonePAS.memberdata which in turn calls
sheet.setProperty(user, k, v) on the propertysheets got from PAS.

That in turn calls membrane.factories.properties.setPropertiesForUsers
Which then calls
                   mutator = field.getMutator(self.context)
                   if mutator is not None: # skip ComputedFields
                       mutator(value)

my apologies. i was thinking of the remember case, where getMemberById actually returns a Member object (which is a full AT content object) instead of a PlonePAS MemberData object. in the remember case, setMemberProperties is a method directly on the Member object and the property adapters don't get invoked during the call.

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

No not using remember.

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.

Nope. See the above cope snippets. Perhaps its changed in the latest
version. I'm using a 1.1b3 to keep compatible with plone2.5

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.

It gets indexed during normal editing. Just not via memberdatatool ie via
PAS.

yup. sounds like you've sussed the problem out pretty clearly. how about writing a failing test, then fixing the code so that the test no longer fails, and then committing that whole mess back to the collective so other folks won't hit the same problem in the future? ;-)

-r



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

Reply via email to