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

Non-lazy loading leads to missing properties in SeachQuery #98

Closed
lzkelley opened this issue May 19, 2017 · 2 comments
Closed

Non-lazy loading leads to missing properties in SeachQuery #98

lzkelley opened this issue May 19, 2017 · 2 comments

Comments

@lzkelley
Copy link

A lazy query is giving me normal, valid responses with all of the properties in place and seemingly valid. Adding fl parameters however breaks some of those parameters (example below) giving "Unknown author" and "Unknown year" responses.

Steps to Reproduce (for bugs)

bib = '2010ApJ...725L..91K'
papers = ads.SearchQuery(bibcode=bib)
for pp in papers:
    print(pp, pp.bibcode)

papers = ads.SearchQuery(bibcode=bib, fl=['bibcode'])
for pp in papers:
    print(pp, pp.bibcode)

Produces the output:

<Kelley, Luke Zoltan et al. 2010, 2010ApJ...725L..91K> 2010ApJ...725L..91K
<Unknown author Unknown year, 2010ApJ...725L..91K> 2010ApJ...725L..91K

Your Environment

print(ads.__version__)
print(sys.version)
> 0.12.3
> 3.5.2 |Anaconda custom (x86_64)| (default, Jul  2 2016, 17:52:12) 
  [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)]
@vsudilov
Copy link
Collaborator

Hi,

Nice catch. This is a side effect of the choice to not use lazy loading in the Article classes' __unicode__/__str__ method.

I agree that the current behavior is unintuitive and I don't see a reason to not change it.

@lzkelley
Copy link
Author

Ah, I see, interesting. Yeah, I just checked and accessing those same elements directly (i.e. pp.article) still works fine. It's easy to use that as a fix for me, but yeah... seems like there's no reason not to (low-priority) fix the __unicode__ usage too. Thanks!

jonnybazookatone added a commit that referenced this issue May 20, 2017
Article: use lazy load for print methods; closes #98
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