[Zope] RE: where has the REQUEST-object gone???
Chris Withers
chrisw@nipltd.com
Mon, 08 May 2000 14:08:50 +0100
OK, sorry, thought you were experiencing the problems with 2.1.6 that several
people here have just battled through...
Chris
Andy Pahne wrote:
>
> OK, I found the solution in the FAQ. It was just a matter of calling the
> helper-method get_text
>
> the solution was:
>
> <dtml-var "get_text(_.None, _, id_to_get=xxxx)">
>
> Andy
>
> ----- Original Message -----
> From: Andy Pahne <ap@net22.net>
> To: <zope@zope.org>
> Sent: Monday, May 08, 2000 2:38 PM
> Subject: where has the REQUEST-object gone???
>
> >
> >
> > hi,
> >
> > at the moment we are builduing a database-enabled three-language website.
> we
> > have the contents (texts) for the site already in a database. I wrote a
> > Z-SQL-Method sql_get_text which takes id_to_get as argument. So, when I
> > call
> >
> > <dtml-in "get_text(id_to_get=xxxx)">
> > <dtml-var text_value>
> > </dtml-in>
> >
> > I get the text I was looking for. (Note that this ZSQL-method will return
> > only one result, because id_to_get is the primary key of the database
> table
> > and therefore unique).
> >
> >
> > I wanted to make things a bit easier for the people who generate the
> > templates for the site. So I coded a helper-method named get_text which
> also
> > takes id_to_get as argument. It holds exactly the code-snippet from above.
> > By doing so I wanted the HTML-Coders to type
> >
> > <dtml-var "get_text(id_to_get=xxxx)">
> >
> > so that they do not have to worry about the dtml-in-tag. It did not work.
> I
> > get an error-message that Zope can not find the ZSQL-method sql_get_text
> > method. Here is the traceback:
> >
> > Traceback (innermost last):
> > File /usr/local/src/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py,
> line
> > 214, in publish_module
> > File /usr/local/src/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py,
> line
> > 179, in publish
> > File /usr/local/src/Zope-2.1.6-src/lib/python/Zope/__init__.py, line
> 202,
> > in zpublisher_exception_hook
> > (Object: ElementWithAttributes)
> > File /usr/local/src/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py,
> line
> > 165, in publish
> > File /usr/local/src/Zope-2.1.6-src/lib/python/ZPublisher/mapply.py, line
> > 160, in mapply
> > (Object: content)
> > File /usr/local/src/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py,
> line
> > 102, in call_object
> > (Object: content)
> > File /usr/local/src/Zope-2.1.6-src/lib/python/OFS/DTMLMethod.py, line
> 150,
> > in __call__
> > (Object: content)
> > File
> > /usr/local/src/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_String.py,
> line
> > 502, in __call__
> > (Object: content)
> > File
> /usr/local/src/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_Util.py,
> > line 335, in eval
> > (Object: _['content-ms'])
> > (Info: _)
> > File <string>, line 0, in ?
> > File
> /usr/local/src/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_Util.py,
> > line 161, in careful_getitem
> > File /usr/local/src/Zope-2.1.6-src/lib/python/OFS/DTMLMethod.py, line
> 146,
> > in __call__
> > (Object: content-ms)
> > File
> > /usr/local/src/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_String.py,
> line
> > 502, in __call__
> > (Object: content-ms)
> > File
> /usr/local/src/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_Util.py,
> > line 335, in eval
> > (Object: get_text(id_to_get='AXIN_001'))
> > (Info: get_text)
> > File <string>, line 0, in ?
> > File /usr/local/src/Zope-2.1.6-src/lib/python/OFS/DTMLMethod.py, line
> 146,
> > in __call__
> > (Object: get_text)
> > File
> > /usr/local/src/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_String.py,
> line
> > 502, in __call__
> > (Object: get_text)
> > File
> /usr/local/src/Zope-2.1.6-src/lib/python/DocumentTemplate/DT_With.py,
> > line 132, in render
> > (Object: REQUEST)
> > KeyError: (see above)
> >
> >
> >
> > My next idea was:
> >
> > <dtml-with REQUEST>
> > <dtml-in "get_text(id_to_get=xxxx)">
> > <dtml-var text_value>
> > </dtml-in>
> > </dtml-with>
> >
> > I don't know why, but the <dtml-with REQUEST> fixed a lot of errors
> before,
> > so I just gave it a try. But then I received and error-message telling me
> > that I am trying to refference the non-existing object REQUEST.
> >
> > Now, why doesn't it find my method and why did the REQUEST-object
> > disappear???
> >
> > PS: I am doing Zope for half a year now but the namespace-stack is still
> > mysterious to me.
> >
> >
> > Andy Pahne, ap@net22.net
> >
> > net22 GmbH
> > Bad Meinberger Strasse 1
> > 32760 Detmold
> > 0 52 31 - 580 640
> >
> > http://www.net22.net
> >
>
> _______________________________________________
> 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 )