Skip to content

Adapt oscar_python to the new version#40

Merged
SergioLangaritaBenitez merged 7 commits intomainfrom
dev-slangarita
Oct 10, 2025
Merged

Adapt oscar_python to the new version#40
SergioLangaritaBenitez merged 7 commits intomainfrom
dev-slangarita

Conversation

@SergioLangaritaBenitez
Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread oscar_python/client.py Outdated
try:
with open(svc["script"]) as s:
fdl_directory = os.path.dirname(fdl_path)
script_path = fdl_directory + "/" + svc["script"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure that if the user specifies an absolute path for the shell script in the FDL this is respected. If it is a relative path, then you join fdl_directory with the relative path.

Comment thread oscar_python/_oidc.py Outdated

@staticmethod
def refresh_access_token(refresh_token, scopes, token_endpoint):
def refresh_access_token(refresh_token, scopes, token_endpoint, client_id):
Copy link
Copy Markdown
Member

@esparig esparig Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider whether adding client_id as a new parameter could cause a backward compatibility issue. If we want it to continue working as before, we could add a default value.

Comment thread oscar_python/client.py Outdated
else:
fdl_directory = os.path.dirname(fdl_path)
script_path = fdl_directory + "/" + svc["script"]
print(script_path)
Copy link
Copy Markdown
Member

@esparig esparig Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this print necessary? Was it left over from a debugging process? I suggest removing it or using an appropriate logging method.

Comment thread oscar_python/client.py Outdated
script_path = svc["script"]
else:
fdl_directory = os.path.dirname(fdl_path)
script_path = fdl_directory + "/" + svc["script"]
Copy link
Copy Markdown
Member

@esparig esparig Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to use os.path.join(fdl_directory, svc['script']). Using simple concatenation with + can cause issues with double slashes //.

Comment thread oscar_python/client.py
with open(script_path) as s:
svc["script"] = s.read()
except IOError:
raise Exception("Couldn't read script")
Copy link
Copy Markdown
Member

@esparig esparig Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to preserve the original exception message to improve debugging.

try:
  #whatever
except IOError as e:
  raise Exception("Couldn't read script") from e

@SergioLangaritaBenitez SergioLangaritaBenitez merged commit da0cf91 into main Oct 10, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants