Package zope :: Package i18n :: Package locales :: Module inheritance :: Class AttributeInheritance
[show private | hide private]
[frames | no frames]

Type AttributeInheritance

 object --+    
          |    
Inheritance --+
              |
             AttributeInheritance

Known Subclasses:
Locale, LocaleCalendar, LocaleDates, LocaleDisplayNames, LocaleFormatLength, LocaleInheritanceStub, LocaleNumbers, LocaleOrientation

Implementation of locale inheritance for attributes.

Example:
 >>> from zope.i18n.locales.tests.test_docstrings import \
 ...     LocaleInheritanceStub

 >>> root = LocaleInheritanceStub()
 >>> root.data = 'value'
 >>> root.attr = 'bar value'
 >>> root.data2 = AttributeInheritance()
 >>> root.data2.attr = 'value2' 

 >>> locale = LocaleInheritanceStub(root)
 >>> locale.attr = 'foo value'
 >>> locale.data2 = AttributeInheritance()

 Here is an attribute lookup directly from the locale ...

 >>> locale.data
 'value'
 >>> locale.attr
 'foo value'

 ... however, we can also have any amount of nesting.

 >>> locale.data2.attr
 'value2'

 Once we have looked up a particular attribute, it should be cached,
 i.e. exist in the dictionary of this inheritance object.

 >>> 'attr' in locale.data2.__dict__
 True
 >>> locale.data2.__dict__['attr']
 'value2'

 Make sure that None can be assigned as value as well.

 >>> locale.data2.attr = None
 >>> locale.data2.attr is None
 True

Method Summary
  __getattr__(self, name)
See zope.i18n.interfaces.locales.ILocaleInheritance
  __setattr__(self, name, value)
See zope.i18n.interfaces.locales.ILocaleInheritance
    Inherited from Inheritance
  getInheritedSelf(self)
See zope.i18n.interfaces.locales.ILocaleInheritance
    Inherited from object
  __init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __str__(x)
x.__str__() <==> str(x)

Class Variable Summary
Implements __implemented__ = <implementedBy zope.i18n.locales.inher...
ClassProvides __provides__ = <zope.interface.declarations.ClassProvide...
    Inherited from Inheritance
str __name__ = 'Inheritance'
NoneType __parent__ = None                                                                  
ClassProvides __providedBy__ = <zope.interface.declarations.ClassProvi...

Method Details

__getattr__(self, name)
(Qualification operator)

See zope.i18n.interfaces.locales.ILocaleInheritance

__setattr__(self, name, value)

See zope.i18n.interfaces.locales.ILocaleInheritance
Overrides:
__builtin__.object.__setattr__

Class Variable Details

__implemented__

Type:
Implements
Value:
<implementedBy zope.i18n.locales.inheritance.AttributeInheritance>     

__provides__

Type:
ClassProvides
Value:
<zope.interface.declarations.ClassProvides object at 0xb5ecdb8c>       

Generated by Epydoc 2.1 on Fri Jun 24 12:01:22 2005 http://epydoc.sf.net