monitor: Instead of creating a new history with -n, delete the old

history (which creates a new history...).
This commit is contained in:
Nate Coraor
2008-05-15 17:33:34 +00:00
parent 3f9afc5281
commit 76e128a6ee
+19 -2
View File
@@ -141,8 +141,15 @@ class Browser:
print "Remaining datasets ids:", " ".join( p.dids )
raise Exception, "History still contains datasets after attempting to delete them"
if new_history:
self.get("/root/history_new")
tc.save_cookies(self.cookie_jar)
self.get("/root/history_options")
p = hidParser()
p.feed(tc.browser.get_html())
if p.hid is None:
print "Unable to determine hid to delete old history"
sys.exit(1)
else:
self.get("/root/history_delete?id=%s" % p.hid)
tc.save_cookies(self.cookie_jar)
def check_redir(self, url):
try:
@@ -327,6 +334,16 @@ class didParser(htmllib.HTMLParser):
self.dids.append( i[1].rsplit("historyItemContainer-", 1)[1] )
dprint("got a dataset id: %s" % self.dids[-1])
class hidParser(htmllib.HTMLParser):
def __init__(self):
htmllib.HTMLParser.__init__(self, formatter.NullFormatter())
self.hid = None
def start_a(self, attrs):
for i in attrs:
if i[0] == "href" and i[1].startswith("/root/history_delete"):
self.hid = i[1].rsplit("=", 1)[1]
dprint("got a history id: %s" % self.hid)
class loggedinParser(htmllib.HTMLParser):
def __init__(self):
htmllib.HTMLParser.__init__(self, formatter.NullFormatter())