Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
d9eb0444
Commit
d9eb0444
authored
Jun 01, 2001
by
Shane Hathaway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for ExtensionClass to the Interfaces package.
parent
0aa0a900
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
lib/python/Interface/Util.py
lib/python/Interface/Util.py
+6
-3
lib/python/Interface/iclass.py
lib/python/Interface/iclass.py
+11
-2
No files found.
lib/python/Interface/Util.py
View file @
d9eb0444
from
iclass
import
Interface
,
Class
,
ClassType
,
Base
,
assertTypeImplements
,
_typeImplements
#uuh..
from
iclass
import
Interface
,
Class
,
ClassTypes
,
Base
,
\
assertTypeImplements
,
_typeImplements
#uuh..
from
types
import
FunctionType
def
impliedInterface
(
klass
,
__name__
=
None
,
__doc__
=
None
):
"""Create an interface object from a class
...
...
@@ -26,7 +29,7 @@ def objectImplements(object, tiget=_typeImplements.get):
r
=
[]
t
=
type
(
object
)
if
t
i
s
ClassType
:
if
t
i
n
ClassTypes
:
if
hasattr
(
object
,
'__class_implements__'
):
implements
=
object
.
__class_implements__
else
:
...
...
@@ -48,7 +51,7 @@ def instancesOfObjectImplements(klass, tiget=_typeImplements.get):
"""
r
=
[]
if
type
(
klass
)
i
s
ClassType
:
if
type
(
klass
)
i
n
ClassTypes
:
if
hasattr
(
klass
,
'__implements__'
):
implements
=
klass
.
__implements__
else
:
return
r
...
...
lib/python/Interface/iclass.py
View file @
d9eb0444
...
...
@@ -15,6 +15,15 @@ from types import FunctionType, ClassType
import
Exceptions
from
InterfaceBase
import
InterfaceBase
try
:
from
ExtensionClass
import
Base
except
ImportError
:
ClassTypes
=
(
ClassType
,)
else
:
class
dummy
(
Base
):
pass
ClassTypes
=
(
type
(
dummy
),
ClassType
)
_typeImplements
=
{}
class
Interface
(
InterfaceBase
):
...
...
@@ -68,7 +77,7 @@ class Interface(InterfaceBase):
"""Does the given object implement the interface?
"""
t
=
type
(
object
)
if
t
i
s
ClassType
:
if
t
i
n
ClassTypes
:
if
hasattr
(
object
,
'__class_implements__'
):
implements
=
object
.
__class_implements__
else
:
implements
=
Class
...
...
@@ -87,7 +96,7 @@ class Interface(InterfaceBase):
tiget
=
_typeImplements
.
get
):
"""Do instances of the given class implement the interface?
"""
if
type
(
klass
)
i
s
ClassType
:
if
type
(
klass
)
i
n
ClassTypes
:
if
hasattr
(
klass
,
'__implements__'
):
implements
=
klass
.
__implements__
else
:
return
0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment