Module database :: Class basedataobject
[hide private]
[frames] | no frames]

Class basedataobject

source code

object --+    
         |    
      dict --+
             |
            basedataobject
Known Subclasses:

A base object derived from dict that is used for various records. Existing code can just continue to treat it as a dict. New code can treat it as dict, as well as access via attribute names (ie object["foo"] or object.foo). attribute name access will always give a result includes None if the name is not in the dict.

As a bonus this class includes checking of attribute names and types in non-production runs. That will help catch typos etc. For production runs we may be receiving data that was written out by a newer version of BitPim so we don't check or error.

Instance Methods [hide private]
 
_check_property(self, name, value=None) source code
 
_check_property_dictvalue(self, name, value) source code
None
update(self, items)
Update D from E and F: for k in E: D[k] = E[k] (if E has keys else: for (k, v) in E: D[k] = v) then: for k in F: D[k] = F[k]
source code
 
__getitem__(self, name)
x[y]
source code
 
__setitem__(self, name, value)
x[i]=y
source code
 
__setattr__(self, name, value)
x.__setattr__('name', value) <==> x.name = value
source code
 
__getattr__(self, name) source code
 
__delattr__(self, name)
x.__delattr__('name') <==> del x.name
source code
 
GetBitPimSerial(self)
Returns the BitPim serial for this item
source code
 
_getnextrandomid(self, item)
Returns random ids used to give unique serial numbers to items
source code
 
EnsureBitPimSerial(self)
Ensures this entry has a serial
source code

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __gt__, __hash__, __init__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __repr__, clear, copy, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, values

Inherited from object: __reduce__, __reduce_ex__, __str__

Class Variables [hide private]
  _knownproperties = []
  _knownlistproperties = {'serials': ['sourcetype', '*']}
  _knowndictproperties = {}
  _persistrandom = random.Random()
  _shathingy = None
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

update(self, items)

source code 

Update D from E and F: for k in E: D[k] = E[k] (if E has keys else: for (k, v) in E: D[k] = v) then: for k in F: D[k] = F[k]

Returns: None
Overrides: dict.update
(inherited documentation)

__getitem__(self, name)
(Indexing operator)

source code 

x[y]

Overrides: dict.__getitem__
(inherited documentation)

__setitem__(self, name, value)
(Index assignment operator)

source code 

x[i]=y

Overrides: dict.__setitem__
(inherited documentation)

__setattr__(self, name, value)

source code 

x.__setattr__('name', value) <==> x.name = value

Overrides: object.__setattr__
(inherited documentation)

__delattr__(self, name)

source code 

x.__delattr__('name') <==> del x.name

Overrides: object.__delattr__
(inherited documentation)

_getnextrandomid(self, item)

source code 

Returns random ids used to give unique serial numbers to items

Parameters:
  • item - any object - its memory location is used to help randomness
Returns:
a 20 character hexdigit string