dkirkby / bossdata

Tools for accessing SDSS BOSS data
MIT License
1 stars 3 forks source link

Fix logic for using BOSS_* environment variables #97

Closed dkirkby closed 8 years ago

dkirkby commented 8 years ago

The boss.path.Finder and boss.remote.Mirror constructors have optional parameters that are supposed to override the corresponding environment variables. However, these are coded with incorrect logic, for example:

        # Environment variables override the constructor args if they are set.
        self.sas_path = os.getenv('BOSS_SAS_PATH', sas_path)
        if self.sas_path is None:
            self.sas_path = Finder.default_sas_path

Note that the comment is actually correct, but disagrees with the docstring and is not the behavior we want.

dkirkby commented 8 years ago

Change the code above to:

        # Constructor args take precendence over constructor args.
        self.sas_path = os.getenv('BOSS_SAS_PATH') if sas_path is None else sas_path
        if self.sas_path is None:
            self.sas_path = Finder.default_sas_path