Add "statefile" option.
authorAdam Sampson <ats@offog.org>
Sat, 20 Sep 2003 19:07:38 +0000 (19:07 +0000)
committerAdam Sampson <ats@offog.org>
Sat, 20 Sep 2003 19:07:38 +0000 (19:07 +0000)
NEWS
config
rawdoglib/rawdog.py

diff --git a/NEWS b/NEWS
index f7fd7aafbc9bb3a163583c8aef7c4336c993f83a..7c21e26d15e779b83e97bb599bf3258f72c54c79 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,8 @@ Added --show-template option to show the template currently in use (so
 you can customise it yourself), and "template" config option to allow
 the user to specify their own template.
 
+Added "statefile" config option to allow use of multiple state files.
+
 - rawdog 1.2
 
 Updated feedparser to 2.5.2, which fixes a bug that was making rawdog
diff --git a/config b/config
index 311a1d40829cdbb09f4dc68939f4206fc8ba68e2..446fc5180fdda41a80c2dfb2f960eaed8a7fa828 100644 (file)
--- a/config
+++ b/config
@@ -1,5 +1,7 @@
 # Sample rawdog config file. Copy this into your ~/.rawdog/ directory, and edit
 # it to suit your preferences.
+# All paths in this file should be either absolute, or relative to your .rawdog
+# directory.
 
 # The maximum number of articles to show on the generated page.
 maxarticles 200
@@ -12,6 +14,11 @@ dayformat %A, %d %B
 # a 12-hour clock.
 timeformat %H:%M
 
+# The file that rawdog will store its internal state in. Most users
+# won't need to change this; it's only useful if you want to have
+# multiple sets of feeds.
+statefile state
+
 # The template file to use, or "default" to use the built-in template
 # (which is probably sufficient for most users). Use "rawdog -t" to show
 # the template currently in use as a starting-point for customisation.
index 6617ec17c20c137fec89e83fe625229c1e9173de..c21b636792367e2623730d4c71108ac5ab032c58 100644 (file)
@@ -253,6 +253,7 @@ class Config:
                        "showfeeds" : 1,
                        "timeout" : 30,
                        "template" : "default",
+                       "statefile" : "state",
                        }
 
        def __getitem__(self, key): return self.config[key]
@@ -300,6 +301,8 @@ class Config:
                        self["timeout"] = int(l[1])
                elif l[0] == "template":
                        self["template"] = l[1]
+               elif l[0] == "statefile":
+                       self["statefile"] = l[1]
                else:
                        raise ConfigError("Unknown config command: " + l[0])
 
@@ -551,7 +554,7 @@ def main(argv):
                print >>sys.stderr, err
                return 1
 
-       persister = Persister("state", Rawdog)  
+       persister = Persister(config["statefile"], Rawdog)      
        rawdog = persister.load()
 
        for o, a in optlist: