Commit Graph

537 Commits

Author SHA1 Message Date
Malcolm Tredinnick 556fbc78a6 Fixed #8039 -- Make sure that extra(tables=...) tables are always included in
the resulting SQL. Previously, an optimisation was removing them in some corner
cases.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8429 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-17 22:38:36 +00:00
Malcolm Tredinnick 2c4b13cbe7 Changed the (internal) way extra(select=.., select_params=...) handling is done
so that parameters stay with their select items. This means that merging and
trimming of those items is handled correctly.

Refs #7957, #7961. Fixed #8191.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8426 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-17 20:07:59 +00:00
Malcolm Tredinnick 98be841549 Fixed #8238 -- If an invalid database backend is mentioned in settings and the
environment doesn't support os.listdir(), we crashed whilst trying to construct
the friendly error message. This was not so friendly.

This patch handles that case (which occurs in real life in Google App Engine).
Patch from Guido van Rossum.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8424 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-17 17:32:31 +00:00
Malcolm Tredinnick 260510453f Fixed #7241 -- More robust exception catching in the transaction management
code. As pointed out in the ticket, Python still lets you raise all sorts of
odd things as exceptions (e.g. strings), so even though they're bad form, we
should still handle them. We do that cleanly now. Thanks to jim-django@dsdd.org
for the patch.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8419 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-17 00:07:06 +00:00
Gary Wilson Jr a949f9ec7d Fixed #3121 -- Made `get_or_create()` work for `RelatedManager` and `ManyRelatedManager`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8415 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-16 20:59:06 +00:00
Malcolm Tredinnick 844089de07 Fixed #8315 -- If an exception is raised whilst trying to rollback a
transaction (after another exception in the code), make sure the original
exception is reported, rather than the rollback-generated one. The latter is
almost certainly a consequence of the former. Patch from Karen Tracey.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8411 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-16 15:58:30 +00:00
Russell Keith-Magee 7299b39752 Fixed #8355: Removed some whitespace that was apparently causing difficulty with script compilation. Thanks to bear330 for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8402 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-16 04:48:57 +00:00
Gary Wilson Jr ddc156bca2 Fixed #6970 -- Raise the original `IntegrityError` when all required fields aren't specified in `get_or_create` instead of a misleading `DoesNotExist` error, thanks deadwisdom.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8398 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-15 23:29:55 +00:00
Malcolm Tredinnick 93462f9516 Reverted [8318] and [8329], since the change turned out to have no effect, upon
closer examination of the C-library layer.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8380 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-15 14:58:59 +00:00
Russell Keith-Magee 1691c22821 Fixed #8331 -- Added style parameter to sqlite backend implementation of sql_remove_table_constraints, missed in recent db backend refactor. Thanks to d00gs for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8364 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-15 07:35:47 +00:00
Matt Boersma fcc42c1bf7 Fixed Oracle backend test case failure in modeltests\lookup.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8355 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-15 01:33:18 +00:00
Gary Wilson Jr 788de6b5fd Fixed #8206 -- Removed validate methods of Model and Model fields. They are are unsupported for 1.0 and will be replaced with more complete model validation (refs #6845).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8348 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-14 15:37:43 +00:00
Matt Boersma ca020a5edd Fixed oracle-specific test DB creation code so the test suite will run again.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8330 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 18:49:44 +00:00
Malcolm Tredinnick a14f41f345 Fixed #8260 -- Changed [8318] to also work with MySQLdb 1.2.1p2.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8329 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 16:28:52 +00:00
Malcolm Tredinnick bb5a35cc54 Fixed a group of missing imports, aliases and parameter passings from the
db.backend.creation refactoring.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8328 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 16:06:55 +00:00
Malcolm Tredinnick 6294fc7179 Changed "exact" matches in MySQL to use the database's native collation.
This effectively reverses the change in [7798]. It was proving too difficult to
successfully manage all the side effects here and provide a satisfactory
solution for everybody. Many thanks to arne, Martin von Löwis and, particular,
Karen Tracey, for doing a lot of research and proto-patches here to establish what was possible and practical.

This is backwards incompatible if you were relying on the behaviour after
[7798]. The docs have been updated to indicate the solution.

Refs #2170, #7789, #8102.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8319 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 07:52:33 +00:00
Malcolm Tredinnick ca71eacdf4 Convert binary-matched VARCHAR fields to unicode objects in the MySQL backend.
This conforms to Djangos' policy of returning Unicode everywhere.

Suggested by arne and Martin von Löwis. Refs #7789.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8318 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 07:52:17 +00:00
Malcolm Tredinnick 6bebb23318 Do not use savepoints with PostgreSQL prior to 8.0.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8317 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 06:31:29 +00:00
Malcolm Tredinnick 3eb8074808 Added savepoint protection to get_or_create() to avoid problems on PostgreSQL.
Fixed #7402.

Also made savepoint handling easier to use when wrapped around calls that might
commit a transaction. This is tested by the get_or_create tests.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8315 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 05:59:43 +00:00
Malcolm Tredinnick 220993bcc5 Added savepoint support to the transaction code.
This is a no-op for most databases. Only necessary on PostgreSQL so that we can
do things which will possibly intentionally raise an IntegrityError and not
have to rollback the entire transaction. Not supported for PostgreSQL versions
prior to 8.0, so should be used sparingly in internal Django code.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8314 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-12 05:34:56 +00:00
Jacob Kaplan-Moss ab1a442a01 Fixed stupid syntax error in [8303].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8305 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-11 15:54:42 +00:00
Jacob Kaplan-Moss 5d837afe23 Fixed #8228: fixed a Python 2.3 compatibility from [8296].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8303 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-11 15:24:44 +00:00
Russell Keith-Magee 97fd752fe7 Removed some empty modules that are no longer required after [8296].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8301 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-11 14:16:09 +00:00
Russell Keith-Magee 3958c36319 Corrected a problem with the error message when the nominated database backend doesn't exist. Thanks to Ramiro Morales for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8297 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-11 13:11:25 +00:00
Russell Keith-Magee 9dc4ba875f Fixed #5461 -- Refactored the database backend code to use classes for the creation and introspection modules. Introduces a new validation module for DB-specific validation. This is a backwards incompatible change; see the wiki for details.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8296 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-11 12:11:25 +00:00
Gary Wilson Jr ef48a3e69c Fixed #7830 -- Removed all of the remaining, deprecated, non-oldforms features:
* Support for representing files as strings was removed. Use `django.core.files.base.ContentFile` instead.
 * Support for representing uploaded files as dictionaries was removed. Use `django.core.files.uploadedfile.SimpleUploadedFile` instead.
 * The `filename`, `file_name`, `file_size`, and `chuck` properties of `UploadedFile` were removed. Use the `name`, `name`, `size`, and `chunks` properties instead, respectively.
 * The `get_FIELD_filename`, `get_FIELD_url`, `get_FIELD_size`, and `save_FIELD_file` methods for Models with `FileField` fields were removed. Instead, use the `path`, `url`, and `size` attributes and `save` method on the field itself, respectively.
 * The `get_FIELD_width` and `get_FIELD_height` methods for Models with `ImageField` fields were removed. Use the `width` and `height` attributes on the field itself instead.
 * The dispatcher `connect`, `disconnect`, `send`, and `sendExact` functions were removed. Use the signal object's own `connect`, `disconnect`, `send`, and `send` methods instead, respectively.
 * The `form_for_model` and `form_for_instance` functions were removed. Use a `ModelForm` subclass instead.
 * Support for importing `django.newforms` was removed. Use `django.forms` instead.
 * Support for importing `django.utils.images` was removed. Use `django.core.files.images` instead.
 * Support for the `follow` argument in the `create_object` and `update_object` generic views was removed. Use the `django.forms` package and the new `form_class` argument instead.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8291 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-10 21:10:47 +00:00
Jacob Kaplan-Moss 049d490875 Fixed #7921: for sqlite3 2.4.1 or later, adapt str objects to unicode, thus preveting weird failures with 8-bit bytestrings. Martin von Löwis and Karen Tracey tracked this one down -- thanks!
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8276 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-09 23:59:01 +00:00
Malcolm Tredinnick dc14b29fb3 Added the ability to force an SQL insert (or force an update) via a model's
save() method.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8267 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-09 17:19:23 +00:00
Jacob Kaplan-Moss 7899568e01 File storage refactoring, adding far more flexibility to Django's file handling. The new files.txt document has details of the new features.
This is a backwards-incompatible change; consult BackwardsIncompatibleChanges for details.

Fixes #3567, #3621, #4345, #5361, #5655, #7415.

Many thanks to Marty Alchin who did the vast majority of this work.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8244 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-08 20:59:02 +00:00
Malcolm Tredinnick 32d5c39016 Fixed #6523 -- Use the correct cast on field types for PostgreSQL when
searching within a field column (e.g. "like", "contains", etc). Required for
PostgreSQL 8.3. Thanks to Dan Watson for the patch.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8242 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-08 20:09:53 +00:00
Malcolm Tredinnick 567b9f2e28 Fixed #8111 -- Error message typo fix. Thanks mzgur.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8229 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-08 14:24:25 +00:00
Jacob Kaplan-Moss 34a3bd5225 Major refactoring of django.dispatch with an eye towards speed. The net result is that signals are up to 90% faster.
Though some attempts and backwards-compatibility were made, speed trumped compatibility. Thus, as usual, check BackwardsIncompatibleChanges for the complete list of backwards-incompatible changes.

Thanks to Jeremy Dunck and Keith Busell for the bulk of the work; some ideas from Brian Herring's previous work (refs #4561) were incorporated.

Documentation is, sigh, still forthcoming.

Fixes #6814 and #3951 (with the new dispatch_uid argument to connect).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8223 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-06 15:32:46 +00:00
Jacob Kaplan-Moss 98d8acf33f Fixed #7683: Try not to delete uploaded files before moving them, and don't wig out of someone else does. Patch from screeley and spaetz.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8217 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-05 17:43:05 +00:00
Jacob Kaplan-Moss 593810a501 Fixed #7904: added support for a "use_for_related_fields" property on managers. If True, the manager will be used for related object lookups instead of the "bare" QuerySet introduced bu [8107]. Patch from Justin Bronn.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8212 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-05 16:13:28 +00:00
Gary Wilson Jr 06885f37be Removed unused warnings import that should have been removed in [8191], refs #7830.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8199 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-03 17:26:50 +00:00
Gary Wilson Jr c85c8f8891 Fixed #7919 -- md5 and sha modules are deprecated since Python 2.5, use hashlib module when available. Patch from Karen Tracey.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8193 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-02 05:56:57 +00:00
Gary Wilson Jr 351a3ca154 Removed several deprecated features for 1.0 (refs #7830):
* "simple" cache backend
 * `ObjectPaginator`
 * `edit_inline_type` argument for `ForeignKey` fields
 * `QOperator`, `QNot`, `QAnd` and `QOr`
 * `maxlength` argument 


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8191 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-02 04:56:11 +00:00
Gary Wilson Jr 2db4b13480 Fixed #8070 -- Cache related objects passed to Model init as keyword arguments. Also:
* Model init no longer performs a database query to refetch the related objects it is passed.
 * Model init now caches unsaved related objects correctly, too. (Previously, accessing the field would raise `DoesNotExist` error for `null=False` fields.)
 * Added tests for assigning `None` to `null=True` `ForeignKey` fields (refs #6886).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8185 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-01 23:16:59 +00:00
Malcolm Tredinnick b7e74e5e56 Fixed #8028 -- A couple of small docstring fixes from [8131]. Thanks, Leo Soto.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8146 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-30 03:16:39 +00:00
Malcolm Tredinnick 464a9c8ca4 Fixed #7637 -- Added an extra parameterisation hook to the Oracle backend.
Required for some extension modules (in particular, geo-django). Patch from
Justin Bronn.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8145 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-30 01:29:31 +00:00
Malcolm Tredinnick 281f2b74bf Fixed #8023 -- Allow filtering of DecimalFields (in models) using strings.
At the same time, checked all other cases of db_prep_value() to ensure they
aren't making the same mistake.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8143 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-30 00:18:49 +00:00
Russell Keith-Magee a14fc40041 Fixed #7913 -- Corrected ham-fisted typo from [8102]. Thanks to evinrik for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8139 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-29 21:43:07 +00:00
Jacob Kaplan-Moss b69b15fe02 Fixed a subtle bug (really, an inconsistency) in ForeignKey that [8132] exposed by causing the model_forms test to fail.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8138 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-29 18:31:27 +00:00
Russell Keith-Magee 174641b9b3 Fixed #6095 -- Added the ability to specify the model to use to manage a ManyToManyField. Thanks to Eric Florenzano for his excellent work on this patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8136 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-29 12:41:08 +00:00
Malcolm Tredinnick af7773f280 Fixed #8011 -- Be careful not to evalute lazy-translated Meta.verbose_name
values whilst importing models.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8132 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-29 05:17:47 +00:00
Malcolm Tredinnick b3b71a0922 Fixed #7560 -- Moved a lot of the value conversion preparation for
loading/saving interactions with the databases into django.db.backend. This
helps external db backend writers and removes a bunch of database-specific
if-tests in django.db.models.fields.

Great work from Leo Soto.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8131 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-29 05:09:29 +00:00
Malcolm Tredinnick 19c7db0058 Fixed #7853 -- Fixed another case of deleting inherited models with foreign key
references. Thanks to Russell for the test case that demonstrated the problem.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8128 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-28 01:32:46 +00:00
Malcolm Tredinnick 55ba38f9d2 Put back [8120] along with a small tweak. Fixed #6217.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8127 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-28 00:45:04 +00:00
Malcolm Tredinnick eca5aacec8 Back out [8120] for a bit. Refs #6217. It's having unintended side-effects (a.k.a breaks the tree)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8126 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-28 00:08:17 +00:00
Malcolm Tredinnick 6a287ed946 Fixed #6217 -- Reduced the memory used by each ugettext_lazy() call.
Thanks to Jakub Wilk for analysis and the initial patch.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8120 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-27 22:51:49 +00:00