Skip to content

Commit 2ec33be

Browse files
committed
improved article id encoding
1 parent 375c2c2 commit 2ec33be

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

dataikuapi/dss/wiki.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ def __init__(self, client, project_key, article_id):
7272
self.client = client
7373
self.project_key = project_key
7474
self.article_id = article_id
75+
if isinstance(self.article_id, unicode):
76+
self.article_id = self.article_id.encode('utf-8')
7577

7678
##########################
7779
# Article definition
@@ -83,7 +85,8 @@ def get(self):
8385
Returns:
8486
the article definition with payload (article content)
8587
"""
86-
return self.client._perform_json("GET", "/projects/%s/wiki/%s" % (self.project_key, urllib.quote_plus(self.article_id.encode('utf-8'))))
88+
print("/projects/%s/wiki/%s" % (self.project_key, urllib.quote(self.article_id)))
89+
return self.client._perform_json("GET", "/projects/%s/wiki/%s" % (self.project_key, urllib.quote(self.article_id)))
8790

8891
def set(self, article_with_payload):
8992
"""
@@ -95,13 +98,13 @@ def set(self, article_with_payload):
9598
Returns:
9699
the updated article
97100
"""
98-
return self.client._perform_json("PUT", "/projects/%s/wiki/%s" % (self.project_key, urllib.quote_plus(self.article_id.encode('utf-8'))), body=article_with_payload)
101+
return self.client._perform_json("PUT", "/projects/%s/wiki/%s" % (self.project_key, urllib.quote(self.article_id)), body=article_with_payload)
99102

100103
def delete(self):
101104
"""
102105
Delete the article
103106
"""
104-
self.client._perform_empty("DELETE", "/projects/%s/wiki/%s" % (self.project_key, urllib.quote_plus(self.article_id.encode('utf-8'))))
107+
self.client._perform_empty("DELETE", "/projects/%s/wiki/%s" % (self.project_key, urllib.quote(self.article_id)))
105108

106109
########################################################
107110
# Discussions

0 commit comments

Comments
 (0)