Skip to content

Fix logic in Project.conf_dir #1629

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

Merged
merged 3 commits into from
Sep 14, 2015

Conversation

gregmuellegger
Copy link
Contributor

The original implementation replaced "/conf.py" with an empty string, where it
only wanted to return the directory name of the conf.py file. This resulted in
problems when "/conf.py" was part of the directory name!

Fixes #1553.

The original implementation replaced "/conf.py" with an empty string, where it
only wanted to return the directory name of the conf.py file. This resulted in
problems when "/conf.py" was part of the directory name!

Fixes #1553.
@gregmuellegger
Copy link
Contributor Author

@agjohnson @ericholscher up for a review/merge?

return conf_py_path.replace('conf.py', '')
conf_py_path = self.project.conf_dir(self.slug)
if not conf_py_path.endswith('/'):
conf_py_path += '/'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be os.path.sep or rely on os.path.join. Also, if you use os.path.relpath below, you shouldn't need this at all as it handles normalizing paths a little bit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent idea. Fixed.

agjohnson added a commit that referenced this pull request Sep 14, 2015
…-in-the-path

Fix logic in Project.conf_dir
@agjohnson agjohnson merged commit 666ea68 into master Sep 14, 2015
@agjohnson agjohnson deleted the fix-project-conf-dir-if-conf.py-is-in-the-path branch September 14, 2015 16:06
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

Successfully merging this pull request may close these issues.

2 participants