[Zope] ZSQL Method Question

Carlson, Christopher W. Christopher.W.Carlson@ct.sgcna.com
Thu, 24 Feb 2000 16:32:40 -0600


Following your recommendation, I get the following:

Zope has encountered an error while publishing this resource. 

Error Type: AttributeError
Error Value: __getslice__

Traceback:

  File /usr/src/Zope-2.1.4-src/lib/python/ZPublisher/Publish.py, line 214,
in publish_module
  File /usr/src/Zope-2.1.4-src/lib/python/ZPublisher/Publish.py, line 179,
in publish
  File /usr/src/Zope-2.1.4-src/lib/python/Zope/__init__.py, line 202, in
zpublisher_exception_hook
    (Object: ElementWithAttributes)
  File /usr/src/Zope-2.1.4-src/lib/python/ZPublisher/Publish.py, line 165,
in publish
  File /usr/src/Zope-2.1.4-src/lib/python/ZPublisher/mapply.py, line 160, in
mapply
    (Object: Detail)
  File /usr/src/Zope-2.1.4-src/lib/python/ZPublisher/Publish.py, line 102,
in call_object
    (Object: Detail)
  File /usr/src/Zope-2.1.4-src/lib/python/OFS/DTMLMethod.py, line 145, in
__call__
    (Object: Detail)
  File /usr/src/Zope-2.1.4-src/lib/python/DocumentTemplate/DT_String.py,
line 502, in __call__
    (Object: Detail)
  File /usr/src/Zope-2.1.4-src/lib/python/DocumentTemplate/DT_In.py, line
633, in renderwob
    (Object: rows[2:3])
  File /usr/src/Zope-2.1.4-src/lib/python/DocumentTemplate/DT_Util.py, line
335, in eval
    (Object: rows[2:3])
    (Info: rows)
  File <string>, line 0, in ?
  File /usr/src/Zope-2.1.4-src/lib/python/DocumentTemplate/DT_Util.py, line
172, in careful_getslice
AttributeError: (see above)

I'll keep poking at it...  Thanks for the tip!

--- Chris


-----Original Message-----
From: Hannu Krosing [mailto:hannu@tm.ee]
Sent: Thursday, February 24, 2000 4:28 PM
To: Carlson, Christopher W.
Cc: 'zope@zope.org'
Subject: Re: [Zope] ZSQL Method Question


"Carlson, Christopher W." wrote:
> 
> This wasn't originally my line of questioning, but it inspired me...and I
> subsequently became stuck.
> 
> I've done the following:
> <dtml-call "REQUEST.set('rows',MaintNames())">
> and successfully set 'rows' to the value returned by the SQL Method
> MaintNames.  I can <dtml-in rows> through the list and do fun stuff.
> 
> After scouring the documentation, I still can't find how to select the
> values from an arbitrary row, say row 3 without combining <dtml-in> and
> <dtml-if> while using the sequence-item value.  Is there a more elegant
way?
> 
>

You could try the python "slice" operator, ie. to get the third row, use

<dtml-in "row[2:3]">

this gets a one-row sequence of third row only out of rows.

----------

Hannu

_______________________________________________
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 )