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

Incorrectly strips ., p and y from end of module name #15

Open
jonseymour opened this issue May 14, 2018 · 1 comment
Open

Incorrectly strips ., p and y from end of module name #15

jonseymour opened this issue May 14, 2018 · 1 comment

Comments

@jonseymour
Copy link

jonseymour commented May 14, 2018

The intent of the referenced line of code is to strip the extension .py (and only the extension .py) from the end of the filename to yield the module name.

migration_module_name = name.strip('.py')

However the actual effect of the referenced line of code is to strip any occurrence of '.y', 'p' or '.' from the end of the file name irrespective of whether the characters occur strictly in the context of the sequence '.py'

To reproduce, attempt to create a migration whose name ends with the letter 'y'.

The problem is that the python strip() function does not have the intended semantics of stripping a suffix, only individual matching characters.

@jonseymour
Copy link
Author

jonseymour commented May 14, 2018

It should also be noted, that the point this statement executed, name did not actually contain any .py suffix.

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

1 participant