Package couchdbkit :: Package schema :: Module base :: Class DocumentSchema
[hide private]
[frames] | no frames]

Class DocumentSchema

source code

object --+
         |
        DocumentSchema
Known Subclasses:

Nested Classes [hide private]
  __metaclass__
Instance Methods [hide private]
 
__init__(self, _d=None, **properties)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
dynamic_properties(self)
get dict of dynamic properties
source code
 
all_properties(self)
get all properties.
source code
 
to_json(self) source code
 
__setattr__(self, key, value)
override __setattr__ .
source code
 
__delattr__(self, key)
delete property
source code
 
__getattr__(self, key)
get property value
source code
 
__getitem__(self, key)
get property value
source code
 
__setitem__(self, key, value)
add a property
source code
 
__delitem__(self, key)
delete a property
source code
 
__contains__(self, key)
does object contain this propery ?
source code
 
__iter__(self)
iter document instance properties
source code
 
iteritems(self)
iter document instance properties
source code
 
items(self)
return list of items
source code
 
__len__(self)
get number of properties
source code
 
__getstate__(self)
let pickle play with us
source code
 
validate(self, required=True)
validate a document
source code
 
clone(self, **kwargs)
clone a document
source code

Inherited from object: __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
 
properties(cls)
get dict of defined properties
source code
 
wrap(cls, data)
wrap `data` dict in object properties
source code
 
from_json(cls, data)
wrap `data` dict in object properties
source code
 
build(cls, **kwargs)
build a new instance from this document object.
source code
Class Variables [hide private]
  _dynamic_properties = None
hash(x)
  _allow_dynamic_properties = True
  _doc = None
hash(x)
  _db = None
hash(x)
  _doc_type_attr = 'doc_type'
  _doc_type = 'DocumentSchema'
  _properties = {}
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, _d=None, **properties)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

all_properties(self)

source code 

get all properties. Generally we just need to use keys

__setattr__(self, key, value)

source code 

override __setattr__ . If value is in dir, we just use setattr. If value is not known (dynamic) we test if type and name of value is supported (in ALLOWED_PROPERTY_TYPES, Property instance and not start with '_') a,d add it to `_dynamic_properties` dict. If value is a list or a dict we use LazyList and LazyDict to maintain in the value.

Overrides: object.__setattr__

__delattr__(self, key)

source code 

delete property

Overrides: object.__delattr__

__contains__(self, key)
(In operator)

source code 

does object contain this propery ?

Parameters:
  • key - name of property
Returns:
True if key exist.