Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/mwlib/overlay.py
diff options
context:
space:
mode:
Diffstat (limited to 'mwlib/overlay.py')
-rw-r--r--mwlib/overlay.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/mwlib/overlay.py b/mwlib/overlay.py
new file mode 100644
index 0000000..68c4774
--- /dev/null
+++ b/mwlib/overlay.py
@@ -0,0 +1,22 @@
+
+# Copyright (c) 2007-2008 PediaPress GmbH
+# See README.txt for additional licensing information.
+
+import os
+
+class OverlayDB(object):
+ def __init__(self, db, basedir):
+ self.db = db
+ self.basedir = basedir
+
+ def getRawArticle(self, title):
+ p = os.path.join(self.basedir, title)
+ if os.path.isfile(p):
+ return unicode(open(p, 'rb').read(), 'utf-8')
+ return self.db.getRawArticle(title)
+
+ def getTemplate(self, title, followRedirects=False):
+ p = os.path.join(self.basedir, title)
+ if os.path.isfile(p):
+ return unicode(open(p, 'rb').read(), 'utf-8')
+ return self.db.getTemplate(title, followRedirects=followRedirects)