Package lemon
[show private | hide private]
[frames | no frames]

Package lemon

The documentation for the Lemon modules can be found in the doc directory of the source distribution or online at http://lemon.sourceforge.net/.


This module has the following public variables

config

A ConfigParser object which contains the variables listed in Lemon.ini

Useage:

import lemon
# Return the value of cookie.domain in the session section
lemon.config.get('session','cookie.domain') 
# Set the value of cookie.domain in the session section
lemon.config.set('session','cookie.domain') 

Usually you would only get the variable.

cgi

dictionary containing key value pairs from the QUERY_STRING. All values are strings.

Useage

For the URL http://www.example.com/test.py?key=5&key2=hello:

import lemon
print lemon.get['key']
print lemon.get['key2']

Would produce:

5
hello

Submodules
  • auth: PHP-style authorisation functions.
    • drivers: Drivers for the Auth Module...
      • base: PHP-style authorisation functions.
      • db: PHP-style authorisation functions.
    • manager: PHP-style authorisation functions.
      • drivers: Drivers for the Auth Manager module.
        • base: PHP-style authorisation functions.
        • db: PHP-style authorisation functions.
    • template: The default HTML templates associated with the Auth module.
  • date: Date and time classes.
  • db: DILL - Cross-database interface layer compatible with MySQL, ODBC, Gadfly.
    • builder: DBBuilder - Typed SQL Abstraction Layer.
      • drivers: Drivers for the DB Builder module.
    • date: Date and time classes.
    • drivers: Database drivers.
      • base: Wraps DB-2.0 API cursors and extends functionality.
      • gc: Lemon DB interface to the gadfly cursor.
      • mysql: Lemon DB interface to the MySQLdb cursor.
      • odbc: Lemon DB interface to the odbc cursor.
    • errors
  • external: 3rd party packages required by Lemon.
    • Cheetah: Cheetah is a Python-powered template engine and code-generator.
      • CheetahWrapper: Cheetah command-line interface.
      • Compiler: Compiler classes for Cheetah: ModuleCompiler aka 'Compiler' ClassCompiler MethodCompiler If you are trying to grok this code start with ModuleCompiler.__init__, ModuleCompiler.compile, and ModuleCompiler.__getattr__.
      • DummyTransaction: Provides dummy Transaction and Response classes is used by Cheetah in place of real Webware transactions when the Template obj is not used directly as a Webware servlet.
      • ErrorCatchers: ErrorCatcher class for Cheetah Templates...
      • FileUtils: File utitilies for Python: Meta-Data ================================================================================ Author: Tavis Rudd <tavis@damnsimple.com> License: This software is released for unlimited distribution under the terms of the Python license.
      • Filters: Filters for the #filter directive; output filters Cheetah's $placeholders .
      • ImportHooks: Provides some import hooks to allow Cheetah's .tmpl files to be imported directly like Python .py modules.
      • ImportManager: Provides an emulator/replacement for Python's standard import system.
      • Lexer: Lexer base-class for Cheetah's Parser...
      • NameMapper: This module implements Cheetah's optional NameMapper syntax.
      • Parser: Parser classes for Cheetah's Compiler...
      • Servlet: Provides an abstract Servlet baseclass for Cheetah's Template class Meta-Data ================================================================================ Author: Tavis Rudd <tavis@damnsimple.com> License: This software is released for unlimited distribution under the terms of the Python license.
      • SettingsManager: Provides a mixin/base class for collecting and managing application settings...
      • SourceReader: SourceReader class for Cheetah's Parser and CodeGenerator Meta-Data ================================================================================ Author: Tavis Rudd <tavis@damnsimple.com> License: This software is released for unlimited distribution under the terms of the Python license.
      • Template: Provides the core Template class for Cheetah See the docstring in __init__.py and the User's Guide for more information Meta-Data ================================================================================ Author: Tavis Rudd <tavis@damnsimple.com> License: This software is released for unlimited distribution under the terms of the Python license.
      • TemplateCmdLineIface: Provides a command line interface to compiled Cheetah template modules.
      • Templates
        • SkeletonPage: A Skeleton HTML page template, that provides basic structure and utility methods.
      • Tests
        • CheetahWrapper: Tests for the 'cheetah' command.
        • FileRefresh: Tests to make sure that the file-update-monitoring code is working properly THIS TEST MODULE IS JUST A SHELL AT THE MOMENT.
        • NameMapper: NameMapper Tests...
        • SyntaxAndOutput: Syntax and Output tests.
        • Template: Tests of the Template class API THIS TEST MODULE IS JUST A SHELL AT THE MOMENT.
        • Test: Core module of Cheetah's Unit-testing framework TODO ================================================================================ # combo tests # negative test cases for expected exceptions # black-box vs clear-box testing # do some tests that run the Template for long enough to check that the refresh code works Meta-Data ================================================================================ Author: Tavis Rudd <tavis@damnsimple.com>, License: This software is released for unlimited distribution under the terms of the Python license.
        • unittest_local_copy: This is a hacked version of PyUnit that extends its reporting capabilities with optional meta data on the test cases.
      • Tools: This package contains classes, functions, objects and packages contributed by Cheetah users.
        • CGITemplate: A subclass of Cheetah.Template for use in CGI scripts.
        • MondoReport: MondoReport.py -- Batching module for Python and Cheetah.
        • RecursiveNull: Nothing, but in a friendly way.
        • SiteHierarchy: Create menus and crumbs from a site hierarchy.
      • Utils
        • Indenter: Indentation maker.
        • Misc: Miscellaneous functions/objects used by Cheetah but also useful standalone.
        • optik: optik A powerful, extensible, and easy-to-use command-line parser for Python.
          • errors: optik.errors Exception classes used by Optik.
          • option: optik.option Defines the Option class and some standard value-checking functions.
          • option_parser: optik.option_parser Provides the OptionParser and Values classes.
        • VerifyType: Functions to verify an argument's type Meta-Data ================================================================================ Author: Mike Orr <iron@mso.oz.net> License: This software is released for unlimited distribution under the terms of the Python license.
        • WebInputMixin: Mixin for Cheetah.Servlet for importing web transaction variables in bulk.
      • Version
    • docutils: This is the Docutils (Python Documentation Utilities) package.
      • core: Calling the publish_* convenience functions (or instantiating a Publisher object) with component names will result in default behavior.
      • frontend: Command-line and common processing for Docutils front-end tools.
      • io: I/O classes provide a uniform API for low-level input and output.
      • languages: This package contains modules for language-dependent features of Docutils.
        • de: German language mappings for language-dependent features of Docutils.
        • en: English-language mappings for language-dependent features of Docutils.
        • es: Spanish-language mappings for language-dependent features of Docutils.
        • fr: French-language mappings for language-dependent features of Docutils.
        • it: Italian-language mappings for language-dependent features of Docutils.
        • sk: Slovak-language mappings for language-dependent features of Docutils.
        • sv: Swedish language mappings for language-dependent features of Docutils.
      • nodes: Docutils document tree element class library.
      • parsers: This package contains Docutils parser modules.
        • rst: This is docutils.parsers.rst package.
          • directives: This package contains directive implementation modules.
            • admonitions: Admonition directives.
            • body: Directives for additional body elements.
            • html: Directives for typically HTML-specific constructs.
            • images: Directives for figures and simple images.
            • misc: Miscellaneous directives.
            • parts: Directives for document parts.
            • references: Directives for references and targets.
          • languages: This package contains modules for language-dependent features of reStructuredText.
            • de: German-language mappings for language-dependent features of reStructuredText.
            • en: English-language mappings for language-dependent features of reStructuredText.
            • es: Spanish-language mappings for language-dependent features of reStructuredText.
            • fr: French-language mappings for language-dependent features of reStructuredText.
            • it: Italian-language mappings for language-dependent features of reStructuredText.
            • sk: Slovak-language mappings for language-dependent features of reStructuredText.
            • sv: Swedish language mappings for language-dependent features of reStructuredText.
          • roman: Convert to and from Roman numerals...
          • states: This is the docutils.parsers.restructuredtext.states module, the core of the reStructuredText parser.
          • tableparser: This module defines table parser classes,which parse plaintext-graphic tables and produce a well-formed data structure suitable for building a CALS table.
      • readers: This package contains Docutils Reader modules.
        • pep: Python Enhancement Proposal (PEP) Reader.
        • python: This package contains the Python Source Reader modules.
        • standalone: Standalone file Reader for the reStructuredText markup syntax.
      • statemachine: A finite state machine specialized for regular-expression-based text filters, this module defines the following classes:
      • transforms: This package contains modules for standard tree transforms available to Docutils components.
        • components: Docutils component-related transforms.
        • frontmatter: Transforms related to the front matter of a document (information found before the main text):
        • misc: Miscellaneous transforms.
        • parts: Transforms related to document parts.
        • peps: Transforms for PEP processing.
        • references: Transforms for resolving references.
        • universal: Transforms needed by most or all documents:
      • urischemes: `schemes` is a dictionary with lowercase URI addressing schemes as keys and descriptions as values.
      • utils: Miscellaneous utilities for the documentation utilities.
      • writers: This package contains Docutils Writer modules.
        • docutils_xml: Simple internal document tree Writer, writes Docutils XML.
        • html4css1: Simple HyperText Markup Language document tree Writer.
        • latex2e: LaTeX2e document tree Writer.
        • pep_html: PEP HTML Writer.
        • pseudoxml: Simple internal document tree Writer, writes indented pseudo-XML.
    • dtuple
    • epydoc: Automatic Python reference documentation generator.
      • cli: Command-line interface for epydoc.
      • gui: Graphical interface to epydoc.
      • uid: Unique identifiers and crossreference links for Python objects.
      • objdoc: Support for ObjDocs, which encode the information about a Python object that is necessary to create its documentation.
      • imports: Module import support for epydoc.
      • markup: Markup language support for docstrings.
      • html: Documentation to HTML converter.
      • css: Predefined CSS stylesheets for the HTML outputter (epydoc.html).
      • help: Default help file for the HTML outputter (epydoc.html).
      • colorize: Functions to produce colorized HTML code for various objects.
      • latex: Documentation to LaTeX converter.
      • man: Documentation formatter that produces man-style documentation.
      • checker: Documentation completeness checker.
      • test: Unit tests for the NLTK modules.
        • epytext: Regression testing for the epytext markup language.
    • gadfly: Package marker for the gadfly package, also provides backaward compatibility.
      • bindings: Rule bindings for sql grammar.
      • client
      • database: Main entry point for gadfly sql.
      • gfsocket: Socket interactions for gadfly client and server...
      • grammar: SQL grammar, partial, based on ODBC 2.0 programmer's ref...
      • introspection: View based introspection and extension views...
      • kjbuckets0: kjbuckets in pure python...
      • kjbuckets_select: Select the best kjbuckets module available.
      • kjParseBuild: Python code for building a parser from a grammar...
      • kjParser: Python for parser interpretation...
      • kjSet: Sets implemented using mappings.
      • operations: Database modification statement semantics...
      • scripts: Scripts...
        • gfplus: An Interactive Shell for the Gadfly RDBMS (http://gadfly.sf.net/) Jeff Berliner (jeff@popmail.med.nyu.edu) -- 11/24/1998 (old URL http://shamrock.med.nyu.edu/~jeff/gfplus/) gfplus is a simple interactive shell for Gadfly, based losely on Oracle's SQL*Plus tool.
        • gfserver: gadfly server mode script usage python gfserve.py port database directory password [startup] test example python gfserve.py 2222 test dbtest admin gfstest port is the port to listen to database is the database to start up.
      • semantics: SQL semantics...
      • serialize: essentially, specialized pickle for this app:...
      • server
      • sql: defines the SQL grammar and bahaviour for gadfly...
      • sql_mar
      • store: Storage objects...
    • py2html: Python Highlighter for HTML Version: 0.5 py2html.py [options] files...
    • PyFontify: Module to analyze Python source code; for syntax coloring tools.
    • roman: Convert to and from Roman numerals...
    • xyaptu: XYAPTU: Lightweight XML/HTML Document Template Engine for Python...
    • yaptu: Yet Another Python Templating Utility, Version 1.2...
  • html: HTML templates and persistent forms.
    • dateConstants
    • fields: HTML Fields The idea is that you can create field values in a standard way and then you derive a form from the form class to look and behave exactly as you want your form to behave with your own validation, export, import functions etc.
    • form: Class to handle Persistant HTML forms.
    • tags: Some useful functions for generating HTML tags not in 'lemon.html.forms'.
    • template: HTML template classes.
      • dreamweaverMX: Module desinged to provide an easy interface to allow python programs to output HTML pages based on Dreamweaver MX Templates *.dwt files.
  • session: PHP-style session management.
    • drivers: Drivers for the Session Module.
      • base: Base class for session storage drivers.
      • db: Implementation of a database storage driver for the session module.
    • manager: PHP-style authorisation functions.
      • drivers: Drivers for the Session Manager module.
        • base: PHP-style authorisation functions.
        • db: PHP-style authorisation functions.
  • tb

Exceptions
LemonError Raised when a general Error in a lemon module occurs Attributes: message -- explanation of what the specific error is.

Function Summary
  addToDict(dict1, dict2, overWrite)
Adds the information in the dictionary 'dict2' to the entries in the dictionary 'dict1'.
  addZeros(num, s)
Private function to add an appropriate number of zeros to s such that len(s) is num.
  allNone(value)
  cgiAsDict(form)
Takes a cgi.FieldStorage() item and retuns a simple dictionary for use in other lemon functions.
  dictAsHiddenFields(stickyData)
Changes a dictionary such as lemon.get into a string containing hidden fields HTML.
  dictAsURLPairs(stickyData)
Changes a dictionary such as lemon.get into a query string.
  escape(value)
  findFile(filename)
Utility function which searched the directories listed in sys.path for the file specified in filename.
  getHTTPHeader(type)
Generates the Content-type header for a particular mime type such as 'text/html'.
  header(type)
  keepInDict(dict1, keys)
Removes all keys in 'dict1' NOT specified in the list or dictionary 'keys'.
  mail(**params)
Function to send a text only email via SMTP.
  removeFromDict(dict1, keys)
Removes all keys in 'dict1' specified in the list or dictionary 'keys'.
  unescape(value)
  wrap(text, width)
and most spaces in the text.

Variable Summary
str __author__ = 'James Gardner [email: james at xecos.com]'...
str __credits__ = 'Guido van Rossum, for an excellent progra...
str __date__ = '02 July 2003'
str __version__ = '0.2.0-Pre-Alpha'
dict cgi = {}
dict get = {}

Function Details

addToDict(dict1, dict2, overWrite=True)

Adds the information in the dictionary 'dict2' to the entries in the dictionary 'dict1'. If 'overWrite' is True the values in 'dict2' overwrite the values in 'dict1', otherwise only the keys not already in 'dict1' are added.

addZeros(num, s)

Private function to add an appropriate number of zeros to s such that len(s) is num.

cgiAsDict(form)

Takes a cgi.FieldStorage() item and retuns a simple dictionary for use in other lemon functions.

dictAsHiddenFields(stickyData)

Changes a dictionary such as lemon.get into a string containing hidden fields HTML.

dictAsURLPairs(stickyData)

Changes a dictionary such as lemon.get into a query string.

findFile(filename)

Utility function which searched the directories listed in sys.path for the file specified in filename. If the file exists the complete path is returned.

Note that the directories are searched in the order they appear in sys.path so if you want to choose a specific file it is better not to use this function because a similar file in a directory earlier in sys.path will be returned first.

getHTTPHeader(type='text/html')

Generates the Content-type header for a particular mime type such as 'text/html'.

keepInDict(dict1, keys)

Removes all keys in 'dict1' NOT specified in the list or dictionary 'keys'.

mail(**params)

Function to send a text only email via SMTP. msg - Text of the message. to - A list of recipient addresses in the form: addr@addr.com separated by commas. subject - Email subject. smtp - SMTP server address. sendmail - Sendmail path. method - Which method to use if smtp or sendmail aren't specified. blind - Whether to send the emails blind or not. sender - The name and address of the person sending the email in the form: "sender name <addr@addr.com>" reply - The reply address.

WARNING: This function probably doesn't work yet. Don't use it!!!

removeFromDict(dict1, keys)

Removes all keys in 'dict1' specified in the list or dictionary 'keys'.

wrap(text, width)

A word-wrap function that preserves existing line breaks
and most spaces in the text. Expects that existing line breaks are posix newlines (

).


Variable Details

__author__

Type:
str
Value:
'James Gardner [email: james at xecos.com]'                            

__credits__

Type:
str
Value:
'Guido van Rossum, for an excellent programming language.'             

__date__

Type:
str
Value:
'02 July 2003'                                                         

__version__

Type:
str
Value:
'0.2.0-Pre-Alpha'                                                      

cgi

Type:
dict
Value:
{}                                                                     

get

Type:
dict
Value:
{}                                                                     

Generated by Epydoc 2.0 on Mon Nov 10 15:07:40 2003 http://epydoc.sf.net