Changeset 1911 for pykota/trunk/pykota/tool.py
- Timestamp:
- 11/13/04 00:46:44 (19 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/tool.py
r1898 r1911 22 22 # 23 23 # $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 # 24 27 # Revision 1.137 2004/11/01 16:21:17 jalet 25 28 # Little change for locale+gettext … … 539 542 return msg 540 543 541 class PyKotaTool :542 """Base class for all PyKota command line tools."""544 class Tool : 545 """Base class for tools with no database access.""" 543 546 def __init__(self, lang="", charset=None, doc="PyKota %s (c) 2003-2004 %s" % (version.__version__, version.__author__)) : 544 547 """Initializes the command line tool.""" … … 588 591 self.maildomain = self.config.getMailDomain() 589 592 self.logger = logger.openLogger(self.config.getLoggingBackend()) 590 self.storage = storage.openConnection(self)591 593 except (config.PyKotaConfigError, logger.PyKotaLoggingError, storage.PyKotaStorageError), msg : 592 594 self.crashed(msg) … … 614 616 sys.stderr.flush() 615 617 616 def clean(self) :617 """Ensures that the database is closed."""618 try :619 self.storage.close()620 except (TypeError, NameError, AttributeError) :621 pass622 623 618 def display_version_and_quit(self) : 624 619 """Displays version number, then exists successfully.""" … … 711 706 return (parsed, args) 712 707 708 class 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 713 726 def isValidName(self, name) : 714 727 """Checks if a user or printer name is valid."""