[Zope-dev] context bindings in python products

Bernd Dorn bernddorn@hotmail.com
Tue, 5 Jun 2001 22:59:38 +0200


this doesnt work either

my test funtion:

def test_htm(self):
        """ just test """
        context = self.aq_parent
        return context.absolute_url()

returns always the absolute_url of the parent object of the class instance

is there something wrong with my product??

it inherits from ofs.folder

i think i have to write context aware stuff in HTMLFile objects ? :-(





----- Original Message -----
From: "Chris McDonough" <chrism@digicool.com>
To: "Bernd Dorn" <bernddorn@hotmail.com>
Cc: <zope-dev@zope.org>
Sent: Tuesday, June 05, 2001 10:20 PM
Subject: Re: [Zope-dev] context bindings in python products


> Oops, sorry... roughly,
>
> context = self.aq_parent
> container = self.aq_inner.aq_parent
>
> Bernd Dorn wrote:
> >
> > thx, but i tried this already
> >
> > self always returns the instance of the class in which the method is
> > defined, instead of the container/object from which it is called
> >
> > example:
> > two classes,
> > class x with method example(): return self
> > class y with no method and is a subobject of x
> >
> > http://www.foo.bar/xInstance/yInstance/method
> > returns xInstance instead of yInstance
> > ???
> >
> > ----- Original Message -----
> > From: "Chris McDonough" <chrism@digicool.com>
> > To: "Bernd Dorn" <bernddorn@hotmail.com>
> > Cc: <zope-dev@zope.org>
> > Sent: Tuesday, June 05, 2001 9:56 PM
> > Subject: Re: [Zope-dev] context bindings in python products
> >
> > > context = self
> > > container = self.aq_inner.aq_parent
> > >
> > > Bernd Dorn wrote:
> > > >
> > > > hi
> > > >
> > > > isn't there some mixin class to provide bindings to python products
like
> > in
> > > > python scripts?
> > > > so that i have some objects like: context, container ...
> > > >
> > > > i searched through the zope site, but there is nothing which can do
such
> > > > stuff
> > > >
> > > > am i the only one who needs this, or is it a sign for wrong coding
> > practice
> > > > in zope?
> > > >
> > > > the only thing i found was this:
> > > > http://www.zope.org/Members/htrd/howto/FunctionTemplate
> > > > but it seems very complicated in argument passing
> > > >
> > > > wouldn't it be nice to have something like this
> > > >
> > > > if there is nothing out there, has anybody some sugestions how to
> > implement
> > > > it
> > > > so i would write it by myself
> > > >
> > > > maybe with the REQUEST Class or so?
> > > >
> > > > thanks in advance, bernd
> > > >
> > > > _______________________________________________
> > > > Zope-Dev maillist  -  Zope-Dev@zope.org
> > > > http://lists.zope.org/mailman/listinfo/zope-dev
> > > > **  No cross posts or HTML encoding!  **
> > > > (Related lists -
> > > >  http://lists.zope.org/mailman/listinfo/zope-announce
> > > >  http://lists.zope.org/mailman/listinfo/zope )
> > >
> >
> > _______________________________________________
> > Zope-Dev maillist  -  Zope-Dev@zope.org
> > http://lists.zope.org/mailman/listinfo/zope-dev
> > **  No cross posts or HTML encoding!  **
> > (Related lists -
> >  http://lists.zope.org/mailman/listinfo/zope-announce
> >  http://lists.zope.org/mailman/listinfo/zope )
>