Changes between Version 3 and Version 4 of BluePrintLazyRepresentation
- Timestamp:
- 12/18/12 20:33:00 (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
BluePrintLazyRepresentation
v3 v4 93 93 == Implementation == 94 94 95 === S3Represent Base Class === 96 95 97 Having to define an individual bulk representation class for each and every Field seems though a little too much effort, so this calls for a base-class that already covers the standard case: 96 98 … … 104 106 105 107 S3Represent is defined in s3fields.py, and is therefore available in every model (controllers need to use s3base.S3Represent). 108 109 === Usage === 106 110 107 111 The base class takes the following configuration parameters: … … 119 123 ||none||current.messages.NONE||the default for None-values (or empty lists for list: types|||| 120 124 121 S3Represent can be subclassed to meet specific requirements. Usually, the subclass would overwrite some of these methods: 125 === Subclassing S3Represent === 126 127 S3Represent can be subclassed to meet specific requirements. 128 129 Usually, the subclass would overwrite some of these methods: 130 131 ==== lookup_rows() ==== 122 132 123 133 {{{ … … 136 146 - ''For testing/benchmarking, lookup_rows() should increment self.queries for each query performed.'' 137 147 148 ==== represent_row() ==== 149 138 150 {{{ 139 151 def represent_row(self, row): … … 146 158 147 159 This function receives each row retrieved by lookup_rows() and should return the string representation. It should '''not''' perform any additional DB lookups. It should return a lazyT if self.translate is True. 160 161 ==== link() ==== 148 162 149 163 {{{