twisted.enterprise.reflector.Reflector

Package twisted :: Package enterprise :: Module reflector :: Class Reflector |
[frames | no frames]

## Class Reflector

Known Subclasses:
  `SQLReflector`, `XMLReflector`

Base class for enterprise reflectors. This implements row caching.

Method Summary
| ``__init__`(self, rowClasses)` Initialize me against a database.
| `__getstate__(self)`
| `__setstate__(self, state)`
| ``_populate`(self)` Implement me to populate schema information for the reflector.
| ``addToCache`(self, rowObject)` NOTE: Should this be recursive?! requires better container knowledge...
| ``addToParent`(self, parentRow, rows, tableName)` util method used by reflectors.
| ``buildWhereClause`(self, relationship, row)` util method used by reflectors.
| ``deleteRow`(self, rowObject)` delete the row for this object from the database.
| `findInCache(self, rowClass, kw)`
| ``getTableInfo`(self, rowObject)` Get a TableInfo record about a particular instance.
| ``insertRow`(self, rowObject)` insert a new row for this object instance.
| ``loadObjectsFrom`(self, tableName, parent, data, whereClause, loadChildren)` Implement me to load objects from the database.
| ``populateSchemaFor`(self, tableInfo)` This is called once for each registered rowClass to add it and its foreign key relationships for that rowClass to the schema.
| ``removeFromCache`(self, rowObject)` NOTE: should this be recursive!??
| ``updateRow`(self, rowObject)` update this rowObject to the database.

Class Variable Summary
`int` | `populated` = 0

Method Details

### __init__(self, rowClasses) (Constructor) Initialize me against a database. Parameters: `rowClasses` - a list of row class objects that describe the database schema.

### _populate(self) Implement me to populate schema information for the reflector.

### addToCache(self, rowObject) NOTE: Should this be recursive?! requires better container knowledge...

### addToParent(self, parentRow, rows, tableName) util method used by reflectors. adds these rows to the parent row object. If a rowClass does not have a containerMethod, then a list attribute "childRows" will be used.

### buildWhereClause(self, relationship, row) util method used by reflectors. builds a where clause to link a row to another table.

### deleteRow(self, rowObject) delete the row for this object from the database.

### getTableInfo(self, rowObject) Get a TableInfo record about a particular instance. This record contains various information about the instance's class as registered with this reflector. Parameters: `rowObject` - a `RowObject` instance of a class previously registered with me. Raises: `twisted.enterprise.row.DBError` - raised if this class was not previously registered.

### insertRow(self, rowObject) insert a new row for this object instance.

    ### loadObjectsFrom(self, tableName, parent=None, data=None, whereClause=[], loadChildren=1) Implement me to load objects from the database. Parameters: `whereClause` - a list of tuples of (columnName, conditional, value) so it can be parsed by all types of reflectors. eg.:
         whereClause = [("name", EQUALS, "fred"), ("age", GREATERTHAN, 18)]

### populateSchemaFor(self, tableInfo) This is called once for each registered rowClass to add it and its foreign key relationships for that rowClass to the schema.

### removeFromCache(self, rowObject) NOTE: should this be recursive!??

### updateRow(self, rowObject) update this rowObject to the database.

Class Variable Details

    ### populated Type: `int` Value:
        0

Generated by Epydoc 2.0 on Sat May 15 20:08:31 2004 | http://epydoc.sf.net