trying to wrap xmlrpclib into classes

Steven Noels stevenn at
Wed Jan 22 13:54:21 CET 2003

Brian Quinlan wrote:

>>'Somehow', I want this Page object to forward the method invocation to
>>my Server object, but I'm stuck on the _how_. Should I let my Server
>>class inherit from the xmlrpclib.Server class? My Page class too?
> You could make your Server class an xmlrpclib.Server subclass but I
> would just get rid of your Server class since it doesn't really do
> anything.

That's what I did, thanks. What do you mean with 'getting rid of my 
Server class...? I definitely need the one in I'm trying 
to wrap things in order to make it feel less XMLRPC'ish:

import xmlrpclib, time, strptime
from UrllibTransport import UrllibTransport

class Page(xmlrpclib.Server):

     def __init__(self, name, server_url): = name
         self.server_url = server_url
         self.server = xmlrpclib.Server(self.server_url, 

     def retrievePageInfo(self):
         pageInfo =
         self.version = pageInfo['version'] = pageInfo['author']
         self.lastModified = UTC2time(pageInfo['lastModified'].value) # 
make a (time) tuple out of it
     def getName(self):

     def getVersion(self):
         return self.version

     def getAuthor(self):

     def getlastModified(self):
         return self.lastModified

     def getPageContent(self):
         pageContent =

     def getPageContentVersion(self, version):
         pageContent =, version)

class RecentChanges(xmlrpclib.Server):

     def __init__(self, server_url):
         self.server_url = server_url
         self.server = xmlrpclib.Server(self.server_url, 

     def getRecentChanges(self, time):
         rc =

Dunnow whether this is good design, so comments are welcome!

Steven Noels                  
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at  
stevenn at                stevenn at

More information about the Python-list mailing list