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

Step.available_programs FutureWarning #27

Closed
dbarrell opened this issue Apr 30, 2018 · 3 comments
Closed

Step.available_programs FutureWarning #27

dbarrell opened this issue Apr 30, 2018 · 3 comments

Comments

@dbarrell
Copy link

Hi,

I am getting this warning when using Step.available_programs():

/usr/local/lib/python2.7/dist-packages/pyclarity_lims/entities.py:862: FutureWarning: The behavior of this method will change in future versions.  Use specific 'len(ele
m)' or 'elem is not None' test instead.
  if available_programs_et:

Should I change to a different method to get available programs or is this just related to how the Entities object is going to change in the future?

Thanks!

Dan

@tcezard
Copy link

tcezard commented Apr 30, 2018

It is apparently a message from the Xml library used to parse the xml page.
see https://stackoverflow.com/questions/20129996/why-does-boolxml-etree-elementtree-element-evaluate-to-false
We should change the test

if available_programs_et:

to

if available_programs_et is not None and len(available_programs_et) > 0:

To avoid the warning message.
You do can still use the function as it is though.
I'll keep the issue open until we fix the warning.

@dbarrell
Copy link
Author

dbarrell commented Jun 1, 2018

I created a pull request if it helps: #35

@tcezard
Copy link

tcezard commented Jun 3, 2018

resolved in #35

@tcezard tcezard closed this as completed Jun 3, 2018
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

No branches or pull requests

2 participants