[Zope] How to list the attributes of an object?
Tres Seaver
tseaver@palladion.com
Fri, 04 Feb 2000 10:10:28 -0600
Robb Shecter <shecter@darmstadt.gmd.de> wrote:
>
> Is this possible?
>
> I'm trying to display all the roles that a script has: I get my list
> of roles, but I don't know what attributes they have. I also can't
> find "Role" as a class listed in an API anywhere.
>
> I got this far:
>
> <dtml-in "AUTHENTICATED_USER.getRoles()">
> <dtml-var "_">
> </dtml-in>
>
> ...but that just prints an object tag.
Here is my "check_roles" method:
----------------- snip ---------------------------------
<dtml-var standard_html_header>
<dtml-let user="AUTHENTICATED_USER">
<p> User <em><dtml-var "user.getUserName()"></em>
<dtml-if "user.has_role( 'Owner', this() )"
> <strong>owns</strong>
<dtml-else> does <strong>not</strong> own
</dtml-if
> <dtml-var id>, and has the following roles:</p>
<ul>
<dtml-in "user.getRolesInContext( this() )">
<li> <dtml-var sequence-item> </li>
</dtml-in>
</ul>
</dtml-let>
<p> Valid roles: </p>
<ul>
<dtml-in valid_roles>
<li> <dtml-var sequence-item> </li>
</dtml-in>
</ul>
<p> Current local roles: </p>
<ul>
<dtml-in get_local_roles>
<li> <dtml-var sequence-key
>=<dtml-var sequence-item> </li>
</dtml-in>
</ul>
<dtml-var standard_html_footer>
----------------- snip ---------------------------------
The "owns/does not own" bit is a fossil from my attempting to figure out some
unexpected behavior that is tied directly to the owner role.
--
=========================================================
Tres Seaver tseaver@palladion.com 713-523-6582
Palladion Software http://www.palladion.com