diff options
| author | Christian Theune <ct@gocept.com> | 2007-05-03 21:59:32 +0000 |
|---|---|---|
| committer | Christian Theune <ct@gocept.com> | 2007-05-03 21:59:32 +0000 |
| commit | a025dca5f2dc2e74575ebd43ea616d6f67e6026e (patch) | |
| tree | 811d75a6d333355932ea0bfe63e2765bc795aaca /src/zope/interface/_flatten.py | |
| parent | 6e287d3cffe6087dad31fc2310b3de45d324d396 (diff) | |
| download | zope-interface-a025dca5f2dc2e74575ebd43ea616d6f67e6026e.tar.gz | |
Moving code to satellite.
Diffstat (limited to 'src/zope/interface/_flatten.py')
| -rw-r--r-- | src/zope/interface/_flatten.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/zope/interface/_flatten.py b/src/zope/interface/_flatten.py new file mode 100644 index 0000000..7645abb --- /dev/null +++ b/src/zope/interface/_flatten.py @@ -0,0 +1,37 @@ +############################################################################## +# +# Copyright (c) 2002 Zope Corporation and Contributors. +# 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. +# +############################################################################## +"""Adapter-style interface registry + +See Adapter class. + +$Id$ +""" +from zope.interface import Declaration + +def _flatten(implements, include_None=0): + + try: + r = implements.flattened() + except AttributeError: + if implements is None: + r=() + else: + r = Declaration(implements).flattened() + + if not include_None: + return r + + r = list(r) + r.append(None) + return r |
