Back to index

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

List of all members.

Public Member Functions

def __init__
def mainloop
def init_request
def run
def logRuntime

Public Attributes

 request
 argv
 def_values
 parser
 args

Detailed Description

Migration script class 

Definition at line 25 of file data.py.


Constructor & Destructor Documentation

def MoinMoin.script.migration.data.PluginScript.__init__ (   self,
  argv,
  def_values 
)

Reimplemented from MoinMoin.script.MoinScript.

Definition at line 28 of file data.py.

00028 
00029     def __init__(self, argv, def_values):
00030         MoinScript.__init__(self, argv, def_values)
00031         self.parser.add_option(
00032             "--all", action="store_true", dest="all_wikis",
00033             help="when given, update all wikis that belong to this farm"
00034         )


Member Function Documentation

def MoinMoin.script.MoinScript.init_request (   self) [inherited]
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 from MoinMoin.script.MoinScript.

Definition at line 35 of file data.py.

00035 
00036     def mainloop(self):
00037         self.init_request()
00038         request = self.request
00039         data_dir = request.cfg.data_dir
00040         meta_fname = os.path.join(data_dir, 'meta')
00041         while True:
00042             try:
00043                 meta = wikiutil.MetaDict(meta_fname, request.cfg.cache_dir)
00044                 try:
00045                     curr_rev = meta['data_format_revision']
00046                     mig_name = str(curr_rev)
00047                     execute = wikiutil.importBuiltinPlugin('script.migration', mig_name)
00048                     print "Calling migration script for %s, base revision %d" % (data_dir, curr_rev)
00049                     curr_rev = execute(self, data_dir, curr_rev)
00050                     if curr_rev is None:
00051                         print "Final mig script reached, migration is complete."
00052                         break
00053                     else:
00054                         print "Returned. New rev is %d." % curr_rev
00055                         meta['data_format_revision'] = curr_rev
00056                         meta.sync()
00057                 except wikiutil.PluginMissingError:
00058                     print "Error: There is no script for %s." % mig_name
00059                     break
00060             finally:
00061                 del meta
00062 

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: