Skip to content

Commit

Permalink
remove derived predicates, again there is no point because they must …
Browse files Browse the repository at this point in the history
…take just one arg
  • Loading branch information
mmerickel committed Jan 28, 2024
1 parent 56fad7f commit 8a9d781
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/pyramid/config/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,13 @@ def register():
predlist = self.get_predlist('subscriber')
order, preds, phash = predlist.make(self, **predicates)

derived_predicates = [self._derive_predicate(p) for p in preds]
derived_subscriber = self._derive_subscriber(
subscriber, derived_predicates
)
derived_subscriber = self._derive_subscriber(subscriber, preds)

intr.update(
{
'phash': phash,
'order': order,
'predicates': preds,
'derived_predicates': derived_predicates,
'derived_subscriber': derived_subscriber,
}
)
Expand All @@ -75,12 +71,6 @@ def register():
self.action(None, register, introspectables=(intr,))
return subscriber

def _derive_predicate(self, predicate):
def derived_predicate(*arg):
return predicate(arg[0])

return derived_predicate

def _derive_subscriber(self, subscriber, predicates):
if eventonly(subscriber):

Expand Down Expand Up @@ -114,7 +104,7 @@ def subscriber_wrapper(*arg):
# with all args, the eventonly hack would not have been required.
# At this point, though, using .subscriptions and manual execution
# is not possible without badly breaking backwards compatibility.
if all(predicate(*arg) for predicate in predicates):
if all(predicate(arg[0]) for predicate in predicates):
return derived_subscriber(*arg)

if hasattr(subscriber, '__name__'):
Expand Down

0 comments on commit 8a9d781

Please sign in to comment.