[Zope-CMF] Where do CMF get the "Creator" variable from ?
Grégoire Weber
gregoire.weber@switzerland.org
Wed, 04 Jul 2001 00:02:47 +0200
Hi Gitte,
As I (as Newby) understood portal_membership you have to feed getMemberById
with the *id* of an object and not with a (the Creator) property of the
object. So try this (not tested):
<dtml-let created_by="portal_membership.getMemberById(id)">
<dtml-call "REQUEST.set('realname',created_by.real_name)">
</dtml-let>
I know the following works with getUserName(), so try this first if the
above does not work:
<dtml-let created_by="portal_membership.getMemberById(id)">
<dtml-call "REQUEST.set('realname',created_by.getUserName())">
</dtml-let>
If you try to get the Member of an object not created by a Member (e.g.
DTML method) getMemberById returns None.
So you probably have to check this case to avoid an AttributeError exception.
<dtml-let created_by="portal_membership.getMemberById(id)">
<dtml-if created_by>
<dtml-call "REQUEST.set('realname',created_by.real_name)">
<dtml-else>
<dtml-call "REQUEST.set('realname','n.a.')">
</dtml-if>
</dtml-let>
Hope it helps,
Greg
> <dtml-let created_by="portal_membership.getMemberById(Creator)">
> <dtml-call "REQUEST.set('realname',created_by.real_name)">
> </dtml-let>
>
> But I get this error:
> Error Type: AttributeError
> Error Value: 'None' object has no attribute 'real_name'
>
> So I guess it isn't a valid user object it returns.
_____________________________________
Grégoire Weber
mailto:gregoire.weber@switzerland.org