[Zope] How to get the current logged on user?

Zachary Wu zachary@combi.com.cn
Tue, 24 Sep 2002 10:45:47 +0800


I use:
mm = context.SecurityGetUser.getUserName()
print mm
return printed

Zope said:
Error Type:  AttributeError
Error Value: SecurityGetUser

---------------------------------------------------------------------


context.SecurityGetUser()

-----Original Message-----
From: Zachary Wu [mailto:zachary@combi.com.cn]
Sent: Tuesday, 24 September 2002 2:30 p.m.
To: 'Chris Beaven'; zope@zope.org
Subject: RE: [Zope] How to get the current logged on user?


And how can I use it in python script?
when I use:
us = SecurityGetUser().getUserName()
print us
return printed

teh Zope tell me "SecurityGetUser().getUserName()"
------------------------------------------------------------------------
--------------

global name 'SecurityGetUser' is not defined

Hi Zachary,

It's mentioned in The Zope Book under the Users and Security chapter.

<dtml-var expr="_.SecurityGetUser().getUserName()">

The _.SecurityGetUser() safely calls the getUser() method


-----Original Message-----
From: Zachary Wu [mailto:zachary@combi.com.cn]
Sent: Tuesday, 24 September 2002 1:34 p.m.
To: zope@zope.org
Subject: [Zope] How to get the current logged on user?


I found the function "getUser(self)" in the "Zope book", but I don't
know how to use it. There is no example to show :(

_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )