Package svs_core :: Package utilities :: Module objectmanager
[show private | hide private]
[frames | no frames]

Module svs_core.utilities.objectmanager

Provides facilities for dynamic object generation and persistence.

Based on the data manager exmaple in Sean Riley, 2004, 'GameProgramming with Python', Charles River Media.

Author: Simon Yuill

Contact: simon@lipparosa.org

Copyright: 2005 Simon Yuill

License: GNU GPL version 2 or any later version

Classes
ObjectCategory Base class for dynamic objects created from data source.
ObjectManager Provides generators for dynamic classes, created from loaded data.
PersistentObject Supports an object that can be stored and retrived externally.

Exceptions
PersistentObjectException  

Function Summary
  importCodeFromFile(codeFile, name, add_to_sys_modules)
Import dynamically generated code as a module.

Function Details

importCodeFromFile(codeFile, name, add_to_sys_modules=0)

Import dynamically generated code as a module. code is the object containing the code (a string, a file handle or an actual compiled code object, same types as accepted by an exec statement). The name is the name to give to the module, and the final argument says whether to add it to sys.modules or not. If it is added, a subsequent import statement using name will return this module. If it is not added to sys.modules import will try to load it in the normal fashion.

import foo

is equivalent to

foofile = open("/path/to/foo.py") foo = importCode(foofile,"foo",1)

Returns a newly generated module.

Written by Anders Hammarquist, http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82234

Generated by Epydoc 2.1 on Thu Oct 20 15:30:24 2005 http://epydoc.sf.net