mς ρΤ5;c@s>dZdkZdkZdZdfd„ƒYZeƒZdS(sξ Central Registry for sys.exitfunc()-type functions Copyright (c) 1997-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com See the documentation for further information on copyrights, or contact the author. All Rights Reserved. Ns0.1tExitFunctionDispatchercBsJtZdZd„Zeiieieid„Z dd„Z d„Z RS(sŠ Singleton that manages exit functions. These function will be called upon system exit in reverse order of their registering. cCsBg|_ttdƒoti|_n d|_|it_dS(s2 Install the dispatcher as sys.exitfunc() texitfuncN(tselft exitfunc_listthasattrtsysRt old_exitfunctNone(R((tC/data/zmath/lib/python2.4/site-packages/mx/BeeBase/ExitFunctions.pyt__init__s   cCscxD|iD]9}y |ƒWq |d|iƒ|d|ƒq Xq W|io|iƒndS(sw This is the exitfunc that we install to dispatch the processing to the registered other functions s'Error while executing Exitfunction %s: i N(RRtftwritet__name__t print_exctstderrR(RR R RR ((RRs   icCs?|djo|t|iƒd}n|ii||ƒdS(s¦ Register f as exit function. These functions must not take parameters. - position = 0: register the function at the beginning of the list; these functions get called before the functions already in the list (default) - position = -1: register the function at the end of the list; the function will get called after all other functions iiN(tpositiontlenRRtinsertR (RR R((Rtregister-s  cCs"y|ii|ƒWnnXdS(sv Remove the function f from the exitfunc list; if it is not found, the error is silently ignored. N(RRtremoveR (RR ((Rt deregister;s ( R t __module__t__doc__R RRR t tracebackR RRR(((RR s   (RRRt __version__Rt ExitFunctions(RRRRR((Rt?s;