]> wagner.pp.ru Git - oss/ljdump.git/commitdiff
Handle weird comment retrieval permissions case
authorTom Parker <palfrey@tevp.net>
Mon, 13 Apr 2009 23:50:00 +0000 (07:50 +0800)
committerGreg Hewgill <greg@hewgill.com>
Mon, 4 May 2009 11:38:59 +0000 (19:38 +0800)
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 <module>
   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 <greg@hewgill.com>
ljdump.py

index b1c72d0c24e66f07bf9509b5256f042a6ff992f4..3e9a970e7d5fb3a71c9eabf3cc02057d9b5cb912 100755 (executable)
--- 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] = {