SourceForge Logo Python Documentation  

Designer documentation

Python documentation

1. Inner workings
2. Python API
3. DataSource
4. Types and exceptions




Return values

In the previous section, you saw a lot of return-statements. Their meaning is the following:
you should return a string or an int. AHTS doesn't cache any values, so <if @x@ eq @x@> will call your DataSource twice. You should return the same value both times.
if you know the number of rows, you should return it. Returning this value makes the special variable identifier:rowcount available. This value won't be available, if you return None.
you must return true if you have more data to follow, and false if you haven't got any more data. (true or false is meant in the Python-sense, so false can be an empty list, or 0, or '')
you shouldn't return anything at all.


AHTS knows the following types: integers and strings. When printing an identifier, it will be coerced to a string. When evaluating comparisons, AHTS will try to coerce both operands to integers, and compare them. If this fails they will be compared as strings.


Exceptions raised by AHTS:

raised by the Scanner, when it finds itself in an inconsistent state. This can't happen™.
called when the parser reaches an ambiguous situation. The expception-string provides the file, line number and column.
called at runtime, whenever the writer encounters an error. Possible causes:
  1. Bugs in the code
  2. <if @identifier@ (odd | even) > where identifier is not coercable to an integer.
This exception does not (yet) provide the filename, number, etc.

Exceptions you should raise:

Your DataSource should raise this exceptions every time you encounter a variable (identifier) you can't handle. AHTS will catch this exception in two specific cases:
  • When handling an <if @identifier@ defined>-statement.
  • When handling an <if @identifier@ nil>-statement.
  $Id: return.tml,v 1.1 2001/04/09 22:36:19 benderydt Exp $