PSP.Generators | index /usr/local/share/webware/PSP/Generators.py

`Generate Python code from PSP templates.
This module holds the classes that generate the Python code resulting
from the PSP template file. As the parser encounters PSP elements,
it creates a new Generator object for that type of element.
Each of these elements is put into a list maintained by the
ParseEventHandler object. When it comes time to output the source code,
each generator is called in turn to create its source.
(c) Copyright by Jay Love, 2000 (mailto:jsliv@jslove.org)
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee or royalty is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation or portions thereof, including modifications,
that you make.
This software is based in part on work done by the Jakarta group.`

Modules

``

PSP.BraceConverter | PSP.PSPUtils | os |

Classes

``

__builtin__.object
  GenericGenerator
    CharDataGenerator
    EndBlockGenerator
    ExpressionGenerator
    IncludeGenerator
    InsertGenerator
    MethodEndGenerator
    MethodGenerator
    ScriptClassGenerator
    ScriptFileGenerator
    ScriptGenerator

class CharDataGenerator(GenericGenerator)
`` | `This class handles standard character output, mostly HTML. It just dumps it out. Need to handle all the escaping of characters. It's just skipped for now.`

Method resolution order:
  CharDataGenerator
  GenericGenerator
  __builtin__.object

Methods defined here:

__init__(self, chars)

generate(self, writer, phase=None)

generateChunk(self, writer, start=0, stop=None)

mergeData(self, cdGen)

Data descriptors inherited from GenericGenerator:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

class EndBlockGenerator(GenericGenerator)

``

Method resolution order:
  EndBlockGenerator
  GenericGenerator
  __builtin__.object

Methods defined here:

__init__(self)

generate(self, writer, phase=None)

Data descriptors inherited from GenericGenerator:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

class ExpressionGenerator(GenericGenerator)
`` | `This class handles expression blocks. It simply outputs the (hopefully) python expression within the block wrapped with a _formatter() call.`

Method resolution order:
  ExpressionGenerator
  GenericGenerator
  __builtin__.object

Methods defined here:

__init__(self, chars)

generate(self, writer, phase=None)

Data descriptors inherited from GenericGenerator:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

class GenericGenerator(__builtin__.object)
`` | `Base class for all the generators`

Methods defined here:

__init__(self, ctxt=None)

Data descriptors defined here:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

class IncludeGenerator(GenericGenerator)
`` | `Handle psp:include directives. This is a new version of this directive that actually forwards the request to the specified page.`

Method resolution order:
  IncludeGenerator
  GenericGenerator
  __builtin__.object

Methods defined here:

__init__(self, attrs, param, ctxt)

generate(self, writer, phase=None)
  `Just insert theFunction.`

Data descriptors inherited from GenericGenerator:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

class InsertGenerator(GenericGenerator)
`` | `Include files designated by the psp:insert syntax. If the attribute 'static' is set to True or 1, we include the file now, at compile time. Otherwise, we use a function added to every PSP page named __includeFile, which reads the file at run time.`

Method resolution order:
  InsertGenerator
  GenericGenerator
  __builtin__.object

Methods defined here:

__init__(self, attrs, param, ctxt)

generate(self, writer, phase=None)

Data descriptors inherited from GenericGenerator:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

class MethodEndGenerator(GenericGenerator)
`` | `Part of class method generation. After MethodGenerator, MethodEndGenerator actually generates the code for the method body.`

Method resolution order:
  MethodEndGenerator
  GenericGenerator
  __builtin__.object

Methods defined here:

__init__(self, chars, attrs)

generate(self, writer, phase=None)

Data descriptors inherited from GenericGenerator:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

class MethodGenerator(GenericGenerator)
`` | `Generate class methods defined in the PSP page. There are two parts to method generation. This class handles getting the method name and parameters set up.`

Method resolution order:
  MethodGenerator
  GenericGenerator
  __builtin__.object

Methods defined here:

__init__(self, chars, attrs)

generate(self, writer, phase=None)

Data descriptors inherited from GenericGenerator:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

class ScriptClassGenerator(GenericGenerator)
`` | `Add Python code at the class level.`

Method resolution order:
  ScriptClassGenerator
  GenericGenerator
  __builtin__.object

Methods defined here:

__init__(self, chars, attrs)

generate(self, writer, phase=None)

Data descriptors inherited from GenericGenerator:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

class ScriptFileGenerator(GenericGenerator)
`` | `Add Python code at the file/module level.`

Method resolution order:
  ScriptFileGenerator
  GenericGenerator
  __builtin__.object

Methods defined here:

__init__(self, chars, attrs)

generate(self, writer, phase=None)

Data descriptors inherited from GenericGenerator:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

class ScriptGenerator(GenericGenerator)
`` | `Generate scripts.`

Method resolution order:
  ScriptGenerator
  GenericGenerator
  __builtin__.object

Methods defined here:

__init__(self, chars, attrs)

generate(self, writer, phase=None)

Data descriptors inherited from GenericGenerator:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

Data
`` |  | ResponseObject = 'res'