[Zope] How do I get the owner of a document?
Alexander Staubo
alex@mop.no
Thu, 23 Mar 2000 00:03:56 +0100
If the object inherits from CatalogAware, you get a bonus method called
owner(), which you can call like so:
<p>The owner of this document is <dtml-var owner>.</p>
If not, you can use the get_local_roles() method. You need to iterate it
-- best with an External Method. Like so:
def GetOwner(self):
for Role in self.get_local_roles():
if 'Owner' in Role[1]:
return Role[0]
return 'Zope'
Add this External Method at top-level. Then, thanks to Acquisiton, you
can access the value in any document thus:
<p>The owner of this document is <dtml-var GetOwner>.</p>
Hope this helps.
--
Alexander Staubo http://alex.mop.no/
The difference between theory and practice is that, in theory,
there is no difference between theory and practice.
> -----Original Message-----
> From: Oliver Andrich [mailto:oli@rz-online.net]
> Sent: Wednesday, March 22, 2000 10:42 PM
> To: zope@zope.org
> Subject: [Zope] How do I get the owner of a document?
>
>
> Hi,
>
> may be I am just to dumb or something like that, but Zope has
> to now who is
> the owner of a certain document. This is for sure, but how
> can I get the owner
> of a document from DTML or an external method? I read through
> the sources and
> maybe I am just to dumb or so to find it, but I can't find
> any manage_* call,
> that tells me how to do this?
>
> I have to write a small DTML method, that finds all
> documents, that are
> located in a givben hierachie which are owned by a certain user.
>
> Bye and many thanks,
>
> OLiver
>
> P.S.: Don't frustrated that I ask these things again and
> again, but now I have
> to deal with things in Zope, that I haven't dealt with before. ;-))))
>
>
> _______________________________________________
> 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 )
>