Package bazaar :: Module core :: Class Broker
[show private | hide private]
[frames | no frames]

Type Broker

object --+
         |
        Broker


Application class broker.

Application class broker is responsible for taking decision on getting objects from database or cache, loading application objects from database with convertor and manipulating application objects with cache.

See Also: bazaar.motor.Motor bazaar.motor.Convertor bazaar.cache

Method Summary
  __init__(self, cls, mtr, seqpattern)
Create application class broker.
  add(self, obj)
Add object into database.
  delete(self, obj)
Delete object from database.
  find(self, query, param, field)
Find objects in database.
  get(self, key)
Get application object.
  getObjects(self)
Get list of application objects.
  loadObjects(self)
Load application objects from database and put them into cache.
  reloadObjects(self, now)
Request reloading objects from database.
  update(self, obj)
Update object in database.
    Inherited from object
  __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)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Instance Variable Summary
  cache: Cache of application objects.
  cls: Application class.
  convertor: Relational and object data convertor.
  reload: If true, then application object's reload has been requested.

Method Details

__init__(self, cls, mtr, seqpattern=None)
(Constructor)

Create application class broker.

Method initializes object cache and database data convertor. Database objects loading is requested.
Parameters:
cls - Application class.
mtr - Database access object.
Overrides:
__builtin__.object.__init__

add(self, obj)

Add object into database.
Parameters:
obj - Object to add.

delete(self, obj)

Delete object from database.

Object's primary key value is set to None.
Parameters:
obj - Object to delete.

find(self, query, param=None, field=0)

Find objects in database.
Parameters:
query - SQL query or dictionary.
param - SQL query parameters.
field - SQL column number which describes found objects' primary key values.

See Also: bazaar.core.Bazaar.find

get(self, key)

Get application object.

Object is returned from cache.
Parameters:
key - Object's primary key value.
Returns:
Object with primary key value equal to key.

See Also: bazaar.cache

getObjects(self)

Get list of application objects.

If objects reload has been requested, then objects would be loaded from database before returning objects from the cache.

See Also: bazaar.core.Broker.loadObjects bazaar.core.Broker.reloadObjects

loadObjects(self)

Load application objects from database and put them into cache.

See Also: bazaar.core.Broker.getObjects bazaar.core.Broker.reloadObjects

reloadObjects(self, now=False)

Request reloading objects from database.

All objects are removed from cache. If now is set to true, then objects are loaded from database immediately.

If objects immediate reload is requested, then method returns iterator of objects being loaded from database.
Parameters:
now - Reload objects immediately.

See Also: bazaar.core.Broker.loadObjects bazaar.core.Broker.getObjects

update(self, obj)

Update object in database.
Parameters:
obj - Object to update.

Instance Variable Details

cache

Cache of application objects.

cls

Application class.

convertor

Relational and object data convertor.

reload

If true, then application object's reload has been requested.

Generated by Epydoc 2.1 on Tue May 10 18:27:29 2005 http://epydoc.sf.net