]> projects.mako.cc - python-simplemediawiki.debian/commitdiff
Add logout function, reset high limits on auth
authorIan Weller <ian@ianweller.org>
Wed, 2 Feb 2011 20:55:02 +0000 (14:55 -0600)
committerIan Weller <ian@ianweller.org>
Wed, 2 Feb 2011 20:55:02 +0000 (14:55 -0600)
simplemediawiki.py

index 940fb2b26486ff85e5193749e93aca61c3b65b26..05dd471456e83d6f31b73de2b95342017a5f9dfd 100644 (file)
@@ -138,12 +138,22 @@ class MediaWiki():
             data['lgtoken'] = token
         result = self.call(data)
         if result['login']['result'] == 'Success':
             data['lgtoken'] = token
         result = self.call(data)
         if result['login']['result'] == 'Success':
+            self._high_limits = None
             return True
         elif result['login']['result'] == 'NeedToken' and not token:
             return self.login(user, passwd, result['login']['token'])
         else:
             return False
 
             return True
         elif result['login']['result'] == 'NeedToken' and not token:
             return self.login(user, passwd, result['login']['token'])
         else:
             return False
 
+    def logout(self):
+        """
+        Conveinence function for logging out of the wiki.
+        """
+        data = {'action': 'logout'}
+        self.call(data)
+        self._high_limits = None
+        return True
+
     def limits(self, low, high):
         """
         Convenience function for determining appropriate limits in the API. If
     def limits(self, low, high):
         """
         Convenience function for determining appropriate limits in the API. If

Benjamin Mako Hill || Want to submit a patch?