Skip to content

Commit 55ffff8

Browse files
committed
Force login after initializing XMLRPC connection for checking the connection is
working.
1 parent fac56d2 commit 55ffff8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

dokuwiki.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ class DokuWiki(object):
3333
def __init__(self, url, user, password, **kwargs):
3434
"""Initialize the object by connecting to the XMLRPC server."""
3535
# Initialize XMLRPC client.
36-
url = '%s/lib/exe/xmlrpc.php?%s' % (
37-
url, urlencode({'u': user, 'p': password}))
36+
url = '%s/lib/exe/xmlrpc.php?%s' % ( url, urlencode({'u': user, 'p': password}))
3837
self.proxy = ServerProxy(url, **kwargs)
38+
# Force login to check the connection.
39+
if not self.login(user, password):
40+
raise DokuWikiError('invalid login or password!')
3941

4042
# Set "namespaces" for pages and medias functions.
4143
self.pages = _Pages(weakref.ref(self)())

0 commit comments

Comments
 (0)