Show
Ignore:
Timestamp:
11/13/04 00:46:44 (19 years ago)
Author:
jalet
Message:

Heavy work on pkbanner. Not finished yet though, but mostly works.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/tool.py

    r1898 r1911  
    2222# 
    2323# $Log$ 
     24# Revision 1.138  2004/11/12 23:46:44  jalet 
     25# Heavy work on pkbanner. Not finished yet though, but mostly works. 
     26# 
    2427# Revision 1.137  2004/11/01 16:21:17  jalet 
    2528# Little change for locale+gettext 
     
    539542    return msg 
    540543 
    541 class PyKotaTool :     
    542     """Base class for all PyKota command line tools.""" 
     544class Tool : 
     545    """Base class for tools with no database access.""" 
    543546    def __init__(self, lang="", charset=None, doc="PyKota %s (c) 2003-2004 %s" % (version.__version__, version.__author__)) : 
    544547        """Initializes the command line tool.""" 
     
    588591            self.maildomain = self.config.getMailDomain() 
    589592            self.logger = logger.openLogger(self.config.getLoggingBackend()) 
    590             self.storage = storage.openConnection(self) 
    591593        except (config.PyKotaConfigError, logger.PyKotaLoggingError, storage.PyKotaStorageError), msg : 
    592594            self.crashed(msg) 
     
    614616        sys.stderr.flush() 
    615617         
    616     def clean(self) :     
    617         """Ensures that the database is closed.""" 
    618         try : 
    619             self.storage.close() 
    620         except (TypeError, NameError, AttributeError) :     
    621             pass 
    622              
    623618    def display_version_and_quit(self) : 
    624619        """Displays version number, then exists successfully.""" 
     
    711706        return (parsed, args) 
    712707     
     708class PyKotaTool(Tool) :     
     709    """Base class for all PyKota command line tools.""" 
     710    def __init__(self, lang="", charset=None, doc="PyKota %s (c) 2003-2004 %s" % (version.__version__, version.__author__)) : 
     711        """Initializes the command line tool and opens the database.""" 
     712        Tool.__init__(self, lang, charset, doc) 
     713        try : 
     714            self.storage = storage.openConnection(self) 
     715        except storage.PyKotaStorageError, msg : 
     716            self.crashed(msg) 
     717            raise 
     718         
     719    def clean(self) :     
     720        """Ensures that the database is closed.""" 
     721        try : 
     722            self.storage.close() 
     723        except (TypeError, NameError, AttributeError) :     
     724            pass 
     725             
    713726    def isValidName(self, name) : 
    714727        """Checks if a user or printer name is valid."""