Back to index

moin  1.9.0~rc2
Classes | Functions | Variables
MoinMoin.packages Namespace Reference

Classes

class  PackageException
class  ScriptException
class  RuntimeScriptException
class  ScriptExit
class  ScriptEngine
class  Package
class  ZipPackage

Functions

def event_logfile
def edit_logfile_append
def packLine
def unpackLine
def str2boolean
def main

Variables

string MOIN_PACKAGE_FILE = 'MOIN_PACKAGE'
int MAX_VERSION = 1

Class Documentation

class MoinMoin::packages::PackageException
Raised if the package is broken. 

Definition at line 23 of file packages.py.

class MoinMoin::packages::ScriptExit
Raised by the script commands when the script should quit. 

Definition at line 40 of file packages.py.


Function Documentation

def MoinMoin.packages.edit_logfile_append (   self,
  pagename,
  pagefile,
  rev,
  action,
  logname = 'edit-log',
  comment = u'',
  author = u"Scripting Subsystem" 
)

Definition at line 50 of file packages.py.

00050 
00051 def edit_logfile_append(self, pagename, pagefile, rev, action, logname='edit-log', comment=u'', author=u"Scripting Subsystem"):
00052     glog = editlog.EditLog(self.request, uid_override=author)
00053     pagelog = Page(self.request, pagename).getPagePath(logname, use_underlay=0, isfile=1)
00054     llog = editlog.EditLog(self.request, filename=pagelog,
00055                                uid_override=author)
00056     mtime_usecs = wikiutil.timestamp2version(os.path.getmtime(pagefile))
00057     host = '::1'
00058     extra = u''
00059     glog.add(self.request, mtime_usecs, rev, action, pagename, host, comment)
00060     llog.add(self.request, mtime_usecs, rev, action, pagename, host, extra, comment)
00061     event_logfile(self, pagename, pagefile)
00062 
# Parsing and (un)quoting for script files

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.packages.event_logfile (   self,
  pagename,
  pagefile 
)

Definition at line 43 of file packages.py.

00043 
00044 def event_logfile(self, pagename, pagefile):
00045     # add event log entry
00046     eventtype = 'SAVENEW'
00047     mtime_usecs = wikiutil.timestamp2version(os.path.getmtime(pagefile))
00048     elog = eventlog.EventLog(self.request)
00049     elog.add(self.request, eventtype, {'pagename': pagename}, 1, mtime_usecs)

Here is the caller graph for this function:

Definition at line 524 of file packages.py.

00524 
00525 def main():
00526     args = sys.argv
00527     if len(args)-1 not in (2, 3) or args[1] not in ('l', 'i'):
00528         print >> sys.stderr, """MoinMoin Package Installer v%(version)i
00529 
00530 %(myname)s action packagefile [request URL]
00531 
00532 action      - Either "l" for listing the script or "i" for installing.
00533 packagefile - The path to the file containing the MoinMoin installer package
00534 request URL - Just needed if you are running a wiki farm, used to differentiate
00535               the correct wiki.
00536 
00537 Example:
00538 
00539 %(myname)s i ../package.zip
00540 
00541 """ % {"version": MAX_VERSION, "myname": os.path.basename(args[0])}
00542         raise SystemExit
00543 
00544     packagefile = args[2]
00545     if len(args) > 3:
00546         request_url = args[3]
00547     else:
00548         request_url = None
00549 
00550     # Setup MoinMoin environment
00551     from MoinMoin.web.contexts import ScriptContext
00552     request = ScriptContext(url=request_url)
00553 
00554     package = ZipPackage(request, packagefile)
00555     if not package.isPackage():
00556         print "The specified file %s is not a package." % packagefile
00557         raise SystemExit
00558 
00559     if args[1] == 'l':
00560         print package.getScript()
00561     elif args[1] == 'i':
00562         if package.installPackage():
00563             print "Installation was successful!"
00564         else:
00565             print "Installation failed."
00566         if package.msg:
00567             print package.msg

def MoinMoin.packages.packLine (   items,
  separator = "|" 
)
Packs a list of items into a string that is separated by `separator`. 

Definition at line 63 of file packages.py.

00063 
00064 def packLine(items, separator="|"):
00065     """ Packs a list of items into a string that is separated by `separator`. """
00066     return '|'.join([item.replace('\\', '\\\\').replace(separator, '\\' + separator) for item in items])

Here is the caller graph for this function:

Converts the parameter to a boolean value by recognising different
truth literals.

Definition at line 91 of file packages.py.

00091 
00092 def str2boolean(string):
00093     """
00094     Converts the parameter to a boolean value by recognising different
00095     truth literals.
00096     """
00097     return (string.lower() in ('yes', 'true', '1'))

Here is the caller graph for this function:

def MoinMoin.packages.unpackLine (   string,
  separator = "|" 
)
Unpacks a string that was packed by packLine. 

Definition at line 67 of file packages.py.

00067 
00068 def unpackLine(string, separator="|"):
00069     """ Unpacks a string that was packed by packLine. """
00070     result = []
00071     token = None
00072     escaped = False
00073     for char in string:
00074         if token is None:
00075             token = ""
00076         if escaped and char in ('\\', separator):
00077             token += char
00078             escaped = False
00079             continue
00080         escaped = (char == '\\')
00081         if escaped:
00082             continue
00083         if char == separator:
00084             result.append(token)
00085             token = ""
00086         else:
00087             token += char
00088     if token is not None:
00089         result.append(token)
00090     return result

Here is the caller graph for this function:


Variable Documentation

Definition at line 19 of file packages.py.

string MoinMoin.packages.MOIN_PACKAGE_FILE = 'MOIN_PACKAGE'

Definition at line 18 of file packages.py.