[Zope] debugging help needed

Irene Barg ibarg@as.arizona.edu
Mon, 02 Jul 2001 16:18:16 -0700


Jim,

Another person pointed this out to me earlier today.  What
I want is the 'value' of 'sequence-item' which will be 
each column name in my family table.  Since I know what
the 'column' names are, I could do this like:

<dtml-call "REQUEST.set(lastname,_.string.upper(REQUEST['lastname']))">

....and so on for all of the columns in my table, but I
want to acquire these column names via the "names" method.
Actually, it would be cleaner to do it inside a Python script
but I couldn't figure out how to modify the REQUEST object.

Thanks for your input, your's too Daniel!
Jim Penny wrote:
> 
> On Mon, Jul 02, 2001 at 09:31:40AM -0700, Irene Barg wrote:
> > Hello all,
> >
> > I'm trying to parse input from a form to convert all string
> > input to upper-case, before passing it on to a SQL method.
> > So I created a DTML method to do this.  In this 2nd DTML
> > method, I call a ZSQL method to obtain the table's column
> > names, then use the column names to access the corresponding
> > values in the REQUEST.  I must not be implementing indirect
> > variable lookup correctly, because the script below produces
> > the following error.  How do I debug this?  Thanks.
> >
> > Zope Error
> > Zope has encountered an error while publishing this resource.
> >
> >           Error Type: TypeError
> >           Error Value: read-only character buffer, instance
> >
> > My DTML method looks like this:
> >
> > <dtml-var standard_html_header>
> > <dtml-comment>
> > Loop over fieldnames in the family table,
> > to lookup corresponding values in the REQUEST,
> > then convert all lower-case values to upper-case.
> > </dtml-comment>
> >
> > Before: firstmiddle=<dtml-var firstmiddle>
> >
> > <dtml-with get_one_family>
> >   <dtml-in names>
> >      <dtml-call
> > "REQUEST.set(_['sequence-item'],_.string.upper(REQUEST[_['sequence-item']]))">
> >     </dtml-in>
> > </dtml-with>
> 
> sequence-item delongs to DTML.  Use another variable name.
>  <dtml-with get_one_family>
>    <dtml-in names>
>       <dtml-call
>  "REQUEST.set('capname',_.string.upper(REQUEST[_['sequence-item']]))">
>       ... something using capname goes here ...
>      </dtml-in>
>  </dtml-with>
> 
> >
> > After:  firstmiddle=<dtml-var firstmiddle>
> > <dtml-comment><dtml-call update_family></dtml-comment>
> > <dtml-var standard_html_footer>
> > #####end####
> > -- irene barg
> > ----------------------------------------------------------------
> > Irene Barg                  Email:  ibarg@as.arizona.edu
> > Steward Observatory         Phone:  520-621-2602
> > 933 N. Cherry Ave.
> > University of Arizona       FAX:    520-621-1891
> > Tucson, AZ  85721           http://nickel.as.arizona.edu/~barg
> > ----------------------------------------------------------------
> >
> > _______________________________________________
> > 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 )
> >

-- 
----------------------------------------------------------------
Irene Barg		      Email:  ibarg@as.arizona.edu
Steward Observatory	      Phone:  520-621-2602
933 N. Cherry Ave.
University of Arizona	      FAX:    520-621-1891
Tucson, AZ  85721	      http://nickel.as.arizona.edu/~barg
----------------------------------------------------------------