Home 
          
      
      
         
              Designer documentation 
          
      
      
         
              Python documentation 
          
           
             
        1. 
                 Inner workings 
                
              
        2. 
                 Python API 
                
              
        3. 
                 DataSource 
                
              
        4. 
                 Types and exceptions 
                
             
      
         
              Download 
          
      
      
         
              Credits 
          
      
      
         
              Contact 
          
      
      
        | 
   
    
    Return values
In the previous section, you saw a lot of
return-statements. Their meaning is the following:
- get-actions:
 
   - 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.
 
- prepare-actions: 
 
   - 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.
 
- next-actions:
   
 - 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
   '')
 
- done-actions:
- 
   
  - you shouldn't return anything at all.
 
   
Types
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
   
Exceptions raised by AHTS: 
   - ahts.ScannerError:
 
   - raised by the Scanner, when it finds itself in an inconsistent
   state. This can't happen™.
 
   - ahts.SyntaxError:
 
   - called when the parser reaches an ambiguous situation.  The
       expception-string provides the file, line number and column.
 
   - ahts.RuntimeError:
 
   - called at runtime, whenever the writer encounters an error. 
   Possible causes:
   
      -  Bugs in the code
 
      - <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: 
   - ahts.NotDefinedError:
  
   - 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.
 
    
    
 
    
     |