Marshaller Content. @ivar tag: The content tag. @type tag: str @ivar value: The content's value. @type value: I{any}
| 23 | |
| 24 | |
| 25 | class Content(Object): |
| 26 | """ |
| 27 | Marshaller Content. |
| 28 | @ivar tag: The content tag. |
| 29 | @type tag: str |
| 30 | @ivar value: The content's value. |
| 31 | @type value: I{any} |
| 32 | """ |
| 33 | |
| 34 | extensions = [] |
| 35 | |
| 36 | def __init__(self, tag=None, value=None, **kwargs): |
| 37 | """ |
| 38 | @param tag: The content tag. |
| 39 | @type tag: str |
| 40 | @param value: The content's value. |
| 41 | @type value: I{any} |
| 42 | """ |
| 43 | Object.__init__(self) |
| 44 | self.tag = tag |
| 45 | self.value = value |
| 46 | for k, v in kwargs.items(): |
| 47 | setattr(self, k, v) |
| 48 | |
| 49 | def __getattr__(self, name): |
| 50 | if name not in self.__dict__: |
| 51 | if name in self.extensions: |
| 52 | v = None |
| 53 | setattr(self, name, v) |
| 54 | else: |
| 55 | raise AttributeError('Content has no attribute %s' % name) |
| 56 | else: |
| 57 | v = self.__dict__[name] |
| 58 | return v |