[Zope] unsliceable object error

Casey Duncan casey@zope.com
Sat, 8 Feb 2003 22:58:55 -0500


Looks like a namespace collision. In the form you reference=20
Instructors.SEL_InstructorsBrowseMethod(), which to me implies that there=
 is=20
an object (Folder?) somewhere with the id Instructors. I would suggest us=
ing=20
a different name for the argument to your ZSQL method (and the name of yo=
ur=20
<select> tag). Perhaps InstructorIds or something to be sure you are gett=
ing=20
the thing you want.

If that doesn't work, please submit a traceback as that might lend some m=
ore=20
clues.

hth,

-Casey

On Saturday 08 February 2003 07:21 pm, JP Sieck wrote:
> I'm getting an unsliceable object error when I attempt to insert a new
> record due to my Instructors:list.  Take a look and let me know what I =
am
> doing wrong and if there is a better way to do this (pardon the roughne=
ss of
> the code).
>=20
> I am using:
>=20
> Zope Version 2.6.0 (binary release, python 2.1, win32-x86), python 2.1.=
3,
> win32)
> Python Version 2.1.3 (#35, Apr 8 2002, 17:47:50) [MSC 32 bit (Intel)]
> System Platform =3D win32
> Database =3D Access 2000 (client required Access)
>=20
> The ZSQL insert method and DTML code which creates the list are shown b=
elow:
>=20
> ZSQL Method
> -----------------------------------------------------------------------=
-----
> ---------------------
> ARGUMENTS:
> Instructors:list:int=3D""
>=20
> SQL:
> <dtml-with expr=3D"SEL_LastSessionInserted()[0]">
>     <dtml-if SessionId>
>         <dtml-comment>delete instructors who are associated with this
> session</dtml-comment>
>         DELETE * FROM SessionInstructors WHERE SessionId=3D<dtml-sqlvar
> SessionId type=3Dint> + 1
>=20
>         <dtml-comment>insert instructors who are associated with this
> session</dtml-comment>
>         <dtml-in Instructors>
>            <dtml-var sql_delimiter>
>            INSERT INTO SessionInstructors (SessionId, InstructorId)
>            VALUES
>            (
>              <dtml-sqlvar SessionId type=3Dint> + 1,
>              <dtml-var "_['sequence-item']">
>             )
>          </dtml-in>
>      </dtml-if SessionId>
> </dtml-with>
>=20
>=20
> The DTML code which creates the lists:
> -----------------------------------------------------------------------=
-----
> ------------------------------------------
> <dtml-var hf_html_header>
>=20
> <h2 class=3Dh2><dtml-var title_or_id >
> <p>
>   <FORM ACTION=3D"test_results" method=3D"POST" name=3D"asf">
>     <select name=3D"Instructors:list" size=3D"10" multiple>
>       <dtml-in "Instructors.SEL_InstructorsBrowseMethod()">
>          <option value=3D"<dtml-var Id>"><dtml-var FirstName></option>
>       </dtml-in>
>     </select>
>     <input type=3Dsubmit value=3Dsubmit>
>   </FORM>
> </p>
> <dtml-var hf_html_footer>
>=20
>=20
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -=20
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
>=20