[Zope] Maintain Input Variables around forms

McDonnell, Larry lmcdonnell@protonenergy.com
Mon, 11 Nov 2002 15:09:28 -0500


Hi,

It does contain nc_report_no from the first form that prompts for this
information. I do not have nc_report_no set global. I have the ZSQL query
looking for the input without the ':string="%"'. The user will add their
info to the next form and I write the record. Most times they will have
several of these records. I provide a link to back to the previous form. But
if I go back, the <dtml-in> call needs the value of nc_report_no. 

If I add the global syntax in than the user the first time through will
error. The error message would be that the variable was not globally assign
yet.


If I have the form setup this way:

<dtml-call "REQUEST.set('nc_report_no', REQUEST.SESSION['nc_report_no'])">
<dtml-call "REQUEST.SESSION.set('nc_report_no', nc_report_no)">


<dtml-in lookup_nc_report_no_query>

I get this traceback

Traceback (innermost last):
  File C:\Program Files\proton\lib\python\ZPublisher\Publish.py, line 150,
in publish_module
  File C:\Program Files\proton\lib\python\ZPublisher\Publish.py, line 114,
in publish
  File C:\PROGRA~1\proton\lib\python\Zope\__init__.py, line 158, in
zpublisher_exception_hook
    (Object: backup_partb)
  File C:\Program Files\proton\lib\python\ZPublisher\Publish.py, line 98, in
publish
  File C:\PROGRA~1\proton\lib\python\ZPublisher\mapply.py, line 88, in
mapply
    (Object: update_nonc_partb)
  File C:\Program Files\proton\lib\python\ZPublisher\Publish.py, line 39, in
call_object
    (Object: update_nonc_partb)
  File C:\PROGRA~1\proton\lib\python\OFS\DTMLDocument.py, line 127, in
__call__
    (Object: update_nonc_partb)
  File C:\PROGRA~1\proton\lib\python\DocumentTemplate\DT_String.py, line
473, in __call__
    (Object: update_nonc_partb)
  File C:\PROGRA~1\proton\lib\python\DocumentTemplate\DT_Util.py, line 159,
in eval
    (Object: REQUEST.set('nc_report_no', REQUEST.SESSION['nc_report_no']))
    (Info: REQUEST)
  File <string>, line 2, in f
  File C:\PROGRA~1\proton\lib\python\AccessControl\DTML.py, line 32, in
guarded_getitem
    (Object: update_nonc_partb)
  File C:\PROGRA~1\proton\lib\python\AccessControl\ZopeGuards.py, line 90,
in guarded_getitem
  File C:\PROGRA~1\proton\lib\python\Products\Transience\TransientObject.py,
line 135, in __getitem__
KeyError: (see above)

If I remove the lines before the <dtml-in> I will get this traceback the
second time through -

Missing input variable, nc_report_no 

Traceback (innermost last):
  File C:\Program Files\proton\lib\python\ZPublisher\Publish.py, line 150,
in publish_module
  File C:\Program Files\proton\lib\python\ZPublisher\Publish.py, line 114,
in publish
  File C:\PROGRA~1\proton\lib\python\Zope\__init__.py, line 158, in
zpublisher_exception_hook
    (Object: backup_partb)
  File C:\Program Files\proton\lib\python\ZPublisher\Publish.py, line 98, in
publish
  File C:\PROGRA~1\proton\lib\python\ZPublisher\mapply.py, line 88, in
mapply
    (Object: update_nonc_partb)
  File C:\Program Files\proton\lib\python\ZPublisher\Publish.py, line 39, in
call_object
    (Object: update_nonc_partb)
  File C:\PROGRA~1\proton\lib\python\OFS\DTMLDocument.py, line 127, in
__call__
    (Object: update_nonc_partb)
  File C:\PROGRA~1\proton\lib\python\DocumentTemplate\DT_String.py, line
473, in __call__
    (Object: update_nonc_partb)
  File C:\PROGRA~1\proton\lib\python\DocumentTemplate\DT_In.py, line 617, in
renderwob
    (Object: lookup_nc_report_no_query)
  File C:\PROGRA~1\proton\lib\python\Shared\DC\ZRDB\DA.py, line 414, in
__call__
    (Object: lookup_nc_report_no_query)
  File C:\PROGRA~1\proton\lib\python\DocumentTemplate\DT_String.py, line
473, in __call__
    (Object: <string>)
  File C:\PROGRA~1\proton\lib\python\Shared\DC\ZRDB\sqlvar.py, line 99, in
render
    (Object: nc_report_no)
Missing Input: (see above)

-----Original Message-----
From: Dieter Maurer [mailto:dieter@handshake.de]
Sent: Monday, November 11, 2002 2:01 PM
To: McDonnell, Larry
Cc: 'Zope@Zope. Org' (E-mail)
Subject: Re: [Zope] Maintain Input Variables around forms


McDonnell, Larry writes:
 > ....
 > I'll get an in "Missing input variable, nc_report_no"
 > If I add this to the input form and start with a fresh browser window:
 > Form
 > 
 > <dtml-call "REQUEST.set('nc_report_no',
REQUEST.SESSION['nc_report_no'])">
 > <dtml-call "REQUEST.SESSION.set('nc_report_no', nc_report_no)">
 > 
 > 
 > <dtml-in lookup_nc_report_no_query>
 > I will see this error: Error Type: KeyError Error Value: nc_report_no
Seems that your session does not contain the key "nc_report_no".

  I cannot tell you why.

Look at the traceback. It should tell you where exceptions are
raised.


Dieter