Re: [Zope] neted dtml-in and ZSQL methods

2000-06-16 Thread Dieter Maurer

[EMAIL PROTECTED] writes:
 > Suppose, you have a database, items,  that has fields product and scheme.
 > 
 > You are processing a form that has field old_product and new_product.
 > 
 > You have a ZSQL method, get_scheme, with parameter old_product and body
 > select * from items where product = .
 > 
 > You also have a ZSQL method, new_scheme, with parameter new_product and
 > scheme.
 > 
 > Observation:
 > 
 > 
 >  
 > 
 > 
 > fails, with message
 > 
 >   Zope Error
 > 
 >   Zope has encountered an error while publishing this resource. 
 > 
 >   Error Type: NameError
 >   Error Value: scheme
I can across the same thing yesterday.

The explantion:
  SQL methods are much more stupid than DTML methods!
  If used in the way you do it, SQL methods look only
  in the REQUEST object and not in the namespace.

  This means (if called from a WEB request, i.e. REQUEST is defined):
 is equivalent to .
  Your , however, has placed the fields into the
  namespace "_" and not in the REQUEST object.

  You cannot use  either, because
  SQL methods require a "get" method from their first parameter
  ("_" does not have it).

For the moment, you have to use on of these ways:

  1.  
or
  2.  
  
  

I prefered 1. in my solution.


Dieter

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




[Zope] neted dtml-in and ZSQL methods

2000-06-15 Thread jpenny

Suppose, you have a database, items,  that has fields product and scheme.

You are processing a form that has field old_product and new_product.

You have a ZSQL method, get_scheme, with parameter old_product and body
select * from items where product = .

You also have a ZSQL method, new_scheme, with parameter new_product and
scheme.

Observation:


 


fails, with message

  Zope Error

  Zope has encountered an error while publishing this resource. 

  Error Type: NameError
  Error Value: scheme



  Troubleshooting Suggestions

   This resource may be trying to reference a nonexistent object or 
variable scheme. 
   The URL may be incorrect. 
   The parameters passed to this resource may be incorrect. 
   A resource that this resource relies on may be encountering an error. 

  For more detailed information about the error, please refer to the HTML 
source for this page. 

  If the error persists please contact the site maintainer. Thank you for your 
patience. 

even though


 


prints the expected value.

Why?

Jim Penny

___
Zope maillist  -  [EMAIL PROTECTED]
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 )