summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/mutable.py
Commit message (Collapse)AuthorAgeFilesLines
* Implement in-place mutation operators for MutableSet, MutableListMike Bayer2017-06-051-0/+20
| | | | | | | | | | | Implemented in-place mutation operators ``__ior__``, ``__iand__``, ``__ixor__`` and ``__isub__`` for :class:`.mutable.MutableSet` and ``__iadd__`` for :class:`.mutable.MutableList` so that change events are fired off when these mutator methods are used to alter the collection. Change-Id: Ib357a96d3b06c5deb6b53eb304a8b9f1dc9e9ede Fixes: #3853
* Add AttributeEvents.modifiedMike Bayer2017-05-231-0/+22
| | | | | | | | | | Added new event handler :meth:`.AttributeEvents.modified` which is triggered when the func:`.attributes.flag_modified` function is invoked, which is common when using the :mod:`sqlalchemy.ext.mutable` extension module. Change-Id: Ic152f1d5c53087d780b24ed7f1f1571527b9e8fc Fixes: #3303
* Ensure we check that SQL expression has an .info attributeMike Bayer2017-04-041-1/+2
| | | | | | | | | | Fixed regression released in 1.1.8 due to :ticket:`3950` where the deeper search for information about column types in the case of a "schema type" or a :class:`.TypeDecorator` would produce an attribute error if the mapping also contained a :obj:`.column_property`. Change-Id: I38254834d3d79c9b339289a8163eb4789ec4c931 Fixes: #3956
* Track SchemaEventTarget types in as_mutable()Mike Bayer2017-03-301-1/+19
| | | | | | | | | | | | | | Fixed bug in :mod:`sqlalchemy.ext.mutable` where the :meth:`.Mutable.as_mutable` method would not track a type that had been copied using :meth:`.TypeEngine.copy`. This became more of a regression in 1.1 compared to 1.0 because the :class:`.TypeDecorator` class is now a subclass of :class:`.SchemaEventTarget`, which among other things indicates to the parent :class:`.Column` that the type should be copied when the :class:`.Column` is. These copies are common when using declarative with mixins or abstract classes. Change-Id: Ib04df862c58263185dbae686c548fea3e12c46f1 Fixes: #3950
* New features from python 2.7Катаев Денис2017-03-171-2/+2
| | | | | | | After bump minimum supported version to 2.7 (1da9d3752160430c91534a8868ceb8c5ad1451d4), we can use new syntax. Change-Id: Ib064c75a00562e641d132f9c57e5e69744200e05 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/347
* Support python3.6Mike Bayer2017-01-131-3/+3
| | | | | | | | | | | Corrects some warnings and adds tox config. Adds DeprecationWarning to the error category. Large sweep for string literals w/ backslashes as this is common in docstrings Co-authored-by: Andrii Soldatenko Fixes: #3886 Change-Id: Ia7c838dfbbe70b262622ed0803d581edc736e085 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/337
* update for 2017 copyrightMike Bayer2017-01-041-1/+1
| | | | Change-Id: I4e8c2aa8fe817bb2af8707410fa0201f938781de
* Spelling fixes: "the a"Ville Skyttä2016-05-051-1/+1
|
* - add changelog, migration, version flags and some extra notesMike Bayer2016-02-161-1/+41
| | | | to the new MutableList and MutableSet classes, fixes #3297
* Add `sqlalchemy.ext.mutable.MutableSet`pr/236Jeong YunWon2016-02-131-0/+65
| | | | from https://bitbucket.org/zzzeek/sqlalchemy/issues/3297
* Add `sqlalchemy.ext.mutable.MutableList`Jeong YunWon2016-02-131-0/+79
|
* - add more documentation to MutableDict explainingMike Bayer2016-02-101-0/+12
| | | | | | that this structure is only intended to track additions and removals from the dictionary, not recursive tracking of embedded changes. fixes #3646.
* - happy new yearMike Bayer2016-01-291-1/+1
|
* - just use *arg straight without "key" for popMike Bayer2015-12-171-2/+2
|
* - Further fixes to :ticket:`3605`, pop method on :class:`.MutableDict`,Mike Bayer2015-12-171-2/+2
| | | | | where the "default" argument was not included. fixes #3605
* - Added support for the ``dict.pop()`` and ``dict.popitem()`` methodsMike Bayer2015-12-111-0/+10
| | | | | to the :class:`.mutable.MutableDict` class. fixes #3605
* - Fixed regression in the :mod:`sqlalchemy.ext.mutable` extensionMike Bayer2015-05-211-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | as a result of the bugfix for :ticket:`3167`, where attribute and validation events are no longer called within the flush process. The mutable extension was relying upon this behavior in the case where a column level Python-side default were responsible for generating the new value on INSERT or UPDATE, or when a value were fetched from the RETURNING clause for "eager defaults" mode. The new value would not be subject to any event when populated and the mutable extension could not establish proper coercion or history listening. A new event :meth:`.InstanceEvents.refresh_flush` is added which the mutable extension now makes use of for this use case. fixes #3427 - Added new event :meth:`.InstanceEvents.refresh_flush`, invoked when an INSERT or UPDATE level default value fetched via RETURNING or Python-side default is invoked within the flush process. This is to provide a hook that is no longer present as a result of :ticket:`3167`, where attribute and validation events are no longer called within the flush process. - Added a new semi-public method to :class:`.MutableBase` :meth:`.MutableBase._get_listen_keys`. Overriding this method is needed in the case where a :class:`.MutableBase` subclass needs events to propagate for attribute keys other than the key to which the mutable type is associated with, when intercepting the :meth:`.InstanceEvents.refresh` or :meth:`.InstanceEvents.refresh_flush` events. The current example of this is composites using :class:`.MutableComposite`.
* - copyright 2015Mike Bayer2015-03-101-1/+1
|
* Merge branch 'mutable-dict-update' of ↵Mike Bayer2014-08-251-0/+4
|\ | | | | | | https://bitbucket.org/goodscloud/sqlalchemy into pr27
| * add update() support to MutableDictMatt Chisholm2014-08-091-0/+4
| |
* | fix MutableDict.coerceMatt Chisholm2014-08-091-3/+3
|/ | | | If a class inherited from MutableDict (say, for instance, to add an update() method), coerce() would give back an instance of MutableDict instead of an instance of the derived class.
* PEP8 style fixesBrian Jarrett2014-07-131-11/+10
|
* - break up the <authors> copyright comment as part of a passMike Bayer2014-07-091-1/+2
| | | | to get all flake8 passing
* Return the assigned value in MultableDict.setdefaultThomas Herve2014-06-241-1/+2
|
* - Fixed bug in mutable extension where :class:`.MutableDict` did notMike Bayer2014-05-141-0/+5
| | | | | report change events for the ``setdefault()`` dictionary operation. fixes #3051
* - Fixed bug in mutable extension as well asMike Bayer2014-03-191-0/+3
| | | | | | :func:`.attributes.flag_modified` where the change event would not be propagated if the attribute had been reassigned to itself. fixes #2997
* Remove uneeded import from code examplepr/60Wichert Akkerman2014-01-201-1/+0
| | | | | This had me reread the code twice to see if I missed why the import was present.
* - happy new yearMike Bayer2014-01-051-1/+1
|
* - reduce verbiage in mutation.py regarding legacy style, place under ↵Mike Bayer2013-11-291-7/+3
| | | | versionadded
* Fix cross referencesVraj Mohan2013-11-171-4/+4
|
* Remove reference to defunct classVraj Mohan2013-11-171-1/+1
| | | | | | We should probably reword this entirely as, IMHO, this should be in the changelog and not in the doc proper (which should only describe the current state of affairs).
* - add event.contains() function to the event package, returns TrueMike Bayer2013-07-261-1/+1
| | | | | if the given target/event/fn is set up to listen. - repair mutable package which is doing some conditional event listening
* - add a test for pullreq 8Mike Bayer2013-06-231-3/+3
| | | | - simplify
* make tests passpr/8Devi2013-06-201-1/+1
|
* check if compostite_class is of class typeDevi2013-06-191-1/+2
| | | | before checking if it is a subclass of `MutableComposite`
* Fixed bug where :class:`.MutableDict` didn't report a change eventMike Bayer2013-06-031-0/+4
| | | | | when ``clear()`` was called. [ticket:2730]
* MutableDict.__delitem__ should require only 'key' argumentAudrius Kažukauskas2013-01-171-2/+2
|
* happy new year (see #2645)Diana Clarke2013-01-011-1/+1
|
* The :class:`.MutableComposite` type did not allow for theMike Bayer2012-12-031-35/+56
| | | | | | | | | | | :meth:`.MutableBase.coerce` method to be used, even though the code seemed to indicate this intent, so this now works and a brief example is added. As a side-effect, the mechanics of this event handler have been changed so that new :class:`.MutableComposite` types no longer add per-type global event handlers. Also in 0.7.10 [ticket:2624]
* just a pep8 pass of lib/sqlalchemy/extDiana Clarke2012-11-191-43/+58
|
* iterate through column_attrs hereMike Bayer2012-11-181-8/+6
|
* - add HSTOREMike Bayer2012-11-171-3/+0
| | | | - this was a mistake in mutable
* - hstore adjustmentsMike Bayer2012-11-171-20/+58
|
* - move ext to relative importsMike Bayer2012-07-171-37/+37
|
* Add some `Sphinx` paragraph level versions informations markups,Mike Bayer2012-06-081-6/+7
| | | | such as ``.. versionadded::``, ``.. versionchanged::`` and ``.. deprecated::``.
* typos in lib/sqlalchemy/extDiana Clarke2012-03-171-1/+1
|
* happy new yearMike Bayer2012-01-041-1/+1
|
* fix a whole bunch of note:: / warning:: that were inline,Mike Bayer2011-12-251-3/+9
| | | | no longer compatible with docutils 0.8
* - Fixed bug in the mutable extension wherebyMike Bayer2011-07-011-10/+10
| | | | | | | if None or a non-corresponding type were set, an error would be raised. None is now accepted which assigns None to all attributes, illegal values raise ValueError.
* - Fixed bug in the mutable extension wherebyMike Bayer2011-06-301-2/+0
| | | | | | if the same type were used twice in one mapping, the attributes beyond the first would not get instrumented.