Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Private Member Functions
MoinMoin.xmlrpc.XmlRpcBase Class Reference
Inheritance diagram for MoinMoin.xmlrpc.XmlRpcBase:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def process
def dispatch
def notAllowedFault
def noSuchPageFault
def noLogEntryFault
def xmlrpc_system_multicall
 System methods.
def xmlrpc_getRPCVersionSupported
 Interface implementation.
def xmlrpc_getAllPages
def xmlrpc_getAllPagesEx
def xmlrpc_getRecentChanges
def xmlrpc_getPageInfo
def xmlrpc_getPageInfoVersion
def xmlrpc_getPage
def xmlrpc_getPageVersion
def xmlrpc_getPageHTML
def xmlrpc_getPageHTMLVersion
def xmlrpc_listLinks
def xmlrpc_putPage
def xmlrpc_revertPage
def xmlrpc_searchPages
def xmlrpc_searchPagesEx
def xmlrpc_getMoinVersion
def xmlrpc_getUserProfile
def xmlrpc_getUserLanguageByJID
def xmlrpc_getAuthToken
def xmlrpc_getJabberAuthToken
def xmlrpc_applyAuthToken
def xmlrpc_deleteAuthToken
def xmlrpc_getDiff
def xmlrpc_interwikiName
def xmlrpc_mergeDiff
def xmlrpc_listAttachments
def xmlrpc_getAttachment
def xmlrpc_putAttachment
def xmlrpc_getBotTranslations

Public Attributes

 request
 version
 cfg

Private Member Functions

def _instr
 Helper functions.
def _outstr
def _inlob
def _outlob
def _dump_exc

Detailed Description

XMLRPC base class with common functionality of wiki xmlrpc v1 and v2 

Definition at line 43 of file __init__.py.


Constructor & Destructor Documentation

def MoinMoin.xmlrpc.XmlRpcBase.__init__ (   self,
  request 
)
Initialize an XmlRpcBase object.
@param request: the request object

Reimplemented in MoinMoin.xmlrpc.XmlRpc2, and MoinMoin.xmlrpc.XmlRpc1.

Definition at line 45 of file __init__.py.

00045 
00046     def __init__(self, request):
00047         """
00048         Initialize an XmlRpcBase object.
00049         @param request: the request object
00050         """
00051         self.request = request
00052         self.version = None # this has to be defined in derived class
00053         self.cfg = request.cfg


Member Function Documentation

def MoinMoin.xmlrpc.XmlRpcBase._dump_exc (   self) [private]
Convert an exception to a string.

@rtype: str
@return: traceback as string

Definition at line 101 of file __init__.py.

00101 
00102     def _dump_exc(self):
00103         """ Convert an exception to a string.
00104 
00105         @rtype: str
00106         @return: traceback as string
00107         """
00108         import traceback
00109 
00110         return "%s: %s\n%s" % (
00111             sys.exc_info()[0],
00112             sys.exc_info()[1],
00113             '\n'.join(traceback.format_tb(sys.exc_info()[2])),
00114         )

Here is the caller graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase._inlob (   self,
  text 
) [private]
Convert inbound base64-encoded utf-8 to Large OBject.

@param text: the text to convert
@rtype: unicode
@return: text

Definition at line 76 of file __init__.py.

00076 
00077     def _inlob(self, text):
00078         """ Convert inbound base64-encoded utf-8 to Large OBject.
00079 
00080         @param text: the text to convert
00081         @rtype: unicode
00082         @return: text
00083         """
00084         text = text.data #this is a already base64-decoded 8bit string
00085         text = unicode(text, 'utf-8')
00086         return text

Here is the caller graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase._instr (   self,
  text 
) [private]

Helper functions.

Convert inbound string.

@param text: the text to convert (encoded str or unicode)
@rtype: unicode
@return: text as unicode

Reimplemented in MoinMoin.xmlrpc.XmlRpc2, and MoinMoin.xmlrpc.XmlRpc1.

Definition at line 58 of file __init__.py.

00058 
00059     def _instr(self, text):
00060         """ Convert inbound string.
00061 
00062         @param text: the text to convert (encoded str or unicode)
00063         @rtype: unicode
00064         @return: text as unicode
00065         """
00066         raise NotImplementedError("please implement _instr in derived class")

Here is the caller graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase._outlob (   self,
  text 
) [private]
Convert outbound Large OBject to base64-encoded utf-8.

@param text: the text, either unicode or utf-8 string
@rtype: str
@return: xmlrpc Binary object

Definition at line 87 of file __init__.py.

00087 
00088     def _outlob(self, text):
00089         """ Convert outbound Large OBject to base64-encoded utf-8.
00090 
00091         @param text: the text, either unicode or utf-8 string
00092         @rtype: str
00093         @return: xmlrpc Binary object
00094         """
00095         if isinstance(text, unicode):
00096             text = text.encode('utf-8')
00097         else:
00098             if config.charset != 'utf-8':
00099                 text = unicode(text, config.charset).encode('utf-8')
00100         return xmlrpclib.Binary(text)

Here is the caller graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase._outstr (   self,
  text 
) [private]
Convert outbound string.

@param text: the text to convert (encoded str or unicode)
@rtype: str
@return: text as encoded str

Reimplemented in MoinMoin.xmlrpc.XmlRpc2, and MoinMoin.xmlrpc.XmlRpc1.

Definition at line 67 of file __init__.py.

00067 
00068     def _outstr(self, text):
00069         """ Convert outbound string.
00070 
00071         @param text: the text to convert (encoded str or unicode)
00072         @rtype: str
00073         @return: text as encoded str
00074         """
00075         raise NotImplementedError("please implement _outstr in derived class")

Here is the caller graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.dispatch (   self,
  method,
  params 
)
call dispatcher - for method==xxx it either locates a method called
    xmlrpc_xxx or loads a plugin from plugin/xmlrpc/xxx.py

Definition at line 162 of file __init__.py.

00162 
00163     def dispatch(self, method, params):
00164         """ call dispatcher - for method==xxx it either locates a method called
00165             xmlrpc_xxx or loads a plugin from plugin/xmlrpc/xxx.py
00166         """
00167         method = method.replace(".", "_")
00168 
00169         try:
00170             fn = getattr(self, 'xmlrpc_' + method)
00171         except AttributeError:
00172             try:
00173                 fn = wikiutil.importPlugin(self.request.cfg, 'xmlrpc',
00174                                            method, 'execute')
00175             except wikiutil.PluginMissingError:
00176                 response = xmlrpclib.Fault(1, "No such method: %s." %
00177                                            method)
00178             else:
00179                 response = fn(self, *params)
00180         else:
00181             response = fn(*params)
00182 
00183         return response

Here is the caller graph for this function:

Definition at line 192 of file __init__.py.

00192 
00193     def noLogEntryFault(self):
00194         return xmlrpclib.Fault(1, "No log entry was found.")

Here is the caller graph for this function:

Definition at line 189 of file __init__.py.

00189 
00190     def noSuchPageFault(self):
00191         return xmlrpclib.Fault(1, "No such page was found.")

Here is the caller graph for this function:

Definition at line 186 of file __init__.py.

00186 
00187     def notAllowedFault(self):
00188         return xmlrpclib.Fault(1, "You are not allowed to read this page.")

Here is the caller graph for this function:

xmlrpc v1 and v2 dispatcher 

Definition at line 115 of file __init__.py.

00115 
00116     def process(self):
00117         """ xmlrpc v1 and v2 dispatcher """
00118         request = self.request
00119         try:
00120             if 'xmlrpc' in self.request.cfg.actions_excluded:
00121                 # we do not handle xmlrpc v1 and v2 differently
00122                 response = xmlrpclib.Fault(1, "This moin wiki does not allow xmlrpc method calls.")
00123             else:
00124                 data = request.in_data
00125 
00126                 try:
00127                     params, method = xmlrpclib.loads(data)
00128                 except:
00129                     # if anything goes wrong here, we want to see the raw data:
00130                     logging.debug("Length of raw data: %d bytes" % len(data))
00131                     logging.debug(logging_tearline % 'request raw data begin')
00132                     logging.debug('%r' % data)
00133                     logging.debug(logging_tearline % 'request raw data end')
00134                     raise
00135 
00136                 logging.debug(logging_tearline % 'request parsed data begin')
00137                 logging.debug('%s(%r)' % (method, params))
00138                 logging.debug(logging_tearline % 'request parsed data end')
00139 
00140                 response = self.dispatch(method, params)
00141         except:
00142             logging.exception("An exception occurred (this is also sent as fault response to the client):")
00143             # report exception back to client
00144             response = xmlrpclib.dumps(xmlrpclib.Fault(1, self._dump_exc()))
00145         else:
00146             logging.debug(logging_tearline % 'response begin')
00147             logging.debug(response)
00148             logging.debug(logging_tearline % 'response end')
00149 
00150             if isinstance(response, xmlrpclib.Fault):
00151                 response = xmlrpclib.dumps(response)
00152             else:
00153                 # wrap response in a singleton tuple
00154                 response = (response, )
00155                 # serialize it
00156                 response = xmlrpclib.dumps(response, methodresponse=1, allow_none=True)
00157 
00158         request = request.request
00159         request.content_type = 'text/xml'
00160         request.data = response
00161         return request

Here is the call graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_applyAuthToken (   self,
  auth_token 
)
Applies the auth token and thereby authenticates the user. 

Definition at line 704 of file __init__.py.

00704 
00705     def xmlrpc_applyAuthToken(self, auth_token):
00706         """ Applies the auth token and thereby authenticates the user. """
00707         if not auth_token:
00708             return xmlrpclib.Fault("INVALID", "Empty token.")
00709 
00710         request = self.request
00711         request.session = request.cfg.session_service.get_session(request, auth_token)
00712         u = auth.setup_from_session(request, request.session)
00713 
00714         if u and u.valid:
00715             self.request.user = u
00716             return "SUCCESS"
00717         else:
00718             return xmlrpclib.Fault("INVALID", "Invalid token.")
00719 

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_deleteAuthToken (   self,
  auth_token 
)
Delete the given auth token. 

Definition at line 720 of file __init__.py.

00720 
00721     def xmlrpc_deleteAuthToken(self, auth_token):
00722         """ Delete the given auth token. """
00723         if not auth_token:
00724             return xmlrpclib.Fault("INVALID", "Empty token.")
00725 
00726         request = self.request
00727         request.session = request.cfg.session_service.get_session(request, auth_token)
00728         request.cfg.session_service.destroy_session(request, request.session)
00729 
00730         return "SUCCESS"
00731 

Get all pages readable by current user

@rtype: list
@return: a list of all pages.

Definition at line 247 of file __init__.py.

00247 
00248     def xmlrpc_getAllPages(self):
00249         """ Get all pages readable by current user
00250 
00251         @rtype: list
00252         @return: a list of all pages.
00253         """
00254 
00255         # the official WikiRPC interface is implemented by the extended method
00256         # as well
00257         return self.xmlrpc_getAllPagesEx()
00258 

Here is the call graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_getAllPagesEx (   self,
  opts = None 
)
Get all pages readable by current user. Not an WikiRPC method.

@param opts: dictionary that can contain the following arguments:
include_system:: set it to false if you do not want to see system pages
include_revno:: set it to True if you want to have lists with [pagename, revno]
include_deleted:: set it to True if you want to include deleted pages
exclude_non_writable:: do not include pages that the current user may not write to
include_underlay:: return underlay pagenames as well
prefix:: the page name must begin with this prefix to be included
mark_deleted:: returns the revision number -rev_no if the page was deleted.
    Makes only sense if you enable include_revno and include_deleted.
@rtype: list
@return: a list of all pages.

Definition at line 259 of file __init__.py.

00259 
00260     def xmlrpc_getAllPagesEx(self, opts=None):
00261         """ Get all pages readable by current user. Not an WikiRPC method.
00262 
00263         @param opts: dictionary that can contain the following arguments:
00264                 include_system:: set it to false if you do not want to see system pages
00265                 include_revno:: set it to True if you want to have lists with [pagename, revno]
00266                 include_deleted:: set it to True if you want to include deleted pages
00267                 exclude_non_writable:: do not include pages that the current user may not write to
00268                 include_underlay:: return underlay pagenames as well
00269                 prefix:: the page name must begin with this prefix to be included
00270                 mark_deleted:: returns the revision number -rev_no if the page was deleted.
00271                     Makes only sense if you enable include_revno and include_deleted.
00272         @rtype: list
00273         @return: a list of all pages.
00274         """
00275         from MoinMoin.wikisync import normalise_pagename
00276         options = {"include_system": True, "include_revno": False, "include_deleted": False,
00277                    "exclude_non_writable": False, "include_underlay": True, "prefix": "",
00278                    "pagelist": None, "mark_deleted": False}
00279         if opts is not None:
00280             options.update(opts)
00281 
00282         if not options["include_system"]:
00283             p_filter = lambda name: not wikiutil.isSystemPage(self.request, name)
00284         else:
00285             p_filter = lambda name: True
00286 
00287         if options["exclude_non_writable"]:
00288             p_filter = lambda name, p_filter=p_filter: p_filter(name) and self.request.user.may.write(name)
00289 
00290         if options["prefix"] or options["pagelist"]:
00291             def p_filter(name, p_filter=p_filter, prefix=(options["prefix"] or ""), pagelist=options["pagelist"]):
00292                 if not p_filter(name):
00293                     return False
00294                 n_name = normalise_pagename(name, prefix)
00295                 if not n_name:
00296                     return False
00297                 if not pagelist:
00298                     return True
00299                 return n_name in pagelist
00300 
00301         pagelist = self.request.rootpage.getPageList(filter=p_filter, exists=not options["include_deleted"],
00302                                                      include_underlay=options["include_underlay"],
00303                                                      return_objects=options["include_revno"])
00304 
00305         if options['include_revno']:
00306             pages = []
00307             for page in pagelist:
00308                 revno = page.get_real_rev()
00309                 if options["mark_deleted"] and not page.exists():
00310                     revno = -revno
00311                 pages.append([self._outstr(page.page_name), revno])
00312             return pages
00313         else:
00314             return [self._outstr(page) for page in pagelist]

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_getAttachment (   self,
  pagename,
  attachname 
)
Get attachname associated with pagename

@param pagename: pagename (utf-8)
@param attachname: attachment name (utf-8)
@rtype base64
@return base64 data

Definition at line 939 of file __init__.py.

00939 
00940     def xmlrpc_getAttachment(self, pagename, attachname):
00941         """ Get attachname associated with pagename
00942 
00943         @param pagename: pagename (utf-8)
00944         @param attachname: attachment name (utf-8)
00945         @rtype base64
00946         @return base64 data
00947         """
00948         pagename = self._instr(pagename)
00949         # User may read page?
00950         if not self.request.user.may.read(pagename):
00951             return self.notAllowedFault()
00952 
00953         filename = wikiutil.taintfilename(self._instr(attachname))
00954         filename = AttachFile.getFilename(self.request, pagename, filename)
00955         if not os.path.isfile(filename):
00956             return self.noSuchPageFault()
00957         return self._outlob(open(filename, 'rb').read())

Here is the call graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_getAuthToken (   self,
  username,
  password,
  args 
)
Returns a token which can be used for authentication
    in other XMLRPC calls. If the token is empty, the username
    or the password were wrong.

    Implementation note: token is same as cookie content would be for http session

Definition at line 665 of file __init__.py.

00665 
00666     def xmlrpc_getAuthToken(self, username, password, *args):
00667         """ Returns a token which can be used for authentication
00668             in other XMLRPC calls. If the token is empty, the username
00669             or the password were wrong.
00670 
00671             Implementation note: token is same as cookie content would be for http session
00672         """
00673         request = self.request
00674         request.session = request.cfg.session_service.get_session(request)
00675 
00676         u = auth.setup_from_session(request, request.session)
00677         u = auth.handle_login(request, u, username=username, password=password)
00678 
00679         if u and u.valid:
00680             request.user = u
00681             request.cfg.session_service.finalize(request, request.session)
00682             return request.session.sid
00683         else:
00684             return ""

Return translations to be used by notification bot

@return: a dict (indexed by language) of dicts of translated strings (indexed by original ones)

Definition at line 987 of file __init__.py.

00987 
00988     def xmlrpc_getBotTranslations(self):
00989         """ Return translations to be used by notification bot
00990 
00991         @return: a dict (indexed by language) of dicts of translated strings (indexed by original ones)
00992         """
00993         from MoinMoin.i18n import bot_translations
00994         return bot_translations(self.request)
00995 

Here is the call graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_getDiff (   self,
  pagename,
  from_rev,
  to_rev,
  n_name = None 
)
Gets the binary difference between two page revisions.

    @param pagename: unicode string qualifying the page name

    @param fromRev: integer specifying the source revision. May be None to
    refer to a virtual empty revision which leads to a diff
    containing the whole page.

    @param toRev: integer specifying the target revision. May be None to
    refer to the current revision. If the current revision is the same
    as fromRev, there will be a special error condition "ALREADY_CURRENT"

    @param n_name: do a tag check verifying that n_name was the normalised
    name of the last tag

    If both fromRev and toRev are None, this function acts similar to getPage, i.e. it will diff("",currentRev).

    @return Returns a dict:
    * status (not a field, implicit, returned as Fault if not SUCCESS):
     * "SUCCESS" - if the diff could be retrieved successfully
     * "NOT_EXIST" - item does not exist
     * "FROMREV_INVALID" - the source revision is invalid
     * "TOREV_INVALID" - the target revision is invalid
     * "INTERNAL_ERROR" - there was an internal error
     * "INVALID_TAG" - the last tag does not match the supplied normalised name
     * "ALREADY_CURRENT" - this not merely an error condition. It rather means that
     there is no new revision to diff against which is a good thing while
     synchronisation.
    * current: the revision number of the current revision (not the one which was diff'ed against)
    * diff: Binary object that transports a zlib-compressed binary diff (see bdiff.py, taken from Mercurial)
    * conflict: if there is a conflict on the page currently

Definition at line 734 of file __init__.py.

00734 
00735     def xmlrpc_getDiff(self, pagename, from_rev, to_rev, n_name=None):
00736         """ Gets the binary difference between two page revisions.
00737 
00738             @param pagename: unicode string qualifying the page name
00739 
00740             @param fromRev: integer specifying the source revision. May be None to
00741             refer to a virtual empty revision which leads to a diff
00742             containing the whole page.
00743 
00744             @param toRev: integer specifying the target revision. May be None to
00745             refer to the current revision. If the current revision is the same
00746             as fromRev, there will be a special error condition "ALREADY_CURRENT"
00747 
00748             @param n_name: do a tag check verifying that n_name was the normalised
00749             name of the last tag
00750 
00751             If both fromRev and toRev are None, this function acts similar to getPage, i.e. it will diff("",currentRev).
00752 
00753             @return Returns a dict:
00754             * status (not a field, implicit, returned as Fault if not SUCCESS):
00755              * "SUCCESS" - if the diff could be retrieved successfully
00756              * "NOT_EXIST" - item does not exist
00757              * "FROMREV_INVALID" - the source revision is invalid
00758              * "TOREV_INVALID" - the target revision is invalid
00759              * "INTERNAL_ERROR" - there was an internal error
00760              * "INVALID_TAG" - the last tag does not match the supplied normalised name
00761              * "ALREADY_CURRENT" - this not merely an error condition. It rather means that
00762              there is no new revision to diff against which is a good thing while
00763              synchronisation.
00764             * current: the revision number of the current revision (not the one which was diff'ed against)
00765             * diff: Binary object that transports a zlib-compressed binary diff (see bdiff.py, taken from Mercurial)
00766             * conflict: if there is a conflict on the page currently
00767 
00768         """
00769         from MoinMoin.util.bdiff import textdiff, compress
00770         from MoinMoin.wikisync import TagStore
00771 
00772         pagename = self._instr(pagename)
00773         if n_name is not None:
00774             n_name = self._instr(n_name)
00775 
00776         # User may read page?
00777         if not self.request.user.may.read(pagename):
00778             return self.notAllowedFault()
00779 
00780         def allowed_rev_type(data):
00781             if data is None:
00782                 return True
00783             return isinstance(data, int) and data > 0
00784 
00785         if not allowed_rev_type(from_rev):
00786             return xmlrpclib.Fault("FROMREV_INVALID", "Incorrect type for from_rev.")
00787 
00788         if not allowed_rev_type(to_rev):
00789             return xmlrpclib.Fault("TOREV_INVALID", "Incorrect type for to_rev.")
00790 
00791         currentpage = Page(self.request, pagename)
00792         if not currentpage.exists():
00793             return xmlrpclib.Fault("NOT_EXIST", "Page does not exist.")
00794 
00795         revisions = currentpage.getRevList()
00796 
00797         if from_rev is not None and from_rev not in revisions:
00798             return xmlrpclib.Fault("FROMREV_INVALID", "Unknown from_rev.")
00799         if to_rev is not None and to_rev not in revisions:
00800             return xmlrpclib.Fault("TOREV_INVALID", "Unknown to_rev.")
00801 
00802         # use lambda to defer execution in the next lines
00803         if from_rev is None:
00804             oldcontents = lambda: ""
00805         else:
00806             oldpage = Page(self.request, pagename, rev=from_rev)
00807             oldcontents = lambda: oldpage.get_raw_body_str()
00808 
00809         if to_rev is None:
00810             newpage = currentpage
00811             newcontents = lambda: currentpage.get_raw_body_str()
00812         else:
00813             newpage = Page(self.request, pagename, rev=to_rev)
00814             newcontents = lambda: newpage.get_raw_body_str()
00815 
00816         if oldcontents() and oldpage.get_real_rev() == newpage.get_real_rev():
00817             return xmlrpclib.Fault("ALREADY_CURRENT", "There are no changes.")
00818 
00819         if n_name is not None:
00820             tags = TagStore(newpage)
00821             last_tag = tags.get_last_tag()
00822             if last_tag is not None and last_tag.normalised_name != n_name:
00823                 return xmlrpclib.Fault("INVALID_TAG", "The used tag is incorrect because the normalised name does not match.")
00824 
00825         newcontents = newcontents()
00826         conflict = wikiutil.containsConflictMarker(newcontents)
00827         diffblob = xmlrpclib.Binary(compress(textdiff(oldcontents(), newcontents)))
00828 
00829         return {"conflict": conflict, "diff": diffblob, "diffversion": 1, "current": currentpage.get_real_rev()}

Here is the call graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_getJabberAuthToken (   self,
  jid,
  secret 
)
Returns a token which can be used for authentication.

This token can be used in other XMLRPC calls. Generation of
token depends on user's JID and a secret shared between wiki
and Jabber bot.

@param jid: a bare Jabber ID

Definition at line 685 of file __init__.py.

00685 
00686     def xmlrpc_getJabberAuthToken(self, jid, secret):
00687         """Returns a token which can be used for authentication.
00688 
00689         This token can be used in other XMLRPC calls. Generation of
00690         token depends on user's JID and a secret shared between wiki
00691         and Jabber bot.
00692 
00693         @param jid: a bare Jabber ID
00694         """
00695         if self.cfg.secrets['jabberbot'] != secret:
00696             return ""
00697 
00698         u = self.request.handle_jid_auth(jid)
00699 
00700         if u and u.valid:
00701             return self._generate_auth_token(u)
00702         else:
00703             return ""

Returns a tuple of the MoinMoin version:
    (project, release, revision)

Definition at line 624 of file __init__.py.

00624 
00625     def xmlrpc_getMoinVersion(self):
00626         """ Returns a tuple of the MoinMoin version:
00627             (project, release, revision)
00628         """
00629         from MoinMoin import version
00630         return (version.project, version.release, version.revision)
00631 

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_getPage (   self,
  pagename 
)
Invoke xmlrpc_getPageVersion with rev=None 

Definition at line 428 of file __init__.py.

00428 
00429     def xmlrpc_getPage(self, pagename):
00430         """ Invoke xmlrpc_getPageVersion with rev=None """
00431         return self.xmlrpc_getPageVersion(pagename, rev=None)

Here is the call graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_getPageHTML (   self,
  pagename 
)
Invoke xmlrpc_getPageHTMLVersion with rev=None 

Definition at line 461 of file __init__.py.

00461 
00462     def xmlrpc_getPageHTML(self, pagename):
00463         """ Invoke xmlrpc_getPageHTMLVersion with rev=None """
00464         return self.xmlrpc_getPageHTMLVersion(pagename, rev=None)

Here is the call graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_getPageHTMLVersion (   self,
  pagename,
  rev 
)
Get HTML of from specific revision of pagename

@param pagename: the page name (utf-8)
@param rev: revision number (int)
@rtype: str
@return: page in rendered HTML (utf-8)

Definition at line 465 of file __init__.py.

00465 
00466     def xmlrpc_getPageHTMLVersion(self, pagename, rev):
00467         """ Get HTML of from specific revision of pagename
00468 
00469         @param pagename: the page name (utf-8)
00470         @param rev: revision number (int)
00471         @rtype: str
00472         @return: page in rendered HTML (utf-8)
00473         """
00474         pagename = self._instr(pagename)
00475 
00476         # User may read page?
00477         if not self.request.user.may.read(pagename):
00478             return self.notAllowedFault()
00479 
00480         if rev is not None:
00481             page = Page(self.request, pagename, rev=rev)
00482         else:
00483             page = Page(self.request, pagename)
00484 
00485         # Non existing page?
00486         if not page.exists():
00487             return self.noSuchPageFault()
00488 
00489         # Render page into a buffer
00490         result = self.request.redirectedOutput(page.send_page, content_only=1)
00491 
00492         # Return rendered page
00493         if self.version == 2:
00494             return self._outstr(result)
00495         elif self.version == 1:
00496             return xmlrpclib.Binary(result)

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_getPageInfo (   self,
  pagename 
)
Invoke xmlrpc_getPageInfoVersion with rev=None 

Definition at line 367 of file __init__.py.

00367 
00368     def xmlrpc_getPageInfo(self, pagename):
00369         """ Invoke xmlrpc_getPageInfoVersion with rev=None """
00370         return self.xmlrpc_getPageInfoVersion(pagename, rev=None)

Here is the call graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_getPageInfoVersion (   self,
  pagename,
  rev 
)
Return page information for specific revision

@param pagename: the name of the page (utf-8)
@param rev: revision to get info about (int)
@rtype: dict
@return: page information
    * name (string): the canonical page name, UTF-8.
    * lastModified (date): Last modification date, UTC.
    * author (string): author name, UTF-8.
    * version (int): current version

Definition at line 371 of file __init__.py.

00371 
00372     def xmlrpc_getPageInfoVersion(self, pagename, rev):
00373         """ Return page information for specific revision
00374 
00375         @param pagename: the name of the page (utf-8)
00376         @param rev: revision to get info about (int)
00377         @rtype: dict
00378         @return: page information
00379             * name (string): the canonical page name, UTF-8.
00380             * lastModified (date): Last modification date, UTC.
00381             * author (string): author name, UTF-8.
00382             * version (int): current version
00383 
00384         """
00385         pn = self._instr(pagename)
00386 
00387         # User may read this page?
00388         if not self.request.user.may.read(pn):
00389             return self.notAllowedFault()
00390 
00391         if rev is not None:
00392             page = Page(self.request, pn, rev=rev)
00393         else:
00394             page = Page(self.request, pn)
00395             rev = page.current_rev()
00396 
00397         # Non existing page?
00398         if not page.exists():
00399             return self.noSuchPageFault()
00400 
00401         # Get page info
00402         edit_info = page.edit_info()
00403         if not edit_info:
00404             return self.noLogEntryFault()
00405 
00406         mtime = wikiutil.version2timestamp(long(edit_info['timestamp'])) # must be long for py 2.2.x
00407         gmtuple = tuple(time.gmtime(mtime))
00408 
00409         version = rev # our new rev numbers: 1,2,3,4,....
00410 
00411         #######################################################################
00412         # BACKWARDS COMPATIBILITY CODE - remove when 1.2.x is regarded stone age
00413         # as we run a feed for BadContent on MoinMaster, we want to stay
00414         # compatible here for a while with 1.2.x moins asking us for BadContent
00415         # 1.3 uses the lastModified field for checking for updates, so it
00416         # should be no problem putting the old UNIX timestamp style of version
00417         # number in the version field
00418         if self.request.cfg.sitename == 'MoinMaster' and pagename == 'BadContent':
00419             version = int(mtime)
00420         #######################################################################
00421 
00422         return {
00423             'name': self._outstr(page.page_name),
00424             'lastModified': xmlrpclib.DateTime(gmtuple),
00425             'author': self._outstr(edit_info['editor']),
00426             'version': version,
00427             }

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_getPageVersion (   self,
  pagename,
  rev 
)
Get raw text from specific revision of pagename

@param pagename: pagename (utf-8)
@param rev: revision number (int)
@rtype: str
@return: utf-8 encoded page data

Definition at line 432 of file __init__.py.

00432 
00433     def xmlrpc_getPageVersion(self, pagename, rev):
00434         """ Get raw text from specific revision of pagename
00435 
00436         @param pagename: pagename (utf-8)
00437         @param rev: revision number (int)
00438         @rtype: str
00439         @return: utf-8 encoded page data
00440         """
00441         pagename = self._instr(pagename)
00442 
00443         # User may read page?
00444         if not self.request.user.may.read(pagename):
00445             return self.notAllowedFault()
00446 
00447         if rev is not None:
00448             page = Page(self.request, pagename, rev=rev)
00449         else:
00450             page = Page(self.request, pagename)
00451 
00452         # Non existing page?
00453         if not page.exists():
00454             return self.noSuchPageFault()
00455 
00456         # Return page raw text
00457         if self.version == 2:
00458             return self._outstr(page.get_raw_body())
00459         elif self.version == 1:
00460             return self._outlob(page.get_raw_body())

Here is the call graph for this function:

Here is the caller graph for this function:

Get RecentChanges since date

@param date: date since when rc will be listed
@rtype: list
@return: a list of changed pages since date, which should be in
    UTC. The result is a list, where each element is a struct:
    * name (string) :
Name of the page. The name is in UTF-8.
    * lastModified (date) :
Date of last modification, in UTC.
    * author (string) :
Name of the author (if available). UTF-8.
    * version (int) :
Current version.

Definition at line 315 of file __init__.py.

00315 
00316     def xmlrpc_getRecentChanges(self, date):
00317         """ Get RecentChanges since date
00318 
00319         @param date: date since when rc will be listed
00320         @rtype: list
00321         @return: a list of changed pages since date, which should be in
00322             UTC. The result is a list, where each element is a struct:
00323             * name (string) :
00324                 Name of the page. The name is in UTF-8.
00325             * lastModified (date) :
00326                 Date of last modification, in UTC.
00327             * author (string) :
00328                 Name of the author (if available). UTF-8.
00329             * version (int) :
00330                 Current version.
00331         """
00332 
00333         return_items = []
00334 
00335         edit_log = editlog.EditLog(self.request)
00336         for log in edit_log.reverse():
00337             # get last-modified UTC (DateTime) from log
00338             gmtuple = tuple(time.gmtime(wikiutil.version2timestamp(log.ed_time_usecs)))
00339             lastModified_date = xmlrpclib.DateTime(gmtuple)
00340 
00341             # skip if older than "date"
00342             if lastModified_date < date:
00343                 break
00344 
00345             # skip if knowledge not permitted
00346             if not self.request.user.may.read(log.pagename):
00347                 continue
00348 
00349             # get page name (str) from log
00350             pagename_str = self._outstr(log.pagename)
00351 
00352             # get user name (str) from log
00353             author_str = log.hostname
00354             if log.userid:
00355                 userdata = user.User(self.request, log.userid)
00356                 if userdata.name:
00357                     author_str = userdata.name
00358             author_str = self._outstr(author_str)
00359 
00360             return_item = {'name': pagename_str,
00361                            'lastModified': lastModified_date,
00362                            'author': author_str,
00363                            'version': int(log.rev) }
00364             return_items.append(return_item)
00365 
00366         return return_items

Here is the call graph for this function:

Interface implementation.

Returns version of the Wiki API.

@rtype: int
@return: 1 or 2 (wikirpc version)

Definition at line 239 of file __init__.py.

00239 
00240     def xmlrpc_getRPCVersionSupported(self):
00241         """ Returns version of the Wiki API.
00242 
00243         @rtype: int
00244         @return: 1 or 2 (wikirpc version)
00245         """
00246         return self.version

Returns user's language given his/her Jabber ID

It makes no sense to consider this a secret, right? Therefore
an authentication token is not required. We return a default
of "en" if user is not found.

TODO: surge protection? Do we fear account enumeration?

Definition at line 647 of file __init__.py.

00647 
00648     def xmlrpc_getUserLanguageByJID(self, jid):
00649         """ Returns user's language given his/her Jabber ID
00650 
00651         It makes no sense to consider this a secret, right? Therefore
00652         an authentication token is not required. We return a default
00653         of "en" if user is not found.
00654 
00655         TODO: surge protection? Do we fear account enumeration?
00656         """
00657         retval = "en"
00658         u = user.get_by_jabber_id(self.request, jid)
00659         if u:
00660             retval = u.language
00661 
00662         return retval

Return the user profile data for the current user.
    Use this in a single multicall after applyAuthToken.
    If we have a valid user, returns a dict of items from user profile.
    Otherwise, return an empty dict.

Definition at line 634 of file __init__.py.

00634 
00635     def xmlrpc_getUserProfile(self):
00636         """ Return the user profile data for the current user.
00637             Use this in a single multicall after applyAuthToken.
00638             If we have a valid user, returns a dict of items from user profile.
00639             Otherwise, return an empty dict.
00640         """
00641         u = self.request.user
00642         if not u.valid:
00643             userdata = {}
00644         else:
00645             userdata = dict(u.persistent_items())
00646         return userdata

Returns the interwiki name and the IWID of the current wiki. 

Definition at line 830 of file __init__.py.

00830 
00831     def xmlrpc_interwikiName(self):
00832         """ Returns the interwiki name and the IWID of the current wiki. """
00833         name = self.request.cfg.interwikiname
00834         iwid = self.request.cfg.iwid
00835         if name is None:
00836             return [None, iwid]
00837         else:
00838             return [self._outstr(name), iwid]

Here is the call graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_listAttachments (   self,
  pagename 
)
Get all attachments associated with pagename
Deprecated.

@param pagename: pagename (utf-8)
@rtype: list
@return: a list of utf-8 attachment names

Definition at line 923 of file __init__.py.

00923 
00924     def xmlrpc_listAttachments(self, pagename):
00925         """ Get all attachments associated with pagename
00926         Deprecated.
00927 
00928         @param pagename: pagename (utf-8)
00929         @rtype: list
00930         @return: a list of utf-8 attachment names
00931         """
00932         pagename = self._instr(pagename)
00933         # User may read page?
00934         if not self.request.user.may.read(pagename):
00935             return self.notAllowedFault()
00936 
00937         result = AttachFile._get_files(self.request, pagename)
00938         return result

Here is the call graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_listLinks (   self,
  pagename 
)
list links for a given page
@param pagename: the page name
@rtype: list
@return: links of the page, structs, with the following elements
    * name (string) : The page name or URL the link is to, UTF-8 encoding.
    * type (int) : The link type. Zero (0) for internal Wiki
      link, one (1) for external link (URL - image link, whatever).

Definition at line 497 of file __init__.py.

00497 
00498     def xmlrpc_listLinks(self, pagename):
00499         """
00500         list links for a given page
00501         @param pagename: the page name
00502         @rtype: list
00503         @return: links of the page, structs, with the following elements
00504             * name (string) : The page name or URL the link is to, UTF-8 encoding.
00505             * type (int) : The link type. Zero (0) for internal Wiki
00506               link, one (1) for external link (URL - image link, whatever).
00507         """
00508         pagename = self._instr(pagename)
00509 
00510         # User may read page?
00511         if not self.request.user.may.read(pagename):
00512             return self.notAllowedFault()
00513 
00514         page = Page(self.request, pagename)
00515 
00516         # Non existing page?
00517         if not page.exists():
00518             return self.noSuchPageFault()
00519 
00520         links_out = []
00521         for link in page.getPageLinks(self.request):
00522             links_out.append({'name': self._outstr(link), 'type': 0 })
00523         return links_out

Here is the call graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_mergeDiff (   self,
  pagename,
  diff,
  local_rev,
  delta_remote_rev,
  last_remote_rev,
  interwiki_name,
  normalised_name 
)
Merges a diff sent by the remote machine and returns the number of the new revision.
    Additionally, this method tags the new revision.

    @param pagename: The pagename that is currently dealt with.
    @param diff: The diff that can be applied to the version specified by delta_remote_rev.
If it is None, the page is deleted.
    @param local_rev: The revno of the page on the other wiki system, used for the tag.
    @param delta_remote_rev: The revno that the diff is taken against.
    @param last_remote_rev: The last revno of the page `pagename` that is known by the other wiki site.
    @param interwiki_name: Used to build the interwiki tag.
    @param normalised_name: The normalised pagename that is common to both wikis.

    @return Returns the current revision number after the merge was done. Or one of the following errors:
* "SUCCESS" - the page could be merged and tagged successfully.
* "NOT_EXIST" - item does not exist and there was not any content supplied.
* "LASTREV_INVALID" - the page was changed and the revision got invalid
* "INTERNAL_ERROR" - there was an internal error
* "NOT_ALLOWED" - you are not allowed to do the merge operation on the page

Definition at line 839 of file __init__.py.

00839 
00840     def xmlrpc_mergeDiff(self, pagename, diff, local_rev, delta_remote_rev, last_remote_rev, interwiki_name, normalised_name):
00841         """ Merges a diff sent by the remote machine and returns the number of the new revision.
00842             Additionally, this method tags the new revision.
00843 
00844             @param pagename: The pagename that is currently dealt with.
00845             @param diff: The diff that can be applied to the version specified by delta_remote_rev.
00846                 If it is None, the page is deleted.
00847             @param local_rev: The revno of the page on the other wiki system, used for the tag.
00848             @param delta_remote_rev: The revno that the diff is taken against.
00849             @param last_remote_rev: The last revno of the page `pagename` that is known by the other wiki site.
00850             @param interwiki_name: Used to build the interwiki tag.
00851             @param normalised_name: The normalised pagename that is common to both wikis.
00852 
00853             @return Returns the current revision number after the merge was done. Or one of the following errors:
00854                 * "SUCCESS" - the page could be merged and tagged successfully.
00855                 * "NOT_EXIST" - item does not exist and there was not any content supplied.
00856                 * "LASTREV_INVALID" - the page was changed and the revision got invalid
00857                 * "INTERNAL_ERROR" - there was an internal error
00858                 * "NOT_ALLOWED" - you are not allowed to do the merge operation on the page
00859         """
00860         from MoinMoin.util.bdiff import decompress, patch
00861         from MoinMoin.wikisync import TagStore, BOTH
00862         from MoinMoin.packages import unpackLine
00863         LASTREV_INVALID = xmlrpclib.Fault("LASTREV_INVALID", "The page was changed")
00864 
00865         pagename = self._instr(pagename)
00866 
00867         comment = u"Remote Merge - %r" % unpackLine(interwiki_name)[-1]
00868 
00869         # User may read page?
00870         if not self.request.user.may.read(pagename) or not self.request.user.may.write(pagename):
00871             return xmlrpclib.Fault("NOT_ALLOWED", "You are not allowed to write to this page.")
00872 
00873         # XXX add locking here!
00874 
00875         # current version of the page
00876         currentpage = PageEditor(self.request, pagename, do_editor_backup=0)
00877 
00878         if last_remote_rev is not None and currentpage.get_real_rev() != last_remote_rev:
00879             return LASTREV_INVALID
00880 
00881         if not currentpage.exists() and diff is None:
00882             return xmlrpclib.Fault("NOT_EXIST", "The page does not exist and no diff was supplied.")
00883 
00884         if diff is None: # delete the page
00885             try:
00886                 currentpage.deletePage(comment)
00887             except PageEditor.AccessDenied, (msg, ):
00888                 return xmlrpclib.Fault("NOT_ALLOWED", msg)
00889             return currentpage.get_real_rev()
00890 
00891         # base revision used for the diff
00892         basepage = Page(self.request, pagename, rev=(delta_remote_rev or 0))
00893 
00894         # generate the new page revision by applying the diff
00895         newcontents = patch(basepage.get_raw_body_str(), decompress(str(diff)))
00896         #print "Diff against %r" % basepage.get_raw_body_str()
00897 
00898         # write page
00899         try:
00900             currentpage.saveText(newcontents.decode("utf-8"), last_remote_rev or 0, comment=comment)
00901         except PageEditor.Unchanged: # could happen in case of both wiki's pages being equal
00902             pass
00903         except PageEditor.EditConflict:
00904             return LASTREV_INVALID
00905 
00906         current_rev = currentpage.get_real_rev()
00907 
00908         tags = TagStore(currentpage)
00909         tags.add(remote_wiki=interwiki_name, remote_rev=local_rev, current_rev=current_rev, direction=BOTH, normalised_name=normalised_name)
00910 
00911         # XXX unlock page
00912 
00913         return current_rev
00914 

Here is the call graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_putAttachment (   self,
  pagename,
  attachname,
  data 
)
Set attachname associated with pagename to data

@param pagename: pagename (utf-8)
@param attachname: attachment name (utf-8)
@param data: file data (base64)
@rtype boolean
@return True if attachment was set

Definition at line 958 of file __init__.py.

00958 
00959     def xmlrpc_putAttachment(self, pagename, attachname, data):
00960         """ Set attachname associated with pagename to data
00961 
00962         @param pagename: pagename (utf-8)
00963         @param attachname: attachment name (utf-8)
00964         @param data: file data (base64)
00965         @rtype boolean
00966         @return True if attachment was set
00967         """
00968         pagename = self._instr(pagename)
00969         # User may read page?
00970         if not self.request.user.may.read(pagename):
00971             return self.notAllowedFault()
00972 
00973         # also check ACLs
00974         if not self.request.user.may.write(pagename):
00975             return xmlrpclib.Fault(1, "You are not allowed to edit this page")
00976 
00977         attachname = wikiutil.taintfilename(attachname)
00978         filename = AttachFile.getFilename(self.request, pagename, attachname)
00979         if os.path.exists(filename) and not os.path.isfile(filename):
00980             return self.noSuchPageFault()
00981         open(filename, 'wb+').write(data.data)
00982         AttachFile._addLogEntry(self.request, 'ATTNEW', pagename, filename)
00983         return xmlrpclib.Boolean(1)

Here is the call graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_putPage (   self,
  pagename,
  pagetext 
)
save a page / change a page to a new text
@param pagename: the page name (unicode or utf-8)
@param pagetext: the new page text (content, unicode or utf-8)
@rtype: bool
@return: true on success

Definition at line 524 of file __init__.py.

00524 
00525     def xmlrpc_putPage(self, pagename, pagetext):
00526         """
00527         save a page / change a page to a new text
00528         @param pagename: the page name (unicode or utf-8)
00529         @param pagetext: the new page text (content, unicode or utf-8)
00530         @rtype: bool
00531         @return: true on success
00532         """
00533 
00534         pagename = self._instr(pagename)
00535         pagename = wikiutil.normalize_pagename(pagename, self.cfg)
00536         if not pagename:
00537             return xmlrpclib.Fault("INVALID", "pagename can't be empty")
00538 
00539         # check ACLs
00540         if not self.request.user.may.write(pagename):
00541             return xmlrpclib.Fault(1, "You are not allowed to edit this page")
00542 
00543         page = PageEditor(self.request, pagename)
00544         try:
00545             if self.version == 2:
00546                 newtext = self._instr(pagetext)
00547             elif self.version == 1:
00548                 newtext = self._inlob(pagetext)
00549             msg = page.saveText(newtext, 0)
00550         except page.SaveError, msg:
00551             logging.error("SaveError: %s" % msg)
00552             return xmlrpclib.Fault(1, "%s" % msg)
00553 
00554         # Update pagelinks cache
00555         page.getPageLinks(self.request)
00556 
00557         return xmlrpclib.Boolean(1)

Here is the call graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_revertPage (   self,
  pagename,
  revision 
)
Revert a page to previous revision

This is mainly intended to be used by the jabber bot.

@param pagename: the page name (unicode or utf-8)
@param revision: revision to revert to
@rtype bool
@return true on success

Definition at line 558 of file __init__.py.

00558 
00559     def xmlrpc_revertPage(self, pagename, revision):
00560         """Revert a page to previous revision
00561 
00562         This is mainly intended to be used by the jabber bot.
00563 
00564         @param pagename: the page name (unicode or utf-8)
00565         @param revision: revision to revert to
00566         @rtype bool
00567         @return true on success
00568 
00569         """
00570         if not self.request.user.may.write(pagename):
00571             return xmlrpclib.Fault(1, "You are not allowed to edit this page")
00572 
00573         rev = int(self._instr(revision))
00574         editor = PageEditor(self.request, pagename)
00575 
00576         try:
00577             editor.revertPage(rev)
00578         except PageEditor.SaveError, error:
00579             return xmlrpclib.Fault(1, "Revert failed: %s" % (str(error), ))
00580 
00581         return xmlrpclib.Boolean(1)

Here is the call graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_searchPages (   self,
  query_string 
)
Searches pages for query_string.
    Returns a list of tuples (foundpagename, context)

Definition at line 582 of file __init__.py.

00582 
00583     def xmlrpc_searchPages(self, query_string):
00584         """ Searches pages for query_string.
00585             Returns a list of tuples (foundpagename, context)
00586         """
00587         from MoinMoin import search
00588         results = search.searchPages(self.request, query_string)
00589         results.formatter = self.request.html_formatter
00590         results.request = self.request
00591         return [(self._outstr(hit.page_name),
00592                  self._outstr(results.formatContext(hit, 180, 1)))
00593                 for hit in results.hits]

Here is the call graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_searchPagesEx (   self,
  query_string,
  search_type,
  length,
  case,
  mtime,
  regexp 
)
Searches pages for query_string - extended version for compatibility

This function, in contrary to searchPages(), doesn't return HTML-formatted data.

@param query_string: term to search for
@param search_type: "text" or "title" search
@param length: length of context preview (in characters)
@param case: should the search be case sensitive?
@param mtime: only output pages modified after mtime
@param regexp: should the query_string be treates as a regular expression?
@return: (page name, context preview, page url)

Definition at line 594 of file __init__.py.

00594 
00595     def xmlrpc_searchPagesEx(self, query_string, search_type, length, case, mtime, regexp):
00596         """ Searches pages for query_string - extended version for compatibility
00597 
00598         This function, in contrary to searchPages(), doesn't return HTML-formatted data.
00599 
00600         @param query_string: term to search for
00601         @param search_type: "text" or "title" search
00602         @param length: length of context preview (in characters)
00603         @param case: should the search be case sensitive?
00604         @param mtime: only output pages modified after mtime
00605         @param regexp: should the query_string be treates as a regular expression?
00606         @return: (page name, context preview, page url)
00607 
00608         """
00609         from MoinMoin import search
00610         from MoinMoin.formatter.text_plain import Formatter
00611 
00612         kwargs = {"sort": "page_name", "case": case, "regex": regexp}
00613         if search_type == "title":
00614             kwargs["titlesearch"] = True
00615 
00616         results = search.searchPages(self.request, query_string, **kwargs)
00617         results.formatter = Formatter(self.request)
00618         results.request = self.request
00619 
00620         return [(self._outstr(hit.page_name),
00621                  self._outstr(results.formatContext(hit, length, 1)),
00622                  self.request.getQualifiedURL(hit.page.url(self.request, {})))
00623                 for hit in results.hits]

Here is the call graph for this function:

def MoinMoin.xmlrpc.XmlRpcBase.xmlrpc_system_multicall (   self,
  call_list 
)

System methods.

system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => [[4], ...]

Allows the caller to package multiple XML-RPC calls into a single
request.

See http://www.xmlrpc.com/discuss/msgReader$1208

Copied from SimpleXMLRPCServer.py

Definition at line 199 of file __init__.py.

00199 
00200     def xmlrpc_system_multicall(self, call_list):
00201         """system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => [[4], ...]
00202 
00203         Allows the caller to package multiple XML-RPC calls into a single
00204         request.
00205 
00206         See http://www.xmlrpc.com/discuss/msgReader$1208
00207 
00208         Copied from SimpleXMLRPCServer.py
00209         """
00210 
00211         results = []
00212         for call in call_list:
00213             method_name = call['methodName']
00214             params = call['params']
00215 
00216             try:
00217                 # XXX A marshalling error in any response will fail the entire
00218                 # multicall. If someone cares they should fix this.
00219                 result = self.dispatch(method_name, params)
00220 
00221                 if not isinstance(result, xmlrpclib.Fault):
00222                     results.append([result])
00223                 else:
00224                     results.append(
00225                         {'faultCode': result.faultCode,
00226                          'faultString': result.faultString}
00227                         )
00228             except:
00229                 results.append(
00230                     {'faultCode': 1,
00231                      'faultString': "%s:%s" % (sys.exc_type, sys.exc_value)}
00232                     )
00233 
00234         return results

Here is the call graph for this function:


Member Data Documentation

Definition at line 52 of file __init__.py.

Definition at line 50 of file __init__.py.

Reimplemented in MoinMoin.xmlrpc.XmlRpc2, and MoinMoin.xmlrpc.XmlRpc1.

Definition at line 51 of file __init__.py.


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