Small documentation improvements

This commit is contained in:
Christophe de Vienne 2013-04-09 13:10:57 +02:00
parent 6b0441d154
commit a8d0e8e79e
2 changed files with 9 additions and 4 deletions

View File

@ -11,8 +11,9 @@ Public API
.. autoclass:: signature([return_type, [arg0_type, [arg1_type, ... ] ] ], body=None, status=None) .. autoclass:: signature([return_type, [arg0_type, [arg1_type, ... ] ] ], body=None, status=None)
.. autoclass:: wsproperty .. autoclass:: wsme.types.Base
.. autoclass:: wsattr .. autoclass:: wsattr
.. autoclass:: wsproperty
.. data:: Unset .. data:: Unset

View File

@ -178,6 +178,9 @@ class UnsetType(object):
def __bool__(self): def __bool__(self):
return False return False
def __repr__(self):
return 'Unset'
Unset = UnsetType() Unset = UnsetType()
#: A special type that corresponds to the host framework request object. #: A special type that corresponds to the host framework request object.
@ -259,7 +262,7 @@ class wsproperty(property):
A specialised :class:`property` to define typed-property on complex types. A specialised :class:`property` to define typed-property on complex types.
Example:: Example::
class MyComplexType(object): class MyComplexType(wsme.types.Base):
def get_aint(self): def get_aint(self):
return self._aint return self._aint
@ -289,7 +292,7 @@ class wsattr(object):
Example:: Example::
class MyComplexType(object): class MyComplexType(wsme.types.Base):
optionalvalue = int optionalvalue = int
mandatoryvalue = wsattr(int, mandatory=True) mandatoryvalue = wsattr(int, mandatory=True)
named_value = wsattr(int, name='named.value') named_value = wsattr(int, name='named.value')
@ -297,7 +300,7 @@ class wsattr(object):
After inspection, the non-wsattr attributes will be replace, and After inspection, the non-wsattr attributes will be replace, and
the above class will be equivalent to:: the above class will be equivalent to::
class MyComplexType(object): class MyComplexType(wsme.types.Base):
optionalvalue = wsattr(int) optionalvalue = wsattr(int)
mandatoryvalue = wsattr(int, mandatory=True) mandatoryvalue = wsattr(int, mandatory=True)
@ -551,6 +554,7 @@ class BaseMeta(type):
class Base(six.with_metaclass(BaseMeta)): class Base(six.with_metaclass(BaseMeta)):
"""Base type for complex types"""
def __init__(self, **kw): def __init__(self, **kw):
for key, value in kw.items(): for key, value in kw.items():
if hasattr(self, key): if hasattr(self, key):