Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking separator when calling set_custom_properties_path() method #153

Closed
lelaus opened this issue Mar 7, 2024 · 2 comments
Closed

Checking separator when calling set_custom_properties_path() method #153

lelaus opened this issue Mar 7, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@lelaus
Copy link
Collaborator

lelaus commented Mar 7, 2024

This issue is relating to the last task of issue #144.

The set_custom_properties_path() method loads properties from the module whose path is passed as argument.
Currently, no check is made about the separator used in the passed path, so no catching any issue in case the used separator is not in accordance with the OS.
The check is needed to make the set_custom_properties_path() method more robust.

This issue is also related to issue #121, which is about the package to use for handling the separator-related aspects.

@lelaus lelaus added the enhancement New feature or request label Mar 7, 2024
panDanieleN added a commit that referenced this issue Mar 9, 2024
…pathname in set_custom_properties_path + used pathlib.os.sep to split the provided path
@panDanieleN
Copy link
Collaborator

The error described in #144 concerning set_custom_properties_path method seems to be only Windows related. Indeed, trying to replicate the same in Linux, the method works correctly:

>>> from lbh15 import Lead
>>> import os
>>> path = os.getcwd()+'\\tests\\custom_properties\\lead_properties.py'
>>> Lead.set_custom_properties_path(path)
sys:1: UserWarning: '/home/daniele.panico/sw_develop/mat_develop/lbh15\tests\custom_properties\lead_properties.py' provided file not found!
Please check the file path and try again!
No custom property added.

In other words, it returns a warning saying that the file does not exist and the module is not added. I think this behaviour is ok: the file does not exists if the separator is wrong.

@panDanieleN
Copy link
Collaborator

Merged into master.

No need to update doc and tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants