Commit Graph

59 Commits

Author SHA1 Message Date
Shai Berger 41afae4ce9 Reorganized the database test settings
Change database test settings from "TEST_"-prefixed entries in the
database settings dictionary to setting in a dictionary that is itself
an entry "TEST" in the database settings.

Refs #21775

Thanks Josh Smeaton for review.
2014-03-09 03:57:18 +02:00
Claude Paroz 210d0489c5 Fixed #21188 -- Introduced subclasses for to-be-removed-in-django-XX warnings
Thanks Anssi Kääriäinen for the idea and Simon Charette for the
review.
2014-03-08 09:57:40 +01:00
Marc Tamlyn d238ab2991 Silence deprecation warnings.
Also they should only be raised if allow_syncdb does exist, not just if
allow_migrate does not.

Refs comments on 250841017c
2014-02-09 17:48:15 +00:00
Marc Tamlyn 250841017c Raise (pending) deprecation warning for allow_syncdb. 2014-02-09 11:42:34 +00:00
Berker Peksag 5d263dee30 Fixed #21674 -- Deprecated the import_by_path() function in favor of import_string().
Thanks Aymeric Augustin for the suggestion and review.
2014-02-08 11:12:19 -05:00
Aymeric Augustin 856aaaf2b1 Changed get_migratable_models to use an app config. 2013-12-29 21:25:28 +01:00
Aymeric Augustin 1716b7ce5a Renamed AppCache to Apps.
Also renamed app_cache to apps and "app cache" to "app registry".

Deprecated AppCache.app_cache_ready() in favor of Apps.ready().
2013-12-24 12:25:17 +01:00
Aymeric Augustin 2fef9e5375 Moved apps back in the toplevel django namespace.
Reverted 4a56a93cc4.
2013-12-22 11:39:55 +01:00
Aymeric Augustin 4a56a93cc4 Moved the new app cache inside core. 2013-12-17 10:17:46 +01:00
Aymeric Augustin 8662654d6d Removed module-level functions for the app cache.
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-17 10:17:44 +01:00
Tim Graham 36ded01527 Fixed #21302 -- Fixed unused imports and import *. 2013-11-02 15:24:56 -04:00
Alasdair Nicol a800036981 Fixed #21287 -- Fixed E123 pep8 warnings 2013-10-18 10:07:39 +01:00
Claude Paroz 650b6fd90e Add get_migratable_models util method to ConnectionRouter 2013-10-16 18:02:49 +02:00
Anssi Kääriäinen 9400142132 Fixed #21109 -- made db cursor error wrapping faster 2013-09-17 12:18:55 +03:00
Andrew Godwin de64c4d6e9 Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
	django/core/management/commands/flush.py
	django/core/management/commands/syncdb.py
	django/db/models/loading.py
	docs/internals/deprecation.txt
	docs/ref/django-admin.txt
	docs/releases/1.7.txt
2013-08-09 14:17:30 +01:00
Andrew Godwin 12e9804d16 Rename allow_syncdb to allow_migrate 2013-07-30 12:08:59 +01:00
Claude Paroz fdd7a355bf Deprecated django.utils.importlib
This was a shim for pre-Python 2.7 support.
2013-07-29 17:10:22 +02:00
Aymeric Augustin d5589b4cd3 Removed some conditional code only needed under Python 2.6. 2013-07-01 12:02:17 +02:00
Aymeric Augustin acd7b34aaf Advanced deprecation warnings for Django 1.7. 2013-06-29 18:49:37 +02:00
James Aylett 5448555785 Fixed #17601 -- expose underlying db exceptions under py2
Use __cause__ to expose the underlying database exceptions even
under python 2.
2013-06-04 12:46:10 +01:00
Claude Paroz 7e95d7a930 Fixed a regression in router initialization
Regression was introduced in 6a6bb168b. Thanks Bas Peschier for the
report.
2013-05-24 20:48:02 +02:00
Claude Paroz 6a6bb168be Delayed settings.DATABASE_ROUTERS usage by ConnectionRouter
Refs #20474.
2013-05-23 15:19:12 +02:00
Claude Paroz 2d8c132b18 Delayed settings.DATABASES usage by ConnectionHandler
Refs #20474.
2013-05-23 15:19:12 +02:00
Aymeric Augustin 3d595c3bc3 Fixed #20215 -- Disabled persistent connections by default. 2013-05-09 15:42:14 +02:00
Aymeric Augustin ac37ed21b3 Deprecated TransactionMiddleware and TRANSACTIONS_MANAGED.
Replaced them with per-database options, for proper multi-db support.

Also toned down the recommendation to tie transactions to HTTP requests.
Thanks Jeremy for sharing his experience.
2013-03-11 15:04:05 +01:00
Aymeric Augustin cf30469164 Fixed tests broken in 2ee21d9. 2013-02-28 17:08:16 +01:00
Aymeric Augustin 2ee21d9f0d Implemented persistent database connections.
Thanks Anssi Kääriäinen and Karen Tracey for their inputs.
2013-02-28 15:28:13 +01:00
Aymeric Augustin 1b100d7bee Fixed two bugs in 59a35208.
* StandardError doesn't exist any more under Python 3.
* Python 2.6 still allows `raise "foo"`.
2013-02-27 19:24:23 +01:00
Aymeric Augustin 59a3520875 Refactored database exceptions wrapping.
Squashed commit of the following:

commit 2181d833ed1a2e422494738dcef311164c4e097e
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Wed Feb 27 14:28:39 2013 +0100

    Fixed #15901 -- Wrapped all PEP-249 exceptions.

commit 5476a5d93c19aa2f928c497d39ce6e33f52694e2
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Feb 26 17:26:52 2013 +0100

    Added PEP 3134 exception chaining.

    Thanks Jacob Kaplan-Moss for the suggestion.

commit 9365fad0a650328002fb424457d675a273c95802
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Feb 26 17:13:49 2013 +0100

    Improved API for wrapping database errors.

    Thanks Alex Gaynor for the proposal.

commit 1b463b765f2826f73a8d9266795cd5da4f8d5e9e
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Feb 26 15:00:39 2013 +0100

    Removed redundant exception wrapping.

    This is now taken care of by the cursor wrapper.

commit 524bc7345a724bf526bdd2dd1bcf5ede67d6bb5c
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Feb 26 14:55:10 2013 +0100

    Wrapped database exceptions in the base backend.

    This covers the most common PEP-249 APIs:
    - Connection APIs: close(), commit(), rollback(), cursor()
    - Cursor APIs: callproc(), close(), execute(), executemany(),
      fetchone(), fetchmany(), fetchall(), nextset().

    Fixed #19920.

commit a66746bb5f0839f35543222787fce3b6a0d0a3ea
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Tue Feb 26 14:53:34 2013 +0100

    Added a wrap_database_exception context manager and decorator.

    It re-throws backend-specific exceptions using Django's common wrappers.
2013-02-27 17:26:54 +01:00
Anssi Kääriäinen fafee74306 Removed try-except in django.db.close_connection()
The reason was that the except clause needed to remove a connection
from the django.db.connections dict, but other parts of Django do not
expect this to happen. In addition the except clause was silently
swallowing the exception messages.

Refs #19707, special thanks to Carl Meyer for pointing out that this
approach should be taken.
2013-02-13 00:25:09 +02:00
Anssi Kääriäinen a4e97cf315 Fixed #19707 -- Reset transaction state after requests 2013-02-10 13:55:54 +02:00
Claude Paroz 7c5b244826 Fixed #17061 -- Factored out importing object from a dotted path
Thanks Carl Meyer for the report.
2013-02-04 16:38:25 +01:00
Claude Paroz c91667338a Fixed #19357 -- Allow non-ASCII chars in filesystem paths
Thanks kujiu for the report and Aymeric Augustin for the review.
2012-12-08 11:13:52 +01:00
Claude Paroz f1cc2be0c5 Fixed #18575 -- Empty DATABASES should default to dummy backend
Thanks delormemarco@gmail.com for the report.
2012-10-28 23:44:03 +01:00
Claude Paroz 34a736b752 Used pkgutil to get list of backend modules
Refs #18827.
2012-10-07 21:59:16 +02:00
Ramiro Morales 35e8dc5169 Removed ad-hoc support for usage of short names of built-in DB backends.
This non-standard naming was deprecated in Django 1.2.
2012-10-06 23:27:08 -03:00
Ramiro Morales 2100da9dcd Ensure we ignore __pycache__ PEP 3174 dirs in a few more places. 2012-10-06 18:40:58 -03:00
Aymeric Augustin 3cb2457f46 [py3] Replaced basestring by six.string_types. 2012-07-22 09:29:54 +02:00
Claude Paroz 3904b74a3f Fixed #18013 -- Use the new 'as' syntax for exceptions.
Thanks Clueless for the initial patch.
Note that unittest has been purposely left out (external package only used by Python 2.6).
2012-04-29 20:57:15 +02:00
Jannis Leidel db2b1458b1 Fixed #17047 -- Improved django.db.utils.load_backend to raise a better exception when using a unqualified database backend name. Thanks, Jonas Obrist.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17274 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-25 13:24:39 +00:00
Julien Phalip 34e248efec Fixed #17258 -- Moved `threading.local` from `DatabaseWrapper` to the `django.db.connections` dictionary. This allows connections to be explicitly shared between multiple threads and is particularly useful for enabling the sharing of in-memory SQLite connections. Many thanks to Anssi Kääriäinen for the excellent suggestions and feedback, and to Alex Gaynor for the reviews. Refs #2879.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17205 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-16 13:40:19 +00:00
Aymeric Augustin 9b1cb755a2 Added support for time zones. Thanks Luke Plant for the review. Fixed #2626.
For more information on this project, see this thread:
http://groups.google.com/group/django-developers/browse_thread/thread/cf0423bbb85b1bbf



git-svn-id: http://code.djangoproject.com/svn/django/trunk@17106 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-11-18 13:01:06 +00:00
Alex Gaynor 9b3aaae255 Removed legacy handing for `settings.DATABAS_*` and using short-form references to the included database backends.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15959 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-30 17:59:44 +00:00
Adrian Holovaty 6091f0ead3 Fixed #15621 -- Fixed potentially confusing error message in db backend loading. Thanks, keegan_csmith
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15871 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-17 16:57:37 +00:00
Adrian Holovaty ad55bb0f87 Changed django/db/utils.py load_backend() to call sorted() instead of .sort(). Saves us a line of code. Taken from patch for #15621
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15851 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-16 04:26:38 +00:00
Alex Gaynor a4898dc50b Fixed the world's ugliest syntax (that's not an actual error) that snuck in with [14857].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14859 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-08 18:37:00 +00:00
Alex Gaynor 2a46323124 Fixed #14870 -- don't catch AttributeErrors in database router methods, instead check that the method itself exists. Thanks to jonash for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14857 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-08 18:31:57 +00:00
Russell Keith-Magee 1070c57b83 Fixed #14436 -- Escalated 1.2 PendingDeprecationWarnings to DeprecationWarnings, and removed 1.1 deprecated code.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14138 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-11 12:20:07 +00:00
Russell Keith-Magee 515b4d3aa8 Fixed #14381 -- Clarified exception handling when instantiating Routers. Thanks to dauerbaustelle for the suggestion and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14005 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-08 13:56:54 +00:00
Russell Keith-Magee 11ee9746a0 Fixed #12702 -- Introduced a common implementation of DatabaseError and IntegrityError, so that database backends can (re)raise common error classes. Thanks for Waldemar Kornewald for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12352 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-29 15:45:55 +00:00