Commit Graph

54 Commits

Author SHA1 Message Date
Jon Dufresne 2c69824e5a Refs #23968 -- Removed unnecessary lists, generators, and tuple calls. 2017-06-01 19:08:59 -04:00
Tim Graham 6b4f018b2b Replaced type-specific assertions with assertEqual().
Python docs say, "it's usually not necessary to invoke these methods directly."
2017-03-17 07:51:48 -04:00
Anton Samarchyan 110f4bb6a2 Tested AppConfig.__repr__(). 2017-01-27 09:55:08 -05:00
Tim Graham 4e729feaa6 Refs #23919 -- Removed django.utils._os.upath()/npath()/abspathu() usage.
These functions do nothing on Python 3.
2017-01-20 08:01:02 -05:00
Simon Charette 9695b14982 Refs #23919 -- Removed str() conversion of type and method __name__. 2017-01-19 11:31:07 -05:00
Simon Charette cecc079168 Refs #23919 -- Stopped inheriting from object to define new style classes. 2017-01-19 08:39:46 +01:00
Claude Paroz c716fe8782 Refs #23919 -- Removed six.PY2/PY3 usage
Thanks Tim Graham for the review.
2017-01-18 16:21:28 +01:00
Claude Paroz d7b9aaa366 Refs #23919 -- Removed encoding preambles and future imports 2017-01-18 09:55:19 +01:00
za 321e94fa41 Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings. 2016-11-10 21:30:21 -05:00
inondle 080dd74e01 Fixed #26616 -- Improved error message when AppConfig.name is invalid. 2016-06-02 10:37:00 -04:00
Tim Graham 92053acbb9 Fixed E128 flake8 warnings in tests/. 2016-04-08 10:12:33 -04:00
Hasan 26ad01719d Refs #26022 -- Replaced six.assertRaisesRegex with assertRaisesMessage as appropriate. 2016-01-29 13:37:33 -05:00
pp b34ff66e5b Added missing period to "etc.". 2016-01-11 18:05:15 -05:00
Simon Charette a08fda2111 Fixed #25746 -- Isolated inlined test models registration.
Thanks to Tim for the review.
2016-01-06 20:00:07 -05:00
Simon Charette 1c5f4e86bc Fixed #25745 -- Promoted RuntimeWarnings to errors in the test suite. 2015-11-14 11:33:28 -05:00
Tim Graham 3af9b70028 Refs #22789 -- Removed contrib.webdesign per deprecation timeline. 2015-09-23 19:31:09 -04:00
Caio Ariede 6a98396b9d Fixed #25246 -- Guarded against duplicate paths in AppConfig. 2015-09-02 15:27:41 -04:00
Maxime Lorant 5153a3bfdc Fixed #25331 -- Removed trailing blank lines in docstrings. 2015-08-31 17:37:21 -04:00
Marten Kenbeek aabb58428b Refs #23621 -- Fixed warning message when reloading models. 2015-06-30 15:00:10 -04:00
Tim Graham 7f1168e387 Removed support for Python 3.3. 2015-06-18 08:36:50 -04:00
Peter Inglesby 0688a7946a Fixed #24776 -- Improved apps.get_app_config() error message on fully-qualified package names. 2015-05-22 11:08:25 -04:00
Simon Charette be67400b47 Refs #24652 -- Used SimpleTestCase where appropriate. 2015-05-20 13:46:13 -04:00
Alex Hill 720ff740e7 Fixed #24215 -- Refactored lazy model operations
This adds a new method, Apps.lazy_model_operation(), and a helper function,
lazy_related_operation(), which together supersede add_lazy_relation() and
make lazy model operations the responsibility of the App registry. This
system no longer uses the class_prepared signal.
2015-03-25 16:48:17 -04:00
Tim Graham 307c0f299a Refs #24324 -- Fixed Python 2 test failures when path to Django source contains non-ASCII characters. 2015-02-17 19:03:03 -05:00
Tim Graham 9033003d97 Added check_apps_ready() to Apps.get_containing_app_config() 2015-02-08 14:52:19 -05:00
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Tim Graham c0cc8f69e7 Refactored tests that rely on an ImportError for Python 3.5 compatibility
A change in Python test discovery [1] causes the old packages that raised
an error to be discovered; now we use a common directory that's
ignored during discovery. Refs #23763.

[1] http://bugs.python.org/issue7559
2015-02-03 18:30:46 -05:00
Tim Graham ef9e3c5ed8 Fixed flake8 warning. 2014-10-22 21:21:02 -04:00
Loic Bistuer b62f72498a Improved warning message when reloading models. Refs #23621.
Thanks dfunckt and Tim Graham.
2014-10-23 01:46:04 +07:00
Loic Bistuer 8c4ca16c65 Fixed #23621 -- Warn for duplicate models when a module is reloaded.
Previously a RuntimeError was raised every time two models clashed
in the app registry. This prevented reloading a module in a REPL;
while it's not recommended to do so, we decided not to forbid this
use-case by turning the error into a warning.

Thanks @dfunckt and Sergey Pashinin for the initial patches.
2014-10-23 00:55:02 +07:00
Aymeric Augustin b161c01c48 Fixed #22920 -- Avoid masking some exceptions.
If loading an application trigger an ImportError, the details of that
error were lost in some cases. Thanks Ben Davis for the report.
2014-09-08 23:16:50 +02:00
Tim Graham e0cf030194 Removed unnecessary absolute_imports. 2014-08-25 10:07:14 -04:00
Carl Meyer 88a2d39159 Fixed #21874 -- Require Django applications to have a filesystem path.
Wherever possible this filesystem path is derived automatically from the app
module's ``__path__`` and ``__file__`` attributes (this avoids any
backwards-compatibility problems).

AppConfig allows specifying an app's filesystem location explicitly, which
overrides all autodetection based on ``__path__`` and ``__file__``. This
permits Django to support any type of module as an app (namespace packages,
fake modules, modules loaded by other hypothetical non-filesystem module
loaders), as long as the app is configured with an explicit filesystem path.

Thanks Aymeric for review and discussion.
2014-01-27 15:34:22 -07:00
Simon Charette c3881944e8 Fixed some missing/extraneous new line warnings. 2014-01-26 14:32:01 -05:00
Aymeric Augustin 3c47786cb9 Fixed #21702 -- get_model('app_label.ModelName').
Also added tests for get_model.
2014-01-26 13:01:09 +01:00
Carl Meyer ca95f8e435 Moved sys.path-extending decorator to django.test.utils and used throughout test suite.
Thanks Aymeric for the suggestion.
2014-01-25 22:50:40 -07:00
Carl Meyer 966b186981 Fixed #17304 -- Allow single-path and configured-path namespace packages as apps.
Also document the conditions under which a namespace package may or may not be
a Django app, and raise a clearer error message in those cases where it may not
be.

Thanks Aymeric for review and consultation.
2014-01-25 19:37:05 -07:00
Aymeric Augustin 2ff93e027c Fixed #21829 -- Added default AppConfigs.
Thanks Russell for the report, Marc for the initial patch, Carl for the
final review, and everyone who contributed to the design discussion.
2014-01-25 10:41:56 +01:00
Carl Meyer 29ddae7436 Fixed #21871 -- Fixed Apps.is_installed() for apps with custom label.
Thanks Aymeric for design discussion.
2014-01-24 20:07:14 -07:00
Aymeric Augustin 6a320cc14a Fixed #21718 -- Renamed has_app to is_installed. 2014-01-06 22:48:41 +01:00
Aymeric Augustin 63137a8304 Enforced unicity of app labels.
Fixed #21679.
2013-12-31 18:04:54 +01:00
Aymeric Augustin c40209dcc0 Made it possible to change an application's label in its configuration.
Fixed #21683.
2013-12-31 17:30:58 +01:00
Aymeric Augustin bfcc686d22 Removed the only_with_models_module argument of get_model[s].
Now that the refactorings are complete, it isn't particularly useful any
more, nor very well named. Let's keep the API as simple as possible.

Fixed #21689.
2013-12-30 23:59:34 +01:00
Aymeric Augustin 7ed20e0153 Populated Apps instances immediately by default. 2013-12-30 22:11:17 +01:00
Aymeric Augustin 34a215d506 Deprecated the app argument of apps.get_models.
Use app_config.get_models() instead.
2013-12-29 21:48:58 +01:00
Aymeric Augustin ba7206cd81 Changed get_model to raise an exception on errors.
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-28 20:53:00 +01:00
Aymeric Augustin bbdf01e00a Populated non-master app registries.
This removes the gap between the master app registry and ad-hoc app
registries created by the migration framework, specifically in terms
of behavior of the get_model[s] methods.

This commit contains a stealth feature that I'd rather not describe.
2013-12-28 20:37:42 +01:00
Aymeric Augustin 40b8767635 Fixed a couple flake8 warnings. 2013-12-27 21:06:28 +01:00
Aymeric Augustin 8779aa806e Added a test for Apps.has_app. 2013-12-26 20:39:28 +01:00
Aymeric Augustin cfbdd587f6 Added file forgotten in previous commit, plus one more test. 2013-12-26 19:29:32 +01:00