From 4e98378fecdaca2ef101e7a86a3889e056fe3766 Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Sat, 20 Sep 2003 21:49:33 +0000 Subject: [PATCH] Thinking about it, no, I don't really want a statefile option. --- NEWS | 2 -- config | 5 ----- rawdoglib/rawdog.py | 24 +++--------------------- 3 files changed, 3 insertions(+), 28 deletions(-) diff --git a/NEWS b/NEWS index 7c21e26..f7fd7aa 100644 --- a/NEWS +++ b/NEWS @@ -28,8 +28,6 @@ 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 446fc51..9aefcba 100644 --- a/config +++ b/config @@ -14,11 +14,6 @@ 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. diff --git a/rawdoglib/rawdog.py b/rawdoglib/rawdog.py index 1a38389..946e849 100644 --- a/rawdoglib/rawdog.py +++ b/rawdoglib/rawdog.py @@ -253,7 +253,6 @@ class Config: "showfeeds" : 1, "timeout" : 30, "template" : "default", - "statefile" : "state", } def __getitem__(self, key): return self.config[key] @@ -301,8 +300,6 @@ 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]) @@ -554,22 +551,8 @@ def main(argv): print >>sys.stderr, err return 1 - persister = None - rawdog = None - - prev_statefile = None - def change_statefile(name): - if prev_statefile == name: - return - if persister is not None: - persister.save() - persister = None - if name is not None: - persister = Persister(name, Rawdog) - rawdog = persister.load() - prev_statefile = name - - change_statefile(config["statefile"]) + persister = Persister("state", Rawdog) + rawdog = persister.load() for o, a in optlist: if o in ("-u", "--update"): @@ -587,11 +570,10 @@ def main(argv): print >>sys.stderr, "In " + a + ":" print >>sys.stderr, err return 1 - change_statefile(config["statefile"]) elif o in ("-t", "--show-template"): rawdog.show_template(config) - change_statefile(None) + persister.save() return 0 -- 2.35.1