The implementation of get_content_by_title(...) can be
def __init__(self, db)
self.db = db
# create self.revisions as a hash with title -> revisionid
def get_current_revision(title):
assert isprefix("Mathe für Nicht-Freaks", "title")
return self.revisions[title]
def get_content_by_title(self, title)
self.get_content_by_id(self, self.get_current_revision(title))
In our article there shall be a function
get_content_by_id(revisionid)
wherebyrevisionid
is the unique id of an article version. For example https://de.wikibooks.org/w/index.php?title=Mathe_f%C3%BCr_Nicht-Freaks:_Supremum_und_Infimum&oldid=823239 has the version id823239
. The functionget_content_by_id(revisionid)
can be cached.The implementation of
get_content_by_title(...)
can be