parent.frames[1].location.href = url1; parent.frames[2].location.href = url2; } -->
Package gnue :: Package common :: Package apps :: Module GBaseApp :: Class GBaseApp
[show private | hide private]

Class GBaseApp

Known Subclasses:
GClientApp

The base class of the various GNUe application classes.

GBaseApp Provides the following features
Method Summary
  __init__(self, connections, application, defaults)
  addCommandOption(self, *args, **parms)
Create a new command option and add it to the options sequence.
  analyzeCycle(self, cycle)
Return a generator for iterating a given reference cycle.
  buildHelpOptions(self, category)
Build 'help text' for all options of the given category.
  debugGarbageCollection(self, signal, frame)
Debug Python's garbage collection.
  doHelpConfig(self)
Display all configuration settings and their default values and quit the program.
  doSelfDoc(self)
Run the self documentation.
  doVersion(self)
Display the version information and quit the program.
  excepthook(self, etype, value, traceback)
This function catches an exception and evaluates it using getException().
  findCycle(self, search, current, last, path, seen)
Find a reference cycle starting from a given object(current) and ending with a given object(search).
  getCommandLineParameters(self, paramList)
Convert a sequence of parameters (i.e.
  handleStartupError(self, msg)
Display a startup error and exit gracefully.
  printHelp(self)
Print help information for this application and quit the program.
  printHelpConn(self)
Print connection/database-related help information and quit the program.
  printHelpDev(self)
Print help information for this application and quit the program.
  printHelpFooter(self)
Print the help footer including the address for bug reports.
  printHelpHeader(self)
Print version information and the usage header
  printVersion(self)
Display version information for this application
  run(self)
Run the program.
  selfdoc(self, command, handle, format, options)
Run the self-documentation for an application.

Class Variable Summary
list ARGUMENTS = []
str AUTHOR = 'GNU Enterprise Project'
str COMMAND = 'app'
list COMMAND_OPTIONS = []
str CONFIGFILE = 'gnue.conf'
NoneType connections = None                                                                  
str EMAIL = 'info@gnue.org'
str NAME = 'GNUe Application'
dict OPTIONS = {}
str REPORT_BUGS_TO = 'Please report any bugs to info@gnue.or...
str SUMMARY = 'A brief summary of the program goes here.'
str USAGE = '[options]'
int USE_CONNECTIONS = 1                                                                     
int USE_DATABASE_OPTIONS = 0                                                                     
int USE_RPC_OPTIONS = 0                                                                     
str VERSION = '0.0.0'

Method Details

__init__(self, connections=None, application='common', defaults=None)
(Constructor)

Parameters:
connections -
application -
defaults -

addCommandOption(self, *args, **parms)

Create a new command option and add it to the options sequence.
Parameters:
args - positional arguments for the command option's constructor
parms - keyword arguments for the command option's constructor

analyzeCycle(self, cycle)

Return a generator for iterating a given reference cycle.
Parameters:
cycle - None or a sequence of tuples (repr, propertyname)
Returns:
iterator

buildHelpOptions(self, category=None)

Build 'help text' for all options of the given category. If no category is given all options except the 'dev' options will be included.
Parameters:
category - if not None only options of this category will be included.
Returns:
string with the help text for all matching options.

debugGarbageCollection(self, signal, frame)

Debug Python's garbage collection.
Parameters:
signal - signal number caught by this handler (=SIGUSR1)
frame - the current stack frame or None

doHelpConfig(self)

Display all configuration settings and their default values and quit the program.

doSelfDoc(self)

Run the self documentation. If a documentation file is specified the contents will be written to that file, otherwise it will be printed to stdout.

doVersion(self)

Display the version information and quit the program.

excepthook(self, etype, value, traceback)

This function catches an exception and evaluates it using getException(). The exception-tuple is then passed to showException(), which might get overriden by a descendant.

findCycle(self, search, current, last, path, seen)

Find a reference cycle starting from a given object(current) and ending with a given object(search). The result is either None if no such cycle exists, or a sequence of tuples (repr, propertyname) describing the reference cycle. 'repr' is either a string representation of an object holding the reference or None. 'propertyname' could be one of the following:
  • 'name': name of the property within 'repr' holding the reference
  • '[n]': the reference is the n-th element of a sequence
  • '[name]': the reference is the value of key 'name' in a dictionary
  • '{}': the reference is a key in a dictionary
The latter three variants could be cumulative (i.e. [1][3]['foo']) and the corresponding propertyname is the last one encountered.
Returns:
None or sequence of tuples (repr, propertyname)

getCommandLineParameters(self, paramList)

Convert a sequence of parameters (i.e. '--foo=bar') into a parameter dictionary, where the paramter ('--foo') is the key and it's argument ('bar') is the value.
Parameters:
paramList - sequence of parameters (usually from self.ARGUMENTS)
Returns:
dictionary of parameters, splitted by the first '='
Raises:
StartupError - if a parameter has no value assigned

handleStartupError(self, msg)

Display a startup error and exit gracefully. This function is depreciated. Descendants should use the concpet of exceptions instead, which will be handled by the exception hook installed by this class.

printHelp(self)

Print help information for this application and quit the program. This includes the version, the usage, the application's summary and all available command options (without the 'developer' options).

printHelpConn(self)

Print connection/database-related help information and quit the program.

printHelpDev(self)

Print help information for this application and quit the program. This includes the version, usage and all available developer's command options.

printHelpFooter(self)

Print the help footer including the address for bug reports.

printHelpHeader(self)

Print version information and the usage header

printVersion(self)

Display version information for this application

run(self)

Run the program. This function will be overriden by a descendant.

selfdoc(self, command, handle, format=None, options={})

Run the self-documentation for an application. Currently only the command 'manpage' is supported.
Parameters:
command - can be 'manpage' only atm
handle - file-like object to write the documentation contents to. This file handle must be already opened for writing.
format - not used in the current version
options - not used in the current version

Class Variable Details

ARGUMENTS

Type:
list
Value:
[]                                                                     

AUTHOR

Type:
str
Value:
'GNU Enterprise Project'                                               

COMMAND

Type:
str
Value:
'app'                                                                  

COMMAND_OPTIONS

Type:
list
Value:
[]                                                                     

CONFIGFILE

Type:
str
Value:
'gnue.conf'                                                            

connections

Type:
NoneType
Value:
None                                                                  

EMAIL

Type:
str
Value:
'info@gnue.org'                                                        

NAME

Type:
str
Value:
'GNUe Application'                                                     

OPTIONS

Type:
dict
Value:
{}                                                                     

REPORT_BUGS_TO

Type:
str
Value:
'Please report any bugs to info@gnue.org.'                             

SUMMARY

Type:
str
Value:
'A brief summary of the program goes here.'                            

USAGE

Type:
str
Value:
'[options]'                                                            

USE_CONNECTIONS

Type:
int
Value:
1                                                                     

USE_DATABASE_OPTIONS

Type:
int
Value:
0                                                                     

USE_RPC_OPTIONS

Type:
int
Value:
0                                                                     

VERSION

Type:
str
Value:
'0.0.0'                                                                


GNUe Home

Public API

Developer's Corner