Show
Ignore:
Timestamp:
07/08/05 18:52:50 (19 years ago)
Author:
jerome
Message:

Moved the GPL blurb into a single location.
Now uses named parameters in commands' help.

Files:
1 modified

Legend:

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

    r2307 r2344  
    4040from mx import DateTime 
    4141 
    42 from pykota import version, config, storage, logger, accounter, pdlanalyzer 
     42from pykota import config, storage, logger, accounter, pdlanalyzer 
     43from pykota.version import __version__, __author__, __years__, __gplblurb__ 
    4344 
    4445def N_(message) : 
     
    6162    for line in traceback.format_exception(*sys.exc_info()) : 
    6263        lines.extend([l for l in line.split("\n") if l]) 
    63     msg = "ERROR: ".join(["%s\n" % l for l in (["ERROR: PyKota v%s" % version.__version__, message] + lines)]) 
     64    msg = "ERROR: ".join(["%s\n" % l for l in (["ERROR: PyKota v%s" % __version__, message] + lines)]) 
    6465    sys.stderr.write(msg) 
    6566    sys.stderr.flush() 
     
    6869class Tool : 
    6970    """Base class for tools with no database access.""" 
    70     def __init__(self, lang="", charset=None, doc="PyKota v%s (c) %s %s" % (version.__version__, version.__copyright__, version.__author__)) : 
     71    def __init__(self, lang="", charset=None, doc="PyKota v%(__version__)s (c) %(__years__)s %(__author__)s") : 
    7172        """Initializes the command line tool.""" 
    7273        # did we drop priviledges ? 
     
    206207        except AttributeError :     
    207208            pass 
    208         print version.__version__ 
     209        print __version__ 
    209210        sys.exit(0) 
    210211     
     
    215216        except AttributeError :     
    216217            pass 
    217         print _(self.documentation) % (version.__version__, version.__copyright__, version.__author__, version.__author__) 
     218        print _(self.documentation) % globals() 
     219        print __gplblurb__ 
     220        print 
     221        print _("Please report bugs to :"), __author__ 
    218222        sys.exit(0) 
    219223         
     
    232236                server.sendmail(admin, [admin, crashrecipient], \ 
    233237                                       "From: %s\nTo: %s\nCc: %s\nSubject: PyKota v%s crash traceback !\n\n%s" % \ 
    234                                        (admin, crashrecipient, admin, version.__version__, fullmessage)) 
     238                                       (admin, crashrecipient, admin, __version__, fullmessage)) 
    235239                server.quit() 
    236240        except : 
     
    299303class PyKotaTool(Tool) :     
    300304    """Base class for all PyKota command line tools.""" 
    301     def __init__(self, lang="", charset=None, doc="PyKota %s (c) 2003-2004 %s" % (version.__version__, version.__author__)) : 
     305    def __init__(self, lang="", charset=None, doc="PyKota v%(__version__)s (c) %(__years__)s %(__author__)s") : 
    302306        """Initializes the command line tool and opens the database.""" 
    303307        Tool.__init__(self, lang, charset, doc)