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

`Event handler for parsing PSP tokens.
This module is called when the Parser encounters psp tokens.
It creates a generator to handle the PSP token. When the PSP
source file is fully parsed, this module calls all of the
generators in turn to output their source code.
(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 | time

Classes
`` |  | __builtin__.object ParseEventHandler
class ParseEventHandler(__builtin__.object)
`` | `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, value, 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, value, 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 descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Data and other attributes defined here: aspace = ' ' defaults = {'BASE_CLASS': 'WebKit.Page', 'BASE_METHOD': 'writeHTML', 'formatter': 'str', 'gobbleWhitespace': True, 'imports': {'filename': 'classes'}, 'indent': 4, 'instanceSafe': 'yes', 'threadSafe': 'no'} directiveHandlers = {'BaseClass': <function extendsHandler>, 'extends': <function extendsHandler>, 'formatter': <function formatterHandler>, 'gobbleWhitespace': <function gobbleWhitespaceHandler>, 'import': <function importHandler>, 'imports': <function importHandler>, 'indentSpaces': <function indentSpacesHandler>, 'indentType': <function indentTypeHandler>, 'isInstanceSafe': <function instanceSafeHandler>, 'isThreadSafe': <function threadSafeHandler>, ...}

Functions
`` |  | checkForTextHavingOnlyGivenChars(text, ws=None) `Checks whether text contains only whitespace (or other chars). Does the given text contain anything other than the ws characters? Return true if text is only ws characters.`

Data
`` |  | ResponseObject = 'res'