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 roughness of the code). I am using: 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 = win32 Database = Access 2000 (client required Access) The ZSQL insert method and DTML code which creates the list are shown below: ZSQL Method ---------------------------------------------------------------------------- --------------------- ARGUMENTS: Instructors:list:int="" SQL: <dtml-with expr="SEL_LastSessionInserted()[0]"> <dtml-if SessionId> <dtml-comment>delete instructors who are associated with this session</dtml-comment> DELETE * FROM SessionInstructors WHERE SessionId=<dtml-sqlvar SessionId type=int> + 1 <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=int> + 1, <dtml-var "_['sequence-item']"> ) </dtml-in> </dtml-if SessionId> </dtml-with> The DTML code which creates the lists: ---------------------------------------------------------------------------- ------------------------------------------ <dtml-var hf_html_header> <h2 class=h2><dtml-var title_or_id > <p> <FORM ACTION="test_results" method="POST" name="asf"> <select name="Instructors:list" size="10" multiple> <dtml-in "Instructors.SEL_InstructorsBrowseMethod()"> <option value="<dtml-var Id>"><dtml-var FirstName></option> </dtml-in> </select> <input type=submit value=submit> </FORM> </p> <dtml-var hf_html_footer>
Looks like a namespace collision. In the form you reference Instructors.SEL_InstructorsBrowseMethod(), which to me implies that there is an object (Folder?) somewhere with the id Instructors. I would suggest using a different name for the argument to your ZSQL method (and the name of your <select> tag). Perhaps InstructorIds or something to be sure you are getting the thing you want. If that doesn't work, please submit a traceback as that might lend some more 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 roughness of the code).
I am using:
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 = win32 Database = Access 2000 (client required Access)
The ZSQL insert method and DTML code which creates the list are shown below:
ZSQL Method ---------------------------------------------------------------------------- --------------------- ARGUMENTS: Instructors:list:int=""
SQL: <dtml-with expr="SEL_LastSessionInserted()[0]"> <dtml-if SessionId> <dtml-comment>delete instructors who are associated with this session</dtml-comment> DELETE * FROM SessionInstructors WHERE SessionId=<dtml-sqlvar SessionId type=int> + 1
<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=int> + 1, <dtml-var "_['sequence-item']"> ) </dtml-in> </dtml-if SessionId> </dtml-with>
The DTML code which creates the lists: ---------------------------------------------------------------------------- ------------------------------------------ <dtml-var hf_html_header>
<h2 class=h2><dtml-var title_or_id > <p> <FORM ACTION="test_results" method="POST" name="asf"> <select name="Instructors:list" size="10" multiple> <dtml-in "Instructors.SEL_InstructorsBrowseMethod()"> <option value="<dtml-var Id>"><dtml-var FirstName></option> </dtml-in> </select> <input type=submit value=submit> </FORM> </p> <dtml-var hf_html_footer>
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
Casey Duncan -
JP Sieck