Package posterity :: Package admin :: Module admin :: Class AdminCommand

Class AdminCommand



object --+
         |
        AdminCommand
Known Subclasses:
inject.InjectCommand, init.InitCommand, fetch.FetchCommand, serve.ServeCommand, account.AccountCommand

Posterity admin command base class

New admin commands can dynamically be added to the posterity-admin script by subclassing this class and registering it under the posterity.admin_commands entry point.



Instance Methods
 
__init__(self, cmd_name)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
finalize_options(self)
Decide in the final value for all options and arguments
 
run(self)
Cary out the command's actions
 
run_command(self, argv)
 
setup_optparser(self)
Configure the OptionParser

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables
  cmd_name = None
  run_in_transaction = True
  short_help = ''
  usage = '%prog yourcommand [options] arg1 arg2 ...'
Properties

Inherited from object: __class__

Method Details

__init__(self, cmd_name)
(Constructor)

 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

finalize_options(self)

 

Decide in the final value for all options and arguments

This methiod is called after the command line has been parsed and the resulting options and arguments are stored in self.options and self.args.

If a valid database connection string is stored in self.db_url the following self.run()-call will be wrapped inside a database transaction.

run(self)

 

Cary out the command's actions

This method is invoked after the command line has been parsed. All AdminCommand subclasses need to implement this method.

setup_optparser(self)

 

Configure the OptionParser

Commands that want to accept additional command line options need to define them using The "self.parser.add_option(...)" method. This method will be called before the command line is parsed