[Zope] Loosing namespace when calling a DTML-Method

Chris McDonough chrism@digicool.com
Wed, 02 Feb 2000 14:39:40 -0500


Wow, this'd be absolutely great.

I went through the mail list last night and came up with the following:

1.  (_.None, _ )issue
2.  quoting rules (dtml-var name vs dtml-var expr)
3.  this() and self in methods
4.  getting REQUEST variables via REQUEST.set
5.  difference between _['variable'] and _[variable] and why?
6.  _.getitem("method", 0) vs _.getitem("method",1)

You probably got all these.  I started to write a HOWTO about this and
the other stuff,
but ended up writing something completely different :-)

I'll cease any thought of work on that if you've got all those...

Sam Gendler wrote:
> 
> Chris,
>     I have been saving copies of all responses to questions like this, that are
> asked SO frequently by newbies.  I have about 40 questoins answered now.  I
> WILL find the time to write up a content-devloper newbie FAQ and get it
> published on the site.  I will try to do so by this weekend.
> 
> --sam
> 
> Chris McDonough wrote:
> 
> > For reasons currently beyond my scope of understanding, you need to call
> > DTML methods in the following manner:
> >
> > <dtml-var expr="my_other_dtml_method(_.None, _, food1='eggs',
> > food2='spam')">
> >
> > The important parts are the _.None and the _ arguments before any other
> > passed-in stuff.
> >
> > This is a really common problem, and I should really go write a how-to.
> > But first I gotta be able to justify why you need to do this.  Time to
> > hit the archives.
> >
> > Bertl wrote:
> > >
> > > Hi, people!
> > >
> > > I'm a Zope newbie and have a big big problem which i could not find
> > > anything about on the lists. I'm using the zope package that comes with
> > > debian linux potato (2.1.2) and the problem is the following:
> > >
> > > When i call a DTML Method with dtml-var or dtml-call, the called method
> > > cannot access any object. Not REQUEST, not an with dtml-let or
> > > dtml-with assigned variable, nothing. Further the called method cannot
> > > access any Objects in it's own folder, even when i wrap it with <dtml-with
> > > folder> (which is just the same problem).
> > > Accessing the same variables inside the calling function works just like
> > > expected. When i change the DTML Method to a DTML Document, it cannot
> > > access variables from outside, but gets an Authentication error when
> > > accessing objects in the current namespace
> > >
> > > My current workaround is to code everything in Python, as this works just
> > > great or to do everything in one big DTML Method. But this is not a long
> > > term solution!
> > >
> > > I see two possible explanations for this phenomenon: i totally
> > > misunderstand the Zope-security model, which is not unlikely, or my Zope
> > > installation is buggy. (I hope it is the first one as i dont feel like
> > > installing a full featured Zope with PostgresSQL binding and dont want to
> > > wait for the 2.1.3 .deb)
> > >
> > > Has anybody an idea what's going on?
> > >
> > > thx,
> > > bertl
> > >
> > > _______________________________________________
> > > 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 )
> >
> > --
> > Chris McDonough
> > Digital Creations, Inc.
> > Zope - http://www.zope.org
> >
> > _______________________________________________
> > 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 )
> 
> --
> Sam Gendler
> Chief Technology Officer - Impossible, Inc.
> 1222 State St. Suite 250
> Santa Barbara CA. 93101
> w: 805-560-0508
> f: 805-560-0608
> c: 805-689-1191
> e: sgendler@impossible.com

-- 
Chris McDonough - Digital Creations, Inc.
Publishers of Zope - http://www.zope.org