Changeset 62f3dd9 for fedd/fedd.py


Ignore:
Timestamp:
Dec 10, 2010 9:00:16 AM (13 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master
Children:
913dc7a
Parents:
fbee30a
git-author:
Ted Faber <faber@…> (12/09/10 11:41:45)
git-committer:
Ted Faber <faber@…> (12/10/10 09:00:16)
Message:

allow command line progams to expand tildes. Added a class derived from OptionParser? to make that easily available.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/fedd.py

    rfbee30a r62f3dd9  
    77from federation import config_parser
    88from federation.server import server, xmlrpc_handler, soap_handler
    9 from federation.util import fedd_ssl_context
     9from federation.util import fedd_ssl_context, file_expanding_opts
    1010from federation.deter_impl import new_feddservice
    1111
     
    1818import logging
    1919import M2Crypto
    20 
    21 class fedd_opts(OptionParser):
     20import os.path
     21
     22class fedd_opts(file_expanding_opts):
    2223    """Encapsulate option processing in this class, rather than in main"""
     24
    2325    def __init__(self):
    24         OptionParser.__init__(self, usage="%prog [opts] (--help for details)",
     26        file_expanding_opts.__init__(self,
     27                usage="%prog [opts] (--help for details)",
    2528                version="0.1")
    2629
     
    2932        self.add_option("-d", "--debug", action="count", dest="debug",
    3033                help="Set debug.  Repeat for more information")
    31         self.add_option("-f", "--configfile", action="store",
     34        self.add_option("-f", "--configfile", action="callback",
     35                callback=self.expand_file, type='str',
    3236                default="/usr/local/etc/fedd.conf",
    33                 dest="configfile", help="Configuration file (required)")
     37                dest="configfile", help="Configuration file")
    3438        self.add_option("-l", "--logfile", action="store", dest="logfile",
    3539                help="File to send log messages to")
Note: See TracChangeset for help on using the changeset viewer.