summaryrefslogtreecommitdiff
path: root/django/core
AgeCommit message (Collapse)Author
2013-12-29Stopped calling get_models() for a side effect.Aymeric Augustin
2013-12-29Changed get_validation_errors to use an app config.Aymeric Augustin
2013-12-29Changed get_migratable_models to use an app config.Aymeric Augustin
2013-12-29Changed sql_* to use an app config instead of a models module.Aymeric Augustin
2013-12-29Removed unused import.Aymeric Augustin
2013-12-29Added AppConfig.get_models().Aymeric Augustin
2013-12-29Refactored the migration signals to use app configs.Aymeric Augustin
De-aliased pre/post_syncdb to pre/post_migrate to increase backwards-compatibility.
2013-12-28Fixed #21242 -- Allowed more IANA schemes in URLValidatorClaude Paroz
Thanks Sascha Peilicke for the report and initial patch, and Tim Graham for the review.
2013-12-28Changed get_model to raise an exception on errors.Aymeric Augustin
Returning None on errors required unpythonic error checking and was inconsistent with get_app_config. get_model was a private API until the previous commit, but given that it was certainly used in third party software, the change is explained in the release notes. Applied the same change to get_registered_model, which is a new private API introduced during the recent refactoring.
2013-12-28Introduced as_bytes for SafeMIMEText (and other SafeMIME-classes).Florian Apolloner
This is to provide a consistent interface (namely bytes) for the smtp backend which after all sends bytes over the wire; encoding with as_string yields different results since mails as unicode are not really specified. as_string stays for backwardscompatibilty mostly and some debug outputs. But keep in mind that the output doesn't match as_bytes!
2013-12-28Worked around a bug in python 3.3.3. Refs #21093Florian Apolloner
2013-12-28Fixed #21093 -- Ensured that mails are not base64 encoded on python 3.3.3+.Florian Apolloner
Thanks to Arfrever for the report and Aymeric for the review.
2013-12-28Used app_label instead of appname.Aymeric Augustin
The last component of the dotted path to the application module is consistently referenced as the application "label". For instance it's AppConfig.label. appname could be confused with AppConfig.name, which is the full dotted path.
2013-12-28Migrated built-in AppCommands to use handle_app_config.Aymeric Augustin
2013-12-28Updated the AppCommand API to support apps without a models module.Aymeric Augustin
2013-12-27Refactored dumpdata with app configs instead of models modules.Aymeric Augustin
2013-12-26Made the AppConfig API marginally more consistent.Aymeric Augustin
Eliminated the app_ prefix that was more confusing than useful.
2013-12-25Merge pull request #2105 from funkybob/cleanup_get_postAymeric Augustin
Used @cached_property for request.GET and COOKIES
2013-12-24Renamed AppCache to Apps.Aymeric Augustin
Also renamed app_cache to apps and "app cache" to "app registry". Deprecated AppCache.app_cache_ready() in favor of Apps.ready().
2013-12-24Use cached_property for request.GET and request.COOKIESCurtis
2013-12-22Moved apps back in the toplevel django namespace.Aymeric Augustin
Reverted 4a56a93cc458e9ab4dcab95d9f5067d4975dd1a2.
2013-12-22Added the ability to supply custom app configs.Aymeric Augustin
2013-12-22Improved set_available_apps() in several ways.Aymeric Augustin
- Tested consistency the current app_configs instead of INSTALLED_APPS. - Considered applications added with _with_app as available. - Added docstrings.
2013-12-22Stop testing for inclusion in INSTALLED_APPS.Aymeric Augustin
Removed some exception masking in the comments app that was harmful and couldn't be preserved easily.
2013-12-22Renamed registered_model to has_model.Aymeric Augustin
This avoids possible confusion with register_model. Thanks Marc Tamlyn for the suggestion.
2013-12-22Stopped iterating on INSTALLED_APPS.Aymeric Augustin
Used the app cache's get_app_configs() method instead.
2013-12-22Not all Python modules have a __path__.Aymeric Augustin
2013-12-22Populated models only when necessary in get_app_config[s].Aymeric Augustin
Took this opportunity to change get_app[s] to only consider applications containing a model module as that seems slightly more backwards compatible. Since callers that care about models pass only_with_models_module=True, this has very few consequences. Only AppCommand needed a change.
2013-12-22Deprecated load_app().Aymeric Augustin
Adjusted several tests that used it to add apps to the app cache and then attempted to remove them by manipulating attributes directly. Also renamed invalid_models to invalid_models_tests to avoid clashing application labels between the outer and the inner invalid_models applications.
2013-12-22Added an _-prefix to pending lookups because it's transient.Aymeric Augustin
2013-12-22Terminated AppCache._populate() with extreme prejudice.Aymeric Augustin
It was called _populate() before I renamed it to populate(). Since it has been superseded by populate_models() there's no reason to keep it. Removed the can_postpone argument of load_app() as it was only used by populate(). It's a private API and there's no replacement. Simplified load_app() accordingly. Then new version behaves exactly like the old one even though it's much shorter.
2013-12-22Implemented two-stage app-cache population.Aymeric Augustin
First stage imports app modules. It doesn't catch import errors. This matches the previous behavior and keeps the code simple. Second stage import models modules. It catches import errors and retries them after walking through the entire list once. This matches the previous behavior and seems useful. populate_models() is intended to be equivalent to populate(). It isn't wired yet. That is coming in the next commit.
2013-12-22Removed the app_config.installed flag.Aymeric Augustin
Since applications that aren't installed no longer have an application configuration, it is now always True in practice. Provided an abstraction to temporarily add or remove applications as several tests messed with app_config.installed to achieve this effect. For now this API is _-prefixed because it looks dangerous.
2013-12-22Removed the only_installed argument of get_app_config[s].Aymeric Augustin
It wasn't used anywhere and couldn't be implemented any more since non-installed apps no longer have a configuration.
2013-12-22Refactored registration of models.Aymeric Augustin
Got rid of AppConfig._stub. As a side effect, app_cache.app_configs now only contains entries for applications that are in INSTALLED_APPS, which is a good thing and will allow dramatic simplifications (which I will perform in the next commit). That required adjusting all methods that iterate on app_configs without checking the "installed" flag, hence the large changes in get_model[s]. Introduced AppCache.all_models to store models: - while the app cache is being populated and a suitable app config object to register models isn't available yet; - for applications that aren't in INSTALLED_APPS since they don't have an app config any longer. Replaced get_model(seed_cache=False) by registered_model() which can be kept simple and safe to call at any time, and removed the seed_cache argument to get_model[s]. There's no replacement for that private API. Allowed non-master app caches to go through populate() as it is now safe to do so. They were introduced in 1.7 so backwards compatibility isn't a concern as long as the migrations framework keeps working.
2013-12-22Added a context manager to hold the import lock.Aymeric Augustin
2013-12-17Style cleanup forgotten in second previous commit.Aymeric Augustin
2013-12-17Deborgified the app cache.Aymeric Augustin
Improved Andrew's hack to create temporary app caches to handle migrations. Now the main app cache has a "master" flag set to True (which is a non-default keyword argument, thus unlikely to be used by mistake). Other app cache instances have "master" set to False. The only sanctioned way to access the app cache is by importing django.core.apps.app_cache. If you were instanciating an app cache and relying on the Borg pattern, you'll have to refactor your code.
2013-12-17Moved the new app cache inside core.Aymeric Augustin
2013-12-17Made it possible to create apps without a models module.Aymeric Augustin
This commit reverts f44c4a5d0f and 39bbd165. django.test.simple will be updated in a separate commit as it requires invasive changes.
2013-12-17Deprecated get_app().Aymeric Augustin
2013-12-17Deprecated get_apps().Aymeric Augustin
2013-12-17Removed the _-prefix for populate().Aymeric Augustin
Several parts of Django call get_apps() with a comment along this lines of "this has the side effect of calling _populate()". I fail to see how this is better than just calling populate()!
2013-12-17Deprecated get_app_package, get_app_path and get_app_paths.Aymeric Augustin
2013-12-17Removed unused attribute app_errors of the app cache.Aymeric Augustin
get_app_errors() always returned an empty dictionary; this behavior is preserved in django.db.models.loading until that module is deprecated.
2013-12-17Removed module-level functions for the app cache.Aymeric Augustin
Since the original ones in django.db.models.loading were kept only for backwards compatibility, there's no need to recreate them. However, many internals of Django still relied on them. They were also imported in django.db.models. They never appear in the documentation, except a quick mention of get_models and get_app in the 1.2 release notes to document an edge case in GIS. I don't think that makes them a public API. This commit doesn't change the overall amount of global state but clarifies that it's tied to the app_cache object instead of hiding it behind half a dozen functions.
2013-12-17Moved django.db.models.loading to django.apps.cache.Aymeric Augustin
This commit doesn't contain any code changes; it's purely a refactoring.
2013-12-14Fixed E127 pep8 warnings.Loic Bistuer
2013-12-10Fixed E124 pep8 warnings.Loic Bistuer
2013-12-07Trigger AttributeError in ValidationError.message_dict when error_dict is ↵Loic Bistuer
missing. The goal of this change is twofold; firstly, matching the behavior of Django 1.6 and secondly, an AttributeError is more informative than an obscure ValueError about mismatching sequence lengths. Refs #20867.