Commit Graph

19 Commits

Author SHA1 Message Date
Brian Jarrett cca03097f4 - apply pep8 formatting to sqlalchemy/sql, sqlalchemy/util, sqlalchemy/dialects,
sqlalchemy/orm, sqlalchemy/event, sqlalchemy/testing
2014-07-20 12:44:40 -04:00
Mike Bayer 5407ec9d38 - break up the <authors> copyright comment as part of a pass
to get all flake8 passing
2014-07-09 18:26:55 -04:00
Justin Wood (Callek) 8952724cdd once kwarg in event funcs is new in 0.9.4
event.listen and event.listen_for have a kwarg once added in 0.9.4 (not 0.9.3) CHANGELOG agrees with this as well. (as does my manual testing)
2014-06-05 10:40:34 -04:00
Matthias Urlichs f341cfbfe1 Documentation fix-up: "its" vs. "it's"
Removed ungrammatical apostrophes from documentation, replacing
"it's" with "its" where appropriate (but in a few cases with "it is"
when that read better).

While doing that, I also fixed a couple of minor typos etc.
as I noticed them.
2014-05-11 16:49:56 +02:00
Mike Bayer 009df6a3d0 - Added a new keyword argument `once=True to :func:.event.listen`
and :func:`.event.listens_for`.  This is a convenience feature which
will wrap the given listener such that it is only invoked once.
2014-03-11 12:27:10 -04:00
Mike Bayer bf89ca2e10 - get util.get_callable_argspec() to be completely bulletproof for 2.6-3.4,
methods, classes, builtins, functools.partial(), everything known so far
- use get_callable_argspec() within ColumnDefault._maybe_wrap_callable, re: #2979
2014-03-02 13:59:06 -05:00
Mike Bayer e60529da79 - Fixed bug where events set to listen at the class
level (e.g. on the :class:`.Mapper` or :class:`.ClassManager`
level, as opposed to on an individual mapped class, and also on
:class:`.Connection`) that also made use of internal argument conversion
(which is most within those categories) would fail to be removable.
fixes #2973
2014-02-25 16:55:42 -05:00
Mike Bayer 8878e23079 restore the check ahead of the lock to avoid using it after initialization
is done
2014-02-19 16:11:19 -05:00
Mike Bayer dd32540dab - Fixed a critical regression caused by 🎫2880 where the newly
concurrent ability to return connections from the pool means that the
"first_connect" event is now no longer synchronized either, thus leading
to dialect mis-configurations under even minimal concurrency situations.
2014-02-19 10:48:32 -05:00
Mike Bayer 86c3855c9b - bump up how many args for "named arg style" to four 2014-01-12 17:15:41 -05:00
Mike Bayer f89d4d216b - happy new year 2014-01-05 16:57:05 -05:00
Mike Bayer c450cd6cb6 - Fixed regression where using a `functools.partial()` with the event
system would cause a recursion overflow due to usage of inspect.getargspec()
on it in order to detect a legacy calling signature for certain events,
and apparently there's no way to do this with a partial object.  Instead
we skip the legacy check and assume the modern style; the check itself
now only occurs for the SessionEvents.after_bulk_update and
SessionEvents.after_bulk_delete events.  Those two events will require
the new signature style if assigned to a "partial" event listener.
[ticket:2905]
2014-01-04 00:35:48 -05:00
Mike Bayer 42f2a16be7 - add copyright to source files missing it 2013-10-26 16:32:58 -04:00
Mike Bayer 3d4d933329 - add support for removal of instance methods as event listeners, taking
into account the id() of the function itself and self, [ticket:2832]
2013-10-01 12:14:34 -04:00
Mike Bayer 59141d360e - apply an import refactoring to the ORM as well
- rework the event system so that event modules load after their
targets, dependencies are reversed
- create an improved strategy lookup system for the ORM
- rework the ORM to have very few import cycles
- move out "importlater" to just util.dependency
- other tricks to cross-populate modules in as clear a way as possible
2013-08-14 19:58:34 -04:00
Mike Bayer 5d4094ba73 fix missing comma 2013-07-31 19:07:13 -04:00
Mike Bayer effad0a4e3 - this collection can be None on cleanup, so check for that 2013-07-27 18:41:34 -04:00
Mike Bayer c903f071a8 - add event.contains() function to the event package, returns True
if the given target/event/fn is set up to listen.
- repair mutable package which is doing some conditional event listening
2013-07-26 19:11:33 -04:00
Mike Bayer 4505425a38 - Removal of event listeners is now implemented. The feature is
provided via the :func:`.event.remove` function.
[ticket:2268]
- reorganization of event.py module into a package; with the addition of the
docstring work as well as the new registry for removal, there's a lot more code now.
the package separates concerns and provides a top-level doc for each subsection
of functionality
- the remove feature works by providing the EventKey object which associates
the user-provided arguments to listen() with a global, weak-referencing registry.
This registry stores a collection of _ListenerCollection and _DispatchDescriptor
objects associated with each set of arguments, as well as the wrapped function
which was applied to that collection.  The EventKey can then be recreated for
a removal, all the _ListenerCollection and _DispatchDescriptor objects are located,
and the correct wrapped function is removed from each one.
2013-07-26 14:21:58 -04:00