[Zodb-checkins] CVS: Zope3/src/zope/interface -
declarations.py:1.17 pyskel.py:1.4
Stephan Richter
srichter at cosmos.phy.tufts.edu
Fri Aug 15 21:45:21 EDT 2003
Update of /cvs-repository/Zope3/src/zope/interface
In directory cvs.zope.org:/tmp/cvs-serv20171/interface
Modified Files:
declarations.py pyskel.py
Log Message:
Merging dreamcatcher's TTW Schema branch:
1. Fixed Bug in adding that would cause infinite loops when the menu items
action was not a valif view or factory id.
2. Extended adding to support more complex views. Until now we only
supported constructions like "+/AddView=id". Now you are able to say
"+/AddView/More=id", which means that more information can be carried
in the URL. This can be used in many ways, including multi-page adding
wizards. In my case I needed it to pass in the type of the TTW Schema-
based Content Component.
3. Added Local Menus. This was a pain in the butt, but I think I got a
fairly nice model, where you can create local Menu Services, and Menus
are simply named utilities. When active they are menus in the menu
service. This is very similar to the local interface service and TTW
Schema.
4. Made some modifications to TTW Schema, cleaned up the code and moved
the browser code and interfaces to the places they belong.
5. Added a Content Component Definition utility component, which takes a
Schema and creates a content component for it, including permission
settings and a menu entry. Currently the menu entry is always made to
a local 'add_content' menu. I will change this and make it actually a
screen, where the menu and title of the menu item can be chosen by the
developer. Mmmh, should I add a factory for the definition as well, so
that the content component is also available via python?
6. Added a Content Component Instance component that represents an
instance od a Content Component Definition. You will never directly
encounter this component, since it is automatically used by the adding
code of the Content Component Definition.
7. Cleanups by both dreamcatcher and myself.
That's it. For more details see the branch checkin messages. I now consider
the dreamcatcher-ttwschema-branch closed.
=== Zope3/src/zope/interface/declarations.py 1.16 => 1.17 ===
--- Zope3/src/zope/interface/declarations.py:1.16 Mon Jun 30 12:32:46 2003
+++ Zope3/src/zope/interface/declarations.py Fri Aug 15 20:44:44 2003
@@ -96,10 +96,10 @@
>>> class C(A, B):
... pass
>>> classImplements(C, I1, I2)
- >>> [i.__name__ for i in implementedBy(C)]
+ >>> [i.getName() for i in implementedBy(C)]
['I1', 'I2', 'I3', 'I4']
>>> classImplements(C, I5)
- >>> [i.__name__ for i in implementedBy(C)]
+ >>> [i.getName() for i in implementedBy(C)]
['I1', 'I2', 'I5', 'I3', 'I4']
Instances of ``C`` provide ``I1``, ``I2``, ``I5``, and whatever interfaces
@@ -186,9 +186,9 @@
...
>>> c = C()
>>> directlyProvides(c, I4)
- >>> [i.__name__ for i in providedBy(c)]
+ >>> [i.getName() for i in providedBy(c)]
['I4', 'I31', 'I1', 'I2']
- >>> [i.__name__ for i in providedBy(c).flattened()]
+ >>> [i.getName() for i in providedBy(c).flattened()]
['I4', 'I31', 'I3', 'I1', 'I2', 'Interface']
>>> int(I1 in providedBy(c))
1
@@ -206,9 +206,9 @@
...
>>> c = D()
>>> directlyProvides(c, I4)
- >>> [i.__name__ for i in providedBy(c)]
+ >>> [i.getName() for i in providedBy(c)]
['I4', 'I5', 'I31']
- >>> [i.__name__ for i in providedBy(c).flattened()]
+ >>> [i.getName() for i in providedBy(c).flattened()]
['I4', 'I5', 'I31', 'I3', 'Interface']
>>> int(I1 in providedBy(c))
0
@@ -400,9 +400,9 @@
>>> class C:
... implements(IFoo)
... classProvides(IFooFactory)
- >>> [i.__name__ for i in C.__providedBy__]
+ >>> [i.getName() for i in C.__providedBy__]
['IFooFactory']
- >>> [i.__name__ for i in C().__providedBy__]
+ >>> [i.getName() for i in C().__providedBy__]
['IFoo']
"""
@@ -517,11 +517,11 @@
>>> spec = InterfaceSpecification(I2, I3)
>>> spec = InterfaceSpecification(I4, spec)
>>> i = iter(spec)
- >>> i.next().__name__
+ >>> i.next().getName()
'I4'
- >>> i.next().__name__
+ >>> i.next().getName()
'I2'
- >>> i.next().__name__
+ >>> i.next().getName()
'I3'
>>> list(i)
[]
@@ -546,15 +546,15 @@
>>> spec = InterfaceSpecification(I2, I3)
>>> spec = InterfaceSpecification(I4, spec)
>>> i = spec.flattened()
- >>> i.next().__name__
+ >>> i.next().getName()
'I4'
- >>> i.next().__name__
+ >>> i.next().getName()
'I2'
- >>> i.next().__name__
+ >>> i.next().getName()
'I1'
- >>> i.next().__name__
+ >>> i.next().getName()
'I3'
- >>> i.next().__name__
+ >>> i.next().getName()
'Interface'
>>> list(i)
[]
@@ -614,24 +614,24 @@
>>> class I4(I3): pass
...
>>> spec = InterfaceSpecification()
- >>> [iface.__name__ for iface in spec]
+ >>> [iface.getName() for iface in spec]
[]
- >>> [iface.__name__ for iface in spec+I1]
+ >>> [iface.getName() for iface in spec+I1]
['I1']
- >>> [iface.__name__ for iface in I1+spec]
+ >>> [iface.getName() for iface in I1+spec]
['I1']
>>> spec2 = spec
>>> spec += I1
- >>> [iface.__name__ for iface in spec]
+ >>> [iface.getName() for iface in spec]
['I1']
- >>> [iface.__name__ for iface in spec2]
+ >>> [iface.getName() for iface in spec2]
[]
>>> spec2 += InterfaceSpecification(I3, I4)
- >>> [iface.__name__ for iface in spec2]
+ >>> [iface.getName() for iface in spec2]
['I3', 'I4']
- >>> [iface.__name__ for iface in spec+spec2]
+ >>> [iface.getName() for iface in spec+spec2]
['I1', 'I3', 'I4']
- >>> [iface.__name__ for iface in spec2+spec]
+ >>> [iface.getName() for iface in spec2+spec]
['I3', 'I4', 'I1']
"""
@@ -656,22 +656,22 @@
>>> class I4(I3): pass
...
>>> spec = InterfaceSpecification()
- >>> [iface.__name__ for iface in spec]
+ >>> [iface.getName() for iface in spec]
[]
>>> spec -= I1
- >>> [iface.__name__ for iface in spec]
+ >>> [iface.getName() for iface in spec]
[]
>>> spec -= InterfaceSpecification(I1, I2)
- >>> [iface.__name__ for iface in spec]
+ >>> [iface.getName() for iface in spec]
[]
>>> spec = InterfaceSpecification(I2, I4)
- >>> [iface.__name__ for iface in spec]
+ >>> [iface.getName() for iface in spec]
['I2', 'I4']
- >>> [iface.__name__ for iface in spec - I4]
+ >>> [iface.getName() for iface in spec - I4]
['I2']
- >>> [iface.__name__ for iface in spec - I1]
+ >>> [iface.getName() for iface in spec - I1]
['I4']
- >>> [iface.__name__ for iface
+ >>> [iface.getName() for iface
... in spec - InterfaceSpecification(I3, I4)]
['I2']
@@ -776,11 +776,11 @@
...
>>> class B(A): implements(I3)
...
- >>> [i.__name__ for i in B.__implements__]
+ >>> [i.getName() for i in B.__implements__]
['I3', 'I2']
>>> b = B()
>>> directlyProvides(b, I4)
- >>> [i.__name__ for i in b.__implements__]
+ >>> [i.getName() for i in b.__implements__]
['I3', 'I2']
"""
@@ -819,7 +819,7 @@
...
>>> class C:
... classProvides(IFooFactory)
- >>> [i.__name__ for i in C.__provides__]
+ >>> [i.getName() for i in C.__provides__]
['IFooFactory']
>>> getattr(C(), '__provides__', 0)
0
@@ -866,7 +866,7 @@
>>> class C(A, B):
... pass
>>> classImplementsOnly(C, I1, I2)
- >>> [i.__name__ for i in implementedBy(C)]
+ >>> [i.getName() for i in implementedBy(C)]
['I1', 'I2']
Instances of ``C`` provide only ``I1``, ``I2``, and regardless of
@@ -988,7 +988,7 @@
... implements(I2)
>>> class C2(C1):
... implements(I3)
- >>> [i.__name__ for i in implementedBy(C2)]
+ >>> [i.getName() for i in implementedBy(C2)]
['I3', 'I2']
"""
@@ -1185,9 +1185,9 @@
>>> class C:
... implements(IFoo)
... classProvides(IFooFactory)
- >>> [i.__name__ for i in C.__providedBy__]
+ >>> [i.getName() for i in C.__providedBy__]
['IFooFactory']
- >>> [i.__name__ for i in C().__providedBy__]
+ >>> [i.getName() for i in C().__providedBy__]
['IFoo']
if equivalent to::
@@ -1200,9 +1200,9 @@
>>> class C:
... implements(IFoo)
>>> directlyProvides(C, IFooFactory)
- >>> [i.__name__ for i in C.__providedBy__]
+ >>> [i.getName() for i in C.__providedBy__]
['IFooFactory']
- >>> [i.__name__ for i in C().__providedBy__]
+ >>> [i.getName() for i in C().__providedBy__]
['IFoo']
=== Zope3/src/zope/interface/pyskel.py 1.3 => 1.4 ===
--- Zope3/src/zope/interface/pyskel.py:1.3 Thu Jun 5 17:53:28 2003
+++ Zope3/src/zope/interface/pyskel.py Fri Aug 15 20:44:44 2003
@@ -83,12 +83,12 @@
if class_name.startswith('I'):
class_name = class_name[1:]
print "from zope.interface import implements"
- print "from %s import %s" % (iface.__module__, iface.__name__)
+ print "from %s import %s" % (iface.__module__, iface.getName())
print
print "class %s:" %class_name
- print " __doc__ = %s.__doc__" % iface.__name__
+ print " __doc__ = %s.__doc__" % iface.getName()
print
- print " implements(%s)" %iface.__name__
+ print " implements(%s)" %iface.getName()
print
rskel(iface, iface, 0)
@@ -165,7 +165,7 @@
def getAttributesInOrder(interface, order):
# order is the dictionary returned from guessOrder().
# interface is a metaclass-based interface object.
- name_order = order.get(interface.__name__)
+ name_order = order.get(interface.getName())
if name_order is None:
# Something's wrong. Oh well.
More information about the Zodb-checkins
mailing list