Printable version XML version
Login
Name

Password


Join
Forgot your password?
erp5.org => wiki.erp5.org !

erp5.org has permanently moved to wiki.erp5.org !

Current status of ERP5 community websites:

  • www.erp5.org should redirect to wiki.erp5.org automaticcaly.
  • wiki.erp5.org is the place where fresh news and documentation are published.
  • cps.erp5.org is the old erp5 community website.

Note: if you created content in this ancient portal, please migrate it to the wiki. The old website will stay online as long as all contents are not mograted to the wiki.

ZSQLMethod parameters and default values
A short description of what can be done with ZSQLMethods and parameters

ZSQLMethods in Zope allow to define parameters with default values. However, what can be done and the behaviour of such parameters is quite different with the behaviour of Python scripts.

What can be done:

  • define parameters with no default value
  • define parameters with string default value

What can not be done:

  • use single quotes to define string values
  • define non string default values

Examples:

  param1
  param2=toto
  param3="toto"
  param4=""
  param5=1

param1 has no default value. param2 and param3 have a default string value of toto. param4 has a default empty string value. param4 has a default string value of 1.

Why use an empty string as default parameter

There is a major difference between:

    <dtml-if param>

and:

    <dtml-if "param">

In the second case, param must be defined in order to evaluate a python expression. In the first case, param does not need to be defined.

Sometimes, we would like to do someting like:

    <dtml-if param1 or param2 or param3>

However, this is not possible in dtml. So, we could do instead:

    <dtml-if "param1 or param2 or param3">

and initialise param1, param2 and param3 to a default value equivalent to false: the empty string.


(c) 2001-2004 ERP5 Foundation
www.erp5.org
All Content Published Under Free Licenses
Powered by ERP5 Open Source ERP, Zope, CPS and Nexedi