Skip to content

Commit ab29e4d

Browse files
committed
fix: catch some edge cases
1 parent a7909c0 commit ab29e4d

4 files changed

Lines changed: 12 additions & 5 deletions

File tree

‎src/osw/auth.py‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,12 @@ def get_credential(self, config: CredentialConfig) -> BaseCredential:
168168

169169
if cred is None:
170170
if config.fallback is CredentialManager.CredentialFallback.ask:
171-
filepath_str = "', '".join([str(fp) for fp in self.cred_filepath])
172-
print(
173-
f"No credentials for {config.iri} found in path '{filepath_str}'. "
174-
f"Please use the prompt to login"
175-
)
171+
if self.cred_filepath:
172+
filepath_str = "', '".join([str(fp) for fp in self.cred_filepath])
173+
print(
174+
f"No credentials for {config.iri} found in path '{filepath_str}'. "
175+
f"Please use the prompt to login"
176+
)
176177
username = input("Enter username: ")
177178
password = getpass.getpass("Enter password: ")
178179
cred = CredentialManager.UserPwdCredential(

‎src/osw/core.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,8 @@ def set_content(content_to_set: dict) -> None:
10421042
# Apply the overwrite logic
10431043
# a) If there is a key in the remote content that is not in the local
10441044
# content, we have to keep it
1045+
if remote_content["jsondata"] is None:
1046+
remote_content["jsondata"] = {}
10451047
new_content["jsondata"] = remote_content["jsondata"]
10461048
# new_content["jsondata"] = {
10471049
# key: value

‎src/osw/utils/wiki.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ def remove_empty(d: dict, inplace: bool = True) -> dict:
124124
result:
125125
The modified dictionary
126126
"""
127+
if d is None:
128+
return d
127129
if not inplace:
128130
d = deepcopy(d)
129131
keys = list(d.keys())

‎src/osw/wtsite.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,8 @@ def __init__(self, wtSite: WtSite = None, title: str = None, do_init: bool = Tru
11901190

11911191
if do_init:
11921192
self.init()
1193+
else:
1194+
self.exists = False # actually this is unknown
11931195

11941196
def init(self):
11951197
"""Initializes the page by loading the content and meta data from the site"""

0 commit comments

Comments
 (0)