| |
- ParseEventHandler
class ParseEventHandler |
|
This is a key class.
It implements the handling of all the parsing elements.
Note: This files JSP cousin is called ParseEventListener,
I don't know why, but Handler seemed more appropriate to me. |
|
Methods defined here:
- __init__(self, ctxt, parser)
- addGenerator(self, gen)
- beginProcessing(self)
- endProcessing(self)
- extendsHandler(self, bc, start, stop)
- Extends is a page directive.
It sets the base class (or multiple base classes) for the class
that this class will generate. The choice of base class affects
the choice of a method to override with the BaseMethod page directive.
The default base class is PSPPage. PSPPage inherits from Page.py.
- formatterHandler(self, value, start, stop)
- Set an alternate formatter function to use instead of str().
- generateAll(self, phase)
- generateDeclarations(self)
- generateFooter(self)
- generateHeader(self)
- generateInitPSP(self)
- generateMainMethod(self)
- gobbleWhitespace(self)
- Gobble up whitespace.
This method looks for a character block between two PSP blocks
that contains only whitespace. If it finds one, it deletes it.
This is necessary so that a write() line can't sneek in between
a if/else, try/except etc.
- gobbleWhitespaceHandler(self, value, start, stop)
- Declare whether whitespace between script tags are gobble up.
- handleCharData(self, start, stop, chars)
- Flush character data into a CharGen.
- handleComment(self, start, stop)
- Comments get swallowed into nothing.
- handleDirective(self, directive, start, stop, attrs)
- Flush any template data into a CharGen and then create a new DirectiveGen.
- handleEndBlock(self)
- handleExpression(self, start, stop, attrs)
- Flush any template data into a CharGen and then create a new ExpressionGen.
- handleInclude(self, attrs, param)
- This is for includes of the form <psp:include ...>
This function essentially forwards the request to the specified
URL and includes that output.
- handleInsert(self, attrs, param)
- This is for includes of the form <psp:insert ...>
This type of include is not parsed, it is just inserted in the output stream.
- handleMethod(self, start, stop, attrs)
- handleMethodEnd(self, start, stop, attrs)
- handleScript(self, start, stop, attrs)
- Handle scripting elements
- handleScriptClass(self, start, stop, attrs)
- Python script that goes at the class level
- handleScriptFile(self, start, stop, attrs)
- Python script that goes at the file/module level
- importHandler(self, imports, start, stop)
- indentSpacesHandler(self, amount, start, stop)
- Set number of spaces used to indent in generated source.
- indentTypeHandler(self, type, start, stop)
- Declare whether tabs are used to indent source code.
- instanceSafeHandler(self, bool, start, stop)
- Handle isInstanceSafe.
isInstanceSafe tells the Servlet engine whether it is safe
to use object instances of this page multiple times.
The default is "yes".
Saying "no" here hurts performance.
- mainMethodHandler(self, method, start, stop)
- BaseMethod is a page directive.
It sets the class method that the main body of this PSP page
over-rides. The default is WriteHTML. This value should be set
to either WriteHTML or writeBody. See the PSPPage.py and Page.py
servlet classes for more information.
- optimizeCharData(self)
- Optimize the CharData.
Too many char data generators make the servlet slow.
If the current Generator and the next are both CharData type,
merge their data.
- setTemplateInfo(self, start, stop)
- Mark non code data.
- threadSafeHandler(self, bool, start, stop)
- Handle isThreadSage.
isThreadSafe is a page directive.
The value can be "yes" or "no".
Default is no because the default base class,
Page.py, isn't thread safe.
Data and other attributes defined here:
- aspace = ' '
- defaults = {'BASE_CLASS': ' WebKit.Page', 'BASE_METHOD': 'writeHTML', 'formatter': 'str', 'gobbleWhitespace': 1, 'imports': {'filename': 'classes'}, 'indent': 4, 'instanceSafe': 'yes', 'threadSafe': 'no'}
- directiveHandlers = {'BaseClass': <function extendsHandler at 0xe89aa0>, 'extends': <function extendsHandler at 0xe89aa0>, 'formatter': <function formatterHandler at 0xe93b90>, 'gobbleWhitespace': <function gobbleWhitespaceHandler at 0xe93b18>, 'import': <function importHandler at 0xe898c0>, 'imports': <function importHandler at 0xe898c0>, 'indentSpaces': <function indentSpacesHandler at 0xe93aa0>, 'indentType': <function indentTypeHandler at 0xe93a28>, 'isInstanceSafe': <function instanceSafeHandler at 0xe8fc80>, 'isThreadSafe': <function threadSafeHandler at 0xe89de8>, ...}
| |