Warning:
Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.
| File simulate_offset.diff,
935 bytes
(added by joelpearson, 4 years ago) |
|
Workaround is off by default, must be enabled in config file
|
-
|
|
|
|
| 200 | 200 | # we replace the var with the sliced one |
| 201 | 201 | endpoint = offset + limit_ |
| 202 | 202 | log.debug("slicing data between %d and %d", offset, endpoint) |
| 203 | | output[var_name] = var_data[offset:endpoint] |
| | 203 | if turbogears.config.get('paginate.simulate_offset', False): |
| | 204 | var_data_iter = iter(var_data[:endpoint]) |
| | 205 | # skip over the number of records specified by offset |
| | 206 | for i in range(offset): |
| | 207 | var_data_iter.next() |
| | 208 | # return the records that remain |
| | 209 | output[var_name] = list(var_data_iter) |
| | 210 | else: |
| | 211 | output[var_name] = var_data[offset:endpoint] |
| 204 | 212 | |
| 205 | 213 | return output |
| 206 | 214 | return decorated |
Download in other formats: