# HG changeset patch # User Thierry Florac # Date 1386067574 -3600 # Node ID 96765451d8d7153db844f8c83684bddf217d4ca4 # Parent 26773e68d3d3e8ab073e76024f36031b6523caef Added new "component" registry utility module diff -r 26773e68d3d3 -r 96765451d8d7 src/ztfy/utils/component.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ztfy/utils/component.py Tue Dec 03 11:46:14 2013 +0100 @@ -0,0 +1,31 @@ +### -*- coding: utf-8 -*- #################################################### +############################################################################## +# +# Copyright (c) 2012 Thierry Florac +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## + + +# import standard packages + +# import Zope3 interfaces + +# import local interfaces + +# import Zope3 packages +from zope.component import getUtilitiesFor + +# import local packages + + +def getRegistryNames(component, interface): + """Get registration names of given component for given interface""" + return [name for (name, utility) in getUtilitiesFor(interface) if component is utility]