Skip to content

Commit 1621291

Browse files
committed
Add set method to medias to write bytes
1 parent 44c6dcf commit 1621291

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

dokuwiki.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from xmlrpclib import ServerProxy, Binary, Fault
1212
from urllib import urlencode
1313

14-
from base64 import b64decode
14+
from base64 import b64decode, b64encode
1515

1616
ERR = 'XML or text declaration not at start of entity: line 2, column 0'
1717

@@ -199,6 +199,10 @@ def add(self, media, filepath, overwrite=True):
199199
self._dokuwiki.send('wiki.putAttachment',
200200
media, Binary(fhandler.read()), ow=overwrite)
201201

202+
def set(self, media, _bytes, overwrite=True):
203+
self._dokuwiki.send('wiki.putAttachment', media,
204+
b64encode(_bytes), ow=overwrite)
205+
202206
def delete(self, media):
203207
return self._dokuwiki.send('wiki.deleteAttachment', media)
204208

0 commit comments

Comments
 (0)