##############################################################################
#
# Copyright (c) 1996-2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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
#
##############################################################################
from ExtensionClass import Base
import Acquisition
class B(Base):
color='red'
class A(Acquisition.Explicit):
def hi(self):
print self.__class__.__name__, self.acquire('color')
b=B()
b.a=A()
b.a.hi()
b.a.color='green'
b.a.hi()
try:
A().hi()
raise 'Program error', 'spam'
except AttributeError: pass
|