Commit Graph

50 Commits

Author SHA1 Message Date
Chris Beaven b077ba7ac1 Add a useful stacklevel to some RemovedInDjango19Warnings 2014-03-27 15:44:52 +13: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
Tim Graham 8e2029f8dd Removed import * in tests.
Thanks to flake8 path/to/file.py | awk -F ' ' '{ print $5 }' | sort | uniq
2013-10-22 08:32:01 -04:00
Tim Graham f40c82213f Added backwards compatability shims for util modules.
refs #17627
2013-09-16 12:53:42 -04:00
Tim Graham 18ffdb1772 Fixed #17627 -- Renamed util.py files to utils.py
Thanks PaulM for the suggestion and Luke Granger-Brown and
Wiktor Kołodziej for the initial patch.
2013-09-16 12:52:05 -04:00
Alex Gaynor 03d9566e0d A large number of stylistic cleanups across django/db/ 2013-07-08 10:39:54 +10:00
Ramiro Morales 0fa8d43e74 Replaced `and...or...` constructs with PEP 308 conditional expressions. 2013-05-26 23:47:50 -03:00
Claude Paroz 3ff3212713 Fixed #19220 -- Prevented decimals to be displayed in scientific notation
Thanks nebstrebor for the report and antofik for the patch.
2013-03-31 22:39:01 +02:00
Claude Paroz 76aecfbc4b Fixed #9055 -- Standardized behaviour of parameter escaping in db cursors
Previously, depending on the database backend or the cursor type,
you'd need to double the percent signs in the query before passing
it to cursor.execute. Now cursor.execute consistently need percent
doubling whenever params argument is not None (placeholder substitution
will happen).
Thanks Thomas Güttler for the report and Walter Doekes for his work
on the patch.
2013-03-23 17:11:10 +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 50328f0a61 Fixed #19861 -- Transaction ._dirty flag improvement
There were a couple of errors in ._dirty flag handling:
  * It started as None, but was never reset to None.
  * The _dirty flag was sometimes used to indicate if the connection
    was inside transaction management, but this was not done
    consistently. This also meant the flag had three separate values.
  * The None value had a special meaning, causing for example inability
    to commit() on new connection unless enter/leave tx management was
    done.
  * The _dirty was tracking "connection in transaction" state, but only
    in managed transactions.
  * Some tests never reset the transaction state of the used connection.
  * And some additional less important changes.

This commit has some potential for regressions, but as the above list
shows, the current situation isn't perfect either.
2013-02-27 17:54:27 +02:00
Claude Paroz 8c69278764 Fixed #18989 -- Removed unused condition in CursorWrapper
Thanks zimnyx for the report.
2012-11-17 16:34:14 +01:00
Claude Paroz 26ff2be787 Imported getLogger directly from logging module
This was a remainder of some 2.4 compatibility code.
2012-09-20 21:03:24 +02:00
Claude Paroz ebc773ada3 Replaced many smart_bytes by force_bytes
In all those occurrences, we didn't care about preserving the
lazy status of the strings, but we really wanted to obtain a
real bytestring.
2012-08-29 11:20:32 +02:00
Claude Paroz 187ec5a166 [py3] Pass bytes to md5 in truncate_name 2012-08-15 12:37:08 +02:00
Claude Paroz 4a103086d5 Fixed #18269 -- Applied unicode_literals for Python 3 compatibility.
Thanks Vinay Sajip for the support of his django3 branch and
Jannis Leidel for the review.
2012-06-07 18:08:47 +02:00
Aymeric Augustin 7beb0db79b Fixed #10320 -- Made it possible to use executemany with iterators. Thanks MockSoul for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17387 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-01-22 16:41:20 +00:00
Aymeric Augustin 30c846bf3d Fixed #6669 -- Ensured database connections are marked as dirty by CursorDebugWrapper.execute/executemany. Refs #9964. Thanks james at 10gic net for the report and Claude Paroz for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17368 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-01-12 21:55: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 efb8327444 Fixed #16808, removed some dead code from teh ORM. Thanks to aaugustin for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16782 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-10 17:38:58 +00:00
Adrian Holovaty 13864703bc Removed a bunch more Python 2.4 workarounds now that we don't support that version. Refs #15702 -- thanks to jonash for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15927 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-28 02:11:19 +00:00
Russell Keith-Magee 7e46b17000 Fixed #15297 -- Corrected an attribute naming regressoin from fixing #9964. Thanks to leonov for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15527 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-14 00:06:52 +00:00
Russell Keith-Magee c40a1d1835 Removed more redundant code from the debug cursor wrapper. Thanks to Ramiro for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15519 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-12 23:50:39 +00:00
Russell Keith-Magee e3a2fef7cc Fixed #15289 -- Removed a redundant __getattr__ implementation from the debug SQL cursor wrapper. Thanks to Apollo13 for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15516 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-12 23:38:50 +00:00
Russell Keith-Magee 6314a1b42e Fixed #9964 -- Ensure that all database operations make transactions dirty, not just write operations. Many thanks to Shai Berger for his work and persistence on this issue.
This is BACKWARDS INCOMPATIBLE for anyone relying on the current behavior that allows manually managed read-only transactions to be left dangling without a manual commit or rollback.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15493 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-12 13:03:34 +00:00
Ramiro Morales 6774207394 Fixed #14453 -- Changed handling of microseconds part in typecast_timestamp() DB backend helper function to be more correct. Thanks philipn for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14664 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-21 15:08:53 +00:00
Russell Keith-Magee fea159282b Fixed #14406 -- Added a Python 2.4 compatibility to the logging interface. Thanks to Łukasz Rekucki for the report, and to Luke Plant for original patch this was based on.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13989 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-06 15:02:26 +00:00
Russell Keith-Magee 24acca4139 Fixed #12012 -- Added support for logging. Thanks to Vinay Sajip for his draft patch, and to the many people who gave feedback during development of the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13981 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-04 15:12:39 +00:00
Malcolm Tredinnick 17a79d5033 Changed the way we create class names for deferred field models to avoid
problems when people have hundreds of fields on model. Maximum class
name length is now 80 characters and uses a hash when necessary.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13819 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-09-13 05:08:10 +00:00
Russell Keith-Magee 5211f48ae3 Fixed #12164 -- Removed the Python 2.3 compatibility imports and workarounds. Thanks to timo and claudep for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13094 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-05-04 14:00:30 +00:00
Karen Tracey cb6a5886f6 Fixed #5079 -- Avoid converting Decimals to floats during save to the database.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9394 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-12 00:35:24 +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
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 732074541a Fixed #5883 -- Added __iter__ methods to the debug cursor and the postgresql backend cursor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7259 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-17 14:15:15 +00:00
Adrian Holovaty c599de2ac6 Added a BaseDatabaseOperations.last_executed_query() hook, which allows a database backend to specify how to get the last-executed query on a given cursor. Implemented it for the psycopg2 backend. This means that for psycopg2, the SQL statements in django.db.connection.queries will now reflect the exact SQL as sent to the server, instead of a naive and misleading string-interpolated version
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6601 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-23 19:00:31 +00:00
Adrian Holovaty c2c3e93096 Removed _dict_helper() DB backend helper function, as it wasn't being used anymore
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5971 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:15:32 +00:00
Adrian Holovaty a6a5e3cf32 Removed backend.dictfetchall(), as it wasn't being used anywhere
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5970 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:14:53 +00:00
Adrian Holovaty ba49e7be08 Removed backend.dictfetchmany(), as it wasn't being used anywhere
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5969 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:14:03 +00:00
Adrian Holovaty 1b4cfd4fea Removed backend.dictfetchone(), as it wasn't being used anywhere
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5968 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-20 01:13:12 +00:00
Malcolm Tredinnick 953badbea5 Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.

Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 12:11:04 +00:00
Malcolm Tredinnick ac64e91a0c Merged boulder-oracle-sprint branch (r3965:5512) back into trunk. All
expected tests pass for all databases.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5519 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-23 14:16:00 +00:00
Malcolm Tredinnick 6fc10f50b0 Fixed #4518 -- Added handling of empty strings in typecast_decimal() for
SQLite's benefit. Thanks, Richard House.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5450 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-06-10 01:52:56 +00:00
Malcolm Tredinnick 92c35a0617 Fixed #2365, #3324 -- Renamed FloatField to DecimalField and changed the code
to return Decimal instances in Python for this field. Backwards incompatible
change.

Added a real FloatField (stores floats in the database) and support for
FloatField and DecimalField in newforms (analogous to IntegerField).

Included decimal.py module (as django.utils._decimal) from Python 2.4. This is
license compatible with Django and included for Python 2.3 compatibility only.

Large portions of this work are based on patches from Andy Durdin and Jorge
Gajon.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@5302 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-21 01:29:58 +00:00
Malcolm Tredinnick 439cb4047f Fixed #4040 -- Changed uses of has_key() to "in". Slight performance
improvement and forward-compatible with future Python releases. Patch from Gary
Wilson.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5091 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-26 13:30:48 +00:00
Jacob Kaplan-Moss 86143f7599 Fixed #2913: CursorDebugWrapper no longer double-tuple-izes parameters. Thanks, artdent@freeshell.org
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4045 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-07 05:00:19 +00:00
Malcolm Tredinnick 4f63ce5b4a Fixed #2662 -- Changed dictfetchmany and dictfetchall to return iterators,
rather than a list, in order to save memory. Patch from Simon Willison.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3783 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-22 02:36:50 +00:00
Adrian Holovaty 401b15d853 Fixed #2632 -- Made django.db.backends.util._dict_helper more efficient. Thanks for the patch, Andy Dustman
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3684 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-08-31 03:45:08 +00:00
Adrian Holovaty 2abfd5dd58 Fixed #2109 -- Convert old-style classes to new-style classes throughout Django. Thanks, Nicola Larosa
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3113 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-08 05:00:13 +00:00
Adrian Holovaty 5c5d60aa63 Fixed #411 -- CursorDebugWrapper now supports pyformat paramstyle
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3038 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-06-01 03:57:07 +00:00
Adrian Holovaty f69cf70ed8 MERGED MAGIC-REMOVAL BRANCH TO TRUNK. This change is highly backwards-incompatible. Please read http://code.djangoproject.com/wiki/RemovingTheMagic for upgrade instructions.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2809 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-05-02 01:31:56 +00:00