From c513396114563080847ac150635aa482d71a6b2e Mon Sep 17 00:00:00 2001
From: Bryan Tong Minh <bryan.tongminh@gmail.com>
Date: Fri, 6 May 2011 13:37:51 +0000
Subject: [PATCH] Handle readapidenied in site_init

---
 mwclient/RELEASE-NOTES.txt | 4 +---
 mwclient/client.py         | 3 ++-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/mwclient/RELEASE-NOTES.txt b/mwclient/RELEASE-NOTES.txt
index a06bb50..4c7a8ad 100644
--- a/mwclient/RELEASE-NOTES.txt
+++ b/mwclient/RELEASE-NOTES.txt
@@ -2,13 +2,11 @@ RELEASE NOTES FOR MWCLIENT
 
 This is mwclient 0.6.5. The following are the release notes for this version.
 
-== Changes in version 0.6.6 ==
-No changes yet.
-
 == Changes in version 0.6.5 ==
 * Explicitly convert the Content-Length header to str, avoiding a TypeError
   on some versions of Python.
 * Fix for upload by URL
+* Handle readapidenied error in site init
 
 == Changes in version 0.6.4 ==
 * Added support for upload API
diff --git a/mwclient/client.py b/mwclient/client.py
index f462982..b5bc53d 100644
--- a/mwclient/client.py
+++ b/mwclient/client.py
@@ -92,7 +92,8 @@ class Site(object):
 				self.site_init()
 			except errors.APIError, e:
 				# Private wiki, do init after login
-				if e[0] != u'unknown_action': raise
+				if e[0] not in (u'unknown_action', u'readapidenied'): 
+					raise
 				
 			
 	def site_init(self):
-- 
GitLab