Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes
MoinMoin.script.MoinScript Class Reference
Inheritance diagram for MoinMoin.script.MoinScript:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.script.MoinScript:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def init_request
def mainloop
def run
def logRuntime

Public Attributes

 request
 argv
 def_values
 parser
 args

Detailed Description

Moin main script class 

Definition at line 154 of file __init__.py.


Constructor & Destructor Documentation

def MoinMoin.script.MoinScript.__init__ (   self,
  argv = None,
  def_values = None 
)

Reimplemented in MoinMoin.script.export.dump.PluginScript, MoinMoin.script.account.check.PluginScript, MoinMoin.script.index.build.IndexScript, MoinMoin.script.import.irclog.PluginScript, MoinMoin.script.export.package.PluginScript, MoinMoin.script.maint.reducewiki.PluginScript, MoinMoin.script.maint.mkpagepacks.PluginScript, MoinMoin.script.maint.mailtranslators.PluginScript, MoinMoin.script.account.homepage.PluginScript, MoinMoin.script.xmlrpc.mailimport.PluginScript, MoinMoin.script.xmlrpc.write.PluginScript, MoinMoin.script.account.disable.PluginScript, MoinMoin.script.maint.cleancache.PluginScript, MoinMoin.script.maint.makecache.PluginScript, MoinMoin.script.maint.globaledit.PluginScript, MoinMoin.script.xmlrpc.remote.PluginScript, MoinMoin.script.account.create.PluginScript, MoinMoin.script.account.resetpw.PluginScript, MoinMoin.script.maint.cleanpage.PluginScript, MoinMoin.script.xmlrpc.retrieve.PluginScript, MoinMoin.script.migration.data.PluginScript, MoinMoin.script.cli.show.PluginScript, and MoinMoin.script.server.standalone.PluginScript.

Definition at line 157 of file __init__.py.

00157 
00158     def __init__(self, argv=None, def_values=None):
00159         Script.__init__(self, "moin", "[general options] command subcommand [specific options]", argv, def_values)
00160         # those are options potentially useful for all sub-commands:
00161         self.parser.add_option(
00162             "--config-dir", metavar="DIR", dest="config_dir",
00163             help=("Path to the directory containing the wiki "
00164                   "configuration files. [default: current directory]")
00165         )
00166         self.parser.add_option(
00167             "--wiki-url", metavar="WIKIURL", dest="wiki_url",
00168             help="URL of a single wiki to migrate e.g. http://localhost/mywiki/ [default: CLI]"
00169         )
00170         self.parser.add_option(
00171             "--page", dest="page", default='',
00172             help="wiki page name [default: all pages]"
00173         )


Member Function Documentation

create request 

Definition at line 174 of file __init__.py.

00174 
00175     def init_request(self):
00176         """ create request """
00177         from MoinMoin.web.contexts import ScriptContext
00178         url = self.options.wiki_url or None
00179         self.request = ScriptContext(url, self.options.page)

Here is the caller graph for this function:

def MoinMoin.script.Script.logRuntime (   self) [inherited]
Print the total command run time. 

Definition at line 148 of file __init__.py.

00148 
00149     def logRuntime(self):
00150         """ Print the total command run time. """
00151         if self.options.show_timing:
00152             log("Needed %.3f secs." % (time.clock() - _start_time, ))
00153 

Here is the call graph for this function:

Reimplemented in MoinMoin.script.account.check.PluginScript, MoinMoin.script.maint.mkpagepacks.PluginScript, MoinMoin.script.export.dump.PluginScript, MoinMoin.script.maint.globaledit.PluginScript, MoinMoin.script.maint.reducewiki.PluginScript, MoinMoin.script.account.homepage.PluginScript, MoinMoin.script.index.build.IndexScript, MoinMoin.script.export.package.PluginScript, MoinMoin.script.import.irclog.PluginScript, MoinMoin.script.maint.cleanpage.PluginScript, MoinMoin.script.server.standalone.PluginScript, MoinMoin.script.account.create.PluginScript, MoinMoin.script.maint.mailtranslators.PluginScript, MoinMoin.script.account.disable.PluginScript, MoinMoin.script.account.resetpw.PluginScript, MoinMoin.script.xmlrpc.write.PluginScript, MoinMoin.script.xmlrpc.mailimport.PluginScript, MoinMoin.script.maint.cleancache.PluginScript, MoinMoin.script.maint.makecache.PluginScript, MoinMoin.script.xmlrpc.remote.PluginScript, MoinMoin.script.xmlrpc.retrieve.PluginScript, MoinMoin.script.migration.data.PluginScript, and MoinMoin.script.cli.show.PluginScript.

Definition at line 180 of file __init__.py.

00180 
00181     def mainloop(self):
00182         # Insert config dir or the current directory to the start of the path.
00183         config_dir = self.options.config_dir
00184         if config_dir:
00185             if os.path.isdir(config_dir):
00186                 sys.path.insert(0, os.path.abspath(config_dir))
00187             else:
00188                 fatal("bad path given to --config-dir option")
00189 
00190         args = self.args
00191         if len(args) < 2:
00192             self.parser.print_help()
00193             fatal("""You must specify a command module and name:
00194 
00195 moin ... account check ...
00196 moin ... account create ...
00197 moin ... account disable ...
00198 moin ... account resetpw ...
00199 
00200 moin ... cli show ...
00201 
00202 moin ... export dump ...
00203 
00204 moin ... import irclog ...
00205 
00206 moin ... index build ...
00207 
00208 moin ... maint cleancache ...
00209 moin ... maint cleanpage ...
00210 moin ... maint globaledit ...
00211 moin ... maint makecache ...
00212 moin ... maint mkpagepacks ...
00213 moin ... maint reducewiki ...
00214 
00215 moin ... migration data ...
00216 
00217 moin ... server standalone ...
00218 
00219 moin ... xmlrpc mailimport ...
00220 moin ... xmlrpc remote ...
00221 
00222 General options:
00223     Most commands need some general parameters before command subcommand:
00224     --config-dir=/config/directory
00225         Mandatory for most commands and specifies the directory that contains
00226         your wikiconfig.py (or farmconfig.py).
00227 
00228     --wiki-url=wiki.example.org/
00229         Mandatory for most commands and specifies the url of the wiki you like
00230         to operate on.
00231 
00232 Specific options:
00233     Most commands need additional parameters after command subcommand.
00234 
00235     To obtain additonal help on a command use 'moin module subcommand --help'
00236 """)
00237 
00238         cmd_module, cmd_name = args[:2]
00239         from MoinMoin import wikiutil
00240         try:
00241             plugin_class = wikiutil.importBuiltinPlugin('script.%s' % cmd_module, cmd_name, 'PluginScript')
00242         except wikiutil.PluginMissingError:
00243             fatal("Command plugin %r, command %r was not found." % (cmd_module, cmd_name))
00244 
00245         # We have to use the args list here instead of optparse, as optparse only
00246         # deals with things coming before command subcommand.
00247         if "--help" in args or "-h" in args:
00248             print "MoinMoin Help - %s/ %s\n" % (cmd_module, cmd_name)
00249             print plugin_class.__doc__
00250             print "Command line reference:"
00251             print "======================="
00252             plugin_class(args[2:], self.options).parser.print_help()
00253         else:
00254             plugin_class(args[2:], self.options).run() # all starts again there
00255 

Here is the call graph for this function:

def MoinMoin.script.Script.run (   self,
  showtime = 1 
) [inherited]
Run the main function of a command. 

Definition at line 130 of file __init__.py.

00130 
00131     def run(self, showtime=1):
00132         """ Run the main function of a command. """
00133         global flag_quiet
00134         try:
00135             try:
00136                 self.options, self.args = self.parser.parse_args(self.argv)
00137                 flag_quiet = self.options.quiet
00138                 # ToDo check if we need to initialize request (self.init_request())
00139                 self.mainloop()
00140             except KeyboardInterrupt:
00141                 log("*** Interrupted by user!")
00142             except SystemExit:
00143                 showtime = 0
00144                 raise
00145         finally:
00146             if showtime:
00147                 self.logRuntime()

Here is the caller graph for this function:


Member Data Documentation

Definition at line 135 of file __init__.py.

Definition at line 102 of file __init__.py.

Definition at line 113 of file __init__.py.

Definition at line 178 of file __init__.py.


The documentation for this class was generated from the following file: