gwu-libraries / launchpad

A django based system that provides a stable URL for every item in the library's catalog. Various discovery services will link to these URLs. The page for each item will in turn link out to various other resources that provide methods for accessing the content of the items.
MIT License
15 stars 9 forks source link

Fixes #1194. Updating list of other campuses' restricted links #1195

Closed lwrubel closed 6 years ago

kerchner commented 6 years ago

@lwrubel ,online_available no longer has any return value defined in the case where link['u'] does not include any restricted values (i.e. it is available/not restricted). The code as written will return either False (when the if condition is met), otherwise it will return None by default because no return value was specified.

I have not tested it in the full app, but it looks like this will cause not access['available'] here to always evaluate to True, which doesn't seem like what you want here.

(Plus, of course, stylistically, you probably want it to deliberately return either True or False, a la Zen of Python #2)

You can either add back an else clause, or simply return not any(s in link['u'] for s in restricted) - whichever you think is more readable.