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
Load globs in alhpebetical order to prevent undefined behavior #40
Conversation
@ava-dylang I appreciate your contribution! Can you please point out several things to me:
Thanks! |
People is Django in other ways than to host first party proprietary apps where they have full control over settings mattering- using random open source Django apps is often enough of a headache to repair to be operable without the filesystem order of a glob making build artifacts unreliable etc. I don't understand why pushback on this change except backwards comparability concerts, however defiantly undefined-behavior is also definitely a bug capable of arbitrary code execution, so I'm fully comfortable considering this change a minor bugfix. If this is untenable, I'm also comfortable producing this change as an optional behavior that has to be enabled. |
I am not against this feature at all, I am just trying to figure out some things that I did not understand from the first time. I see some technical issues that should be fixed before this is merged. Technical issuesI was talking about importing these files with
Module names:
Idealogical issuesI also do not want to enforce the way of relying on We already have a note about |
RE Tech; I prefer config files (well all files names really) to be hyphenated, and checking my system with a quick grep and on The reason the file name doesn't matter in this case comes down to the way this module is loading the file by-file-name coupled with managing the file's loaded scope, doing so like this module does disregards functional criteria of python file names having to be valid namespaces in the current context scope (where hypen is reserved for the subtraction operator). I hope that makes sense, Honestly i've never seen python modules loaded in a way that gets around this constraint, so I think this is really cool!! Or to propose how this module acts another way, when this loads a file, its very similar to if one had concatenated all the files and saved it and imported it ((never do that btw, what this module does is far far better for state management and consistency)) RE Idea, if this module want to imply that whoever is operating the django project that loads settings files always and forever has direct development access to the django modules their loading (Including an understanding of python development, a familiarity with django, a background in programming, a way to test changes for production etc) -- I can undestand that, but I feel it weakens django for operation, like how I want to use it -- where one django host is loading a handful of open source django modules, each of which need thier own config, some of which demand order loading, and all of which, require mutating the same INSTALLED_APPS variable over and over and over without error
This way I'm explicitly declaring all the files I want loaded (like you say this module's ideology expects) in the order I want to load them (by an ordered set of partial files in a directory, allowing a system application to be configured by the system operators and package managers without conflict) Thank you for your time and thoughts on this topic |
Previously files were not sorted at all (using the order at which entries appear in the filesystem). With this approach every file needs to be capable of being loaded in any order- something I woudln't expect users to test for. Sorting files by name-order allows for index config files like 010-base.py and 030-secrets.py to load procedurally and deterministically, and reduces complexity when in use.