Context

Utility class for keeping track of the context.

A utility class that holds information about the file we are parsing and the environment we are doing it in.

Copyright (c) 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.

class PSP.Context.PSPCLContext(pspfile)

Bases: PSPContext

A context for command line compilation.

Currently used for both command line and PSPServletEngine compilation. This class provides all the information necessary during the parsing and page generation steps of the PSP compilation process.

__init__(pspfile)
getBaseUri()

Return the base URI for the servlet.

getClassPath()
getFullClassName()

Return the class name including package prefixes.

Won’t use this for now.

getFullPspFileName()

Return the name of the PSP file including its file path.

getOutputDirectory()

Provide directory to dump PSP source file to.

I am probably doing this in reverse order at the moment. I should start with this and get the Python filename from it.

getPspFileName()

Return the name of the PSP file from which we are generating.

getPythonFileEncoding()

Return the encoding of the file that we are generating.

getPythonFileName()

Return the filename that we are generating to.

getReader()

Return the PSPReader object assigned to this context.

getServletClassName()

Return the class name of the servlet being generated.

getServletWriter()

Return the ServletWriter object assigned to this context.

getWriter()
resolveRelativeURI(uri)

This is used mainly for including files.

It simply returns the location relative to the base context directory, ie Examples/. If the filename has a leading /, it is assumed to be an absolute path.

setClassName(name)

Set the class name to create.

setPSPReader(reader)

Set the PSPReader for this context.

setPythonFileEncoding(encoding)

Set the encoding of the .py file to generate.

setPythonFileName(name)

Set the name of the .py file to generate.

setServletWriter(writer)

Set the ServletWriter instance for this context.

class PSP.Context.PSPContext

Bases: object

PSPContext is an abstract base class for Context classes.

Holds all the common stuff that various parts of the compilation will need access to. The items in this class will be used by both the compiler and the class generator.

getClassPath()
getFullClassName()

Return the class name including package prefixes.

Won’t use this for now.

getOutputDirectory()

Provide directory to dump PSP source file to.

getPythonFileEncoding()

Return the encoding of the file that we are generating.

getPythonFileName()

Return the filename that we are generating to.

getReader()
getServletClassName()

Return the class name of the servlet being generated.

getWriter()
setPSPReader(reader)

Set the PSPReader for this context.

setPythonFileEncoding(encoding)

Set the encoding of the .py file to generate.

setPythonFileName(name)

Set the name of the .py file to generate.

setServletWriter(writer)

Set the PSPWriter instance for this context.