From 97bb6a6a7d5db2c8dd3da33bd24252835d00c641 Mon Sep 17 00:00:00 2001 From: Tom Parker Date: Tue, 14 Apr 2009 07:50:00 +0800 Subject: [PATCH 1/1] Handle weird comment retrieval permissions case Saw the error Fetching journal entries for: palfrey Fetching journal entry L-867 (create) Fetching journal comments for: palfrey *** Error fetching comment meta, possibly not community maintainer? Traceback (most recent call last): File "ljdump.py", line 358, in ljdump(server, username, password, username) File "ljdump.py", line 244, in ljdump r.close() AttributeError: 'dict' object has no attribute 'close' (notably, this is my personal journal, so missing permissions shouldn't happen) This patch handles this weird case (which will probably never now happen again) Signed-off-by: Greg Hewgill --- ljdump.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ljdump.py b/ljdump.py index b1c72d0..3e9a970 100755 --- a/ljdump.py +++ b/ljdump.py @@ -241,7 +241,10 @@ def ljdump(Server, Username, Password, Journal): print "*** Error fetching comment meta, possibly not community maintainer?" break finally: - r.close() + try: + r.close() + except AttributeError: # r is sometimes a dict for unknown reasons + pass for c in meta.getElementsByTagName("comment"): id = int(c.getAttribute("id")) metacache[id] = { -- 2.39.5