From: Tom Parker Date: Mon, 13 Apr 2009 23:50:00 +0000 (+0800) Subject: Handle weird comment retrieval permissions case X-Git-Url: http://www.wagner.pp.ru/gitweb/?p=oss%2Fljdump.git;a=commitdiff_plain;h=97bb6a6a7d5db2c8dd3da33bd24252835d00c641 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 --- 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] = {