[Zope-CMF] how do I get a member's property?

Duane Raymond Duane.Raymond@Virgin.net
Wed, 22 May 2002 00:09:27 +0100


Thanks Alan & Marc for your suggestions.

Alan Suggested
> http://www.zopelabs.com/cookbook/1003621159

This is an excellent example of how to get ALL properties of a member - and
I will be using it for that - however I have been unable to figure out how
to adapt it for getting a single property for a specific member using the
ZPT roster.

There is probably something very small I am overlooking - how would I adapt
this code to get a specific property and not all of them?

Marc: your zexp was in DTML I believe? (I wasn't able to import it - Z2.51 +
CMF 1.2) - any suggestions for a Page Templates / TAL solution?

The code below (-> before lines I have added) I have tried with no success:

<table class="SearchResults">
 <tr>
  <td width="16"> <br>
  </td>
  <th>Member</th>
   <th tal:condition="python:
here.portal_membership.checkPermission('Manage_users',
here.Members)">Listed?</th>
   <th>Country</th>
 </tr>
<div tal:define="b_start string:0;b_start request/b_start | b_start;
       members python: here.portal_membership.getRoster();

    ->   member here/portal_membership/listMembers;

	   Batch python:modules['ZTUtils'].Batch;
	   global batch python:Batch(members, 25, int(b_start), orphan=1)">
<tr tal:repeat="members batch">

 <td> <br> </td>
  <td tal:define="id members/id; homeUrl python:
here.portal_membership.getHomeUrl(id, verifyPermission=1)">
         <a href="www.here.com"
			tal:condition="homeUrl"
	    	tal:attributes="href homeUrl"
   			tal:content="id">ID</a>
       <span tal:condition="not:homeUrl"
	         tal:replace="id">ID</span>
  </td>
  <td tal:condition="python: here.portal_membership.checkPermission(
'Manage_users', here.Members )"
      tal:define="listed members/listed">
   <span tal:replace="python: listed and 'Yes' or 'No'">Yes...Or No</span>
  </td>

->  <td tal:define="prop python:member.getProperty(country, None)">
->  <span tal:replace="prop">Country Name</span>
  </td>
</tr>

I've tried variations of this and continued to get errors - what am I
overlooking?

Thanks for your patience.

Duane

Original request:
>> I have added a 'country' property to 'portal_membership' and
>> then added a test member with a value for this property.
>> I have been able to retrieve it by making changes to the
>> DTML version of roster, but unable to figure out how to do
>> the same in the page templates version of roster.
>>
>> Can anyone give some quick help and example of how I would call this
>> 'country' property (or any other custom property I would add).