[Zope] Finding PARENTS in an external method.

Andy McKay andym@ActiveState.com
Thu, 30 Nov 2000 15:38:51 -0800


PARENTS is part of REQUEST so:

def test(self, REQUEST):
    msg = ''
    for parent in REQUEST.PARENTS:
        msg = msg + str(parent.absolute_url()) + '<br>'
    return "%s" % msg

Is a convoluted way of listing parents urls...
--
  Andy McKay, Developer.
  ActiveState.

----- Original Message -----
From: "michael angelo ruberto" <michaelangelo@webmind.com>
To: "Max M" <maxmcorp@worldonline.dk>; "Zope@Zope. Org" <zope@zope.org>
Sent: Thursday, November 30, 2000 3:19 PM
Subject: RE: [Zope] Finding PARENTS in an external method.


> hi, Max
>
> i tried this and it works. the output is pretty ugly if you return it to
> Zope though. maybe someone knows how to clean it up.
>
> def index(self, PARENTS, REQUEST):
> n = PARENTS[0].objectItems(['File','DTML
Document','Folder','ListMate','DTML
> Method'])
>
> n.sort()
> #n.reverse()
> return n
>
> this example just sorts the list and sends it back. you can remove the
> sorting code. i named this method index_list and called it as such:
>
> <dtml-var "index_list(PARENTS, REQUEST)">
>
> Michael Angelo Ruberto
> Webmaster, Webmind Inc.
> www.webmind.com
>
> ps: if you run this example look at the HTML source for results page. you
> should see something interesting like this:
>
> ('C_document', <DTMLDocument instance at 012E44E0>),
>
> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Max M
> Sent: Thursday, November 30, 2000 5:50 PM
> To: Zope@Zope. Org
> Subject: [Zope] Finding PARENTS in an external method.
>
>
> I have an external Method. How do I call PARENTS[-1] from it?
> in dtml it would be: <dtml-in "PARENTS[-1].objectValues('Folder')">
>
> I have tried something like:
>     self.PARENTS[-1].objectValues('Folder')
>
> I have also checked if PARENTS get passed to the method like:
>     myMethod(self, PARENTS=None):
>
> To get a list of the root's Folder's, but no luck.
>
>     Regards Max M
>
> Max M. W. Rasmussen,    Denmark.   New Media Director
> private: maxmcorp@worldonline.dk work: maxm@normik.dk
> -----------------------------------------------------
> Specialization is for insects.  -  Robert A. Heinlein
>
> _______________________________________________
> 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 )
>