summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-12-01unused importChris McDonough
2012-12-01Merge branch 'master' of github.com:Pylons/pyramidChris McDonough
2012-11-29Merge pull request #734 from slinkp/masterChris McDonough
Fix broken link to contributor docs on front page
2012-11-29Fix broken link to contributor docsPaul Winkler
2012-11-27Merge pull request #716 from ericrasmussen/scaffolds.requiresfixChris McDonough
add transaction dependency to zodb scaffold
2012-11-27Merge pull request #732 from ppaez/transaction-dependencyChris McDonough
Transaction dependency in ZODB tutorial
2012-11-22typosChris McDonough
2012-11-22Sync the tutorial docs for the transaction dependencyPatricio Paez
2012-11-22more appeasementChris McDonough
2012-11-22appeasementChris McDonough
2012-11-21prep for 1.4b1Chris McDonough
2012-11-21prep for releaseChris McDonough
2012-11-21document new introspectable attrsChris McDonough
2012-11-21missed adding this fileChris McDonough
2012-11-21Merge branch 'feature.eventonly'Chris McDonough
2012-11-21fix for py3Chris McDonough
2012-11-21add an integration test for the eventonly behaviorChris McDonough
2012-11-21gardenChris McDonough
2012-11-21gardenChris McDonough
2012-11-21- In order to normalize the relationship between event subscribers andChris McDonough
subscriber predicates, we now allow both subscribers and subscriber predicates to accept only a single ``event`` argument even if they've been subscribed for notifications that involve multiple interfaces. Subscribers and subscriber predicates that accept only one argument will receive the first object passed to ``notify``; this is typically (but not always) the event object. The other objects involved in the subscription lookup will be discarded. For instance, if an event is sent by code like this:: registry.notify(event, context) In the past, in order to catch such an event, you were obligated to write and register an event subscriber that mentioned both the event and the context in its argument list:: @subscriber([SomeEvent, SomeContextType]) def subscriber(event, context): pass With the event-only feature you can now write an event subscriber that accepts only ``event`` even if it subscribes to multiple interfaces:: @subscriber([SomeEvent, SomeContextType]) def subscriber(event): # this will work! Note, however, that if the event object is not the first object in the call to ``notify``, you'll run into trouble. For example, if notify is called with the context argument first:: registry.notify(context, event) You won't be able to take advantage of the feature. It will "work", but the object received by your event handler won't be the event object, it will be the context object, which won't be very useful:: @subscriber([SomeContextType, SomeEvent]) def subscriber(event): # bzzt! you'll be getting the context here as ``event``, and it'll # be useless Existing multiple-argument subscribers continue to work without issue, so you should continue use those if your system notifies using multiple interfaces and the first interface is not the event interface. For example:: @subscriber([SomeContextType, SomeEvent]) def subscriber(context, event): # this will still work! The event-only feature makes it possible to use a subscriber predicate that accepts only a request argument within both multiple-interface subscriber registrations and single-interface subscriber registrations. In the past, if you had a subscriber predicate like this:: class RequestPathStartsWith(object): def __init__(self, val, config): self.val = val def text(self): return 'path_startswith = %s' % (self.val,) phash = text def __call__(self, event): return event.request.path.startswith(self.val) If you attempted to use the above predicate to condition a subscription that involved multiple interfaces, it would not work. You had to change it to accept the same arguments as the subscription itself. For example, you might have had to change its ``__call__`` method like so, adding a ``context`` argument:: def __call__(self, event, context): return event.request.path.startswith(self.val) With the event-only feature, you needn't make the change. Instead, you can write all predicates so they only accept ``event`` in their ``__call__`` and they'll be useful across all registrations for subscriptions that use an event as their first argument, even ones which accept more than just ``event``. However, the same caveat applies to predicates as to subscriptions: if you're subscribing to a multi-interface event, and the first interface is not the event interface, the predicate won't work properly. In such a case, you'll need to match the predicate ``__call__`` argument ordering and composition to the ordering of the interfaces. For example:: def __call__(self, context, event): return event.request.path.startswith(self.val) tl;dr: 1) Always use the event as the first argument to a multi-interface subscription and 2) Use only ``event`` in your subscriber and subscriber predicate parameter lists, no matter how many interfaces the subscriber is notified with, as long as the event object is the first argument passed to ``registry.notify``. This will result in the maximum amount of reusability of subscriber predicates.
2012-11-20adding transaction module requirement to zodb wiki docsericrasmussen
2012-11-20add transaction dependency to zodb scaffoldericrasmussen
2012-11-20gardenChris McDonough
2012-11-20Merge branch 'sontek-fix_commands'Chris McDonough
2012-11-20gardenChris McDonough
2012-11-20gardenChris McDonough
2012-11-20Merge branch 'master' into sontek-fix_commandsChris McDonough
2012-11-20coverageChris McDonough
2012-11-20Merge branch 'fix_commands' of git://github.com/sontek/pyramid into ↵Chris McDonough
sontek-fix_commands
2012-11-20gardenChris McDonough
2012-11-20Merge branch 'master' of github.com:Pylons/pyramidChris McDonough
2012-11-20Merge pull request #730 from ppaez/update-tutorial-filesChris McDonough
Update tutorial source files
2012-11-20Sync views.py on SQL wiki tutorial with the scaffoldPatricio Paez
- Explain the added lines in the Basic Layout chapter. - The user is told to remove the added lines in the Defining Views chapter, there was no need to fix any emphasized lines. - Sync the file in the other sections even if it is not shown, for consistency.
2012-11-20More sync on ZODB wiki tutorialPatricio Paez
- literalinclude should refer to the file in the corresponding section - Remove extra lines
2012-11-20Merge branch 'feature.response-gardenpath'Chris McDonough
2012-11-20- Small microspeed enhancement which anticipates that aChris McDonough
``pyramid.response.Response`` object is likely to be returned from a view. Some code is shortcut if the class of the object returned by a view is this class. A similar microoptimization was done to ``pyramid.request.Request.is_response``.
2012-11-19Sync some ZODB wiki tutorial files with the scaffoldPatricio Paez
- Files that are not referred to in a literalinclude in the tutorial docs - setup.py and development.ini appear in a literalinclude but no lines are emphasized and there is no impact.
2012-11-19Sync some SQL wiki tutorial files with the scaffoldPatricio Paez
- Files that are not referred to in a literalinclude in the tutorial docs - setup.py appears in literalinclude, but no lines are added or removed so no impact. Fixed docutils order in the requires list.
2012-11-18Merge branch 'sontek-add_contributors'Chris McDonough
2012-11-18fix merge conflictChris McDonough
2012-11-18- A failure when trying to locate the attribute ``__text__`` on route and viewChris McDonough
predicates existed when the ``debug_routematch`` setting was true or when the ``pviews`` command was used. See https://github.com/Pylons/pyramid/pull/727 Closes #727.
2012-11-14Added myself to contributorsJohn Anderson
2012-11-14Don't use a global mutable and updated the doc string to include optionsJohn Anderson
2012-11-14Merge branch '1.4-branch'Chris McDonough
2012-11-14prep for releaseChris McDonough
2012-11-14update for releaseChris McDonough
2012-11-14rearrange deck chairsChris McDonough
2012-11-14make an assertion in this testChris McDonough
2012-11-14Merge branch 'fix_commands' of git://github.com/sontek/pyramid into ↵Chris McDonough
sontek-fix_commands
2012-11-14remove duplicate whatsnew entry (forward port from 1.3 branchChris McDonough