-
Notifications
You must be signed in to change notification settings - Fork 14
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
bug fix: last pr had issue if venv wasn't being utilized #56
Conversation
django_fastdev/apps.py
Outdated
# just in case venv resides in project dir | ||
if venv_dir and module_path.startswith(str(venv_dir)): | ||
return False | ||
return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new code is not what I suggested, and it's broken. It implicitly returns None
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused, you me the if venv_dir
bit? I just use implicit truthy testing in case somehow venv_dir is an empty string (using is None
would cause that check to pass, and then startswith()
would always succeed since it is being passed a blank string)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I mean your code is like:
def foo():
if x:
return True
# NO ELSE HERE
That's the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohhh, duh! fixed, sorry! :P
django_fastdev/apps.py
Outdated
@@ -83,6 +83,15 @@ def get_gitignore_path(): | |||
return None | |||
|
|||
|
|||
def get_venv_path(): | |||
return os.environ.get("VIRTUAL_ENV", None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point! I did a little bit of research to reliably determine the best ways to get the venv path, and chained them all into the get_venv_path() func now. should be hard to find a scenario where it won't pick up now I think
I am sorry my friend! I found a bug in my code from my previous pr. if one wasn't using a venv (and using python at root level instead), the check against project dir would always fail. additionally, I made a mistake in the if statement that checked whether or not a form should be verified (I should have grouped the or operand). this pr fixes these errors. forgive my mistakes! :(