Skip to content

Commit 1ef6c2c

Browse files
committed
Fix API_URL reinitialisation error
1 parent 07c6d75 commit 1ef6c2c

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/nextcloud/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def __init__(self, endpoint=None,
5252
url=endpoint, user=user, password=password, auth=auth,
5353
session_kwargs=session_kwargs
5454
)
55+
#FIXME see base & requester
5556
# @FIX_API_URL fix api url for case nextcloud is not on server root {{
5657
url_parts = re.match(r"^((https?://)?[^/]*)(/.*)?", self.session.url)
5758
(server_part_url, api_url_base) = (url_parts.group(1), url_parts.group(3))
@@ -60,8 +61,10 @@ def __init__(self, endpoint=None,
6061
# }}
6162
for functionality_class in API_WRAPPER_CLASSES:
6263
# @FIX_API_URL {{
64+
if not getattr(functionality_class, '_ORIG_API_URL', False):
65+
functionality_class._ORIG_API_URL = functionality_class.API_URL
6366
if api_url_base:
64-
functionality_class.API_URL = api_url_base + functionality_class.API_URL
67+
functionality_class.API_URL = api_url_base + functionality_class._ORIG_API_URL
6568
# }}
6669
functionality_instance = functionality_class(self)
6770
for potential_method in dir(functionality_instance):

src/nextcloud/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def __init__(self, client=None, attrs=None):
5050
self._attrs = attrs or {}
5151
self._set_requester()
5252

53+
#FIXME move as nested method in get_objs_from_response
5354
@classmethod
5455
def _is_root_href(cls, href):
5556
return href == cls.API_URL + '/'

src/nextcloud/requester.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def session(self):
6464
@property
6565
def api_url(self):
6666
""" The sub url associated to the requester """
67+
#FIXME may change according to server url ?
6768
return self.wrapper.API_URL
6869

6970
@property

0 commit comments

Comments
 (0)