Patch: getRequiredAdapters() refactoring
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zope 3 |
Won't Fix
|
Undecided
|
Unassigned | ||
zope.app.apidoc |
Fix Committed
|
Low
|
Christian Theune |
Bug Description
Here's a little patch that eliminates some duplication in getRequiredAdap
--- src/zope/
+++ src/zope/
@@ -45,22 +45,18 @@
def getRequiredAdap
"""Get adapter registrations where the specified interface is required."""
gsm = getGlobalSiteMa
- for meth in ('registeredAda
- 'registeredSubs
- 'registeredHand
+ for reg in _adapterishRegi
+ # Ignore adapters that have no required interfaces
+ if len(reg.required) == 0:
+ continue
+ # Ignore views
+ if not withViews and reg.required[
+ continue
+ # Only get the adapters for which this interface is required
+ for required_iface in reg.required:
+ if iface.isOrExten
+ yield reg
- for reg in getattr(gsm, meth)():
- # Ignore adapters that have no required interfaces
- if len(reg.required) == 0:
- continue
- # Ignore views
- if not withViews and reg.required[
- continue
- # Only get the adapters for which this interface is required
- for required_iface in reg.required:
- if iface.isOrExten
- yield reg
-
Cheers,
Erik Rose
WebLion Core Developer
Pennsylvania State University
Changed in zope3: | |
status: | New → Won't Fix |
Changed in zope.app.apidoc: | |
status: | New → In Progress |
importance: | Undecided → Low |
assignee: | nobody → Christian Theune (ct-gocept) |
(In case whitespace is as trashed as it looks)