Last change
on this file since 1552 was
513,
checked in by piv, 18 years ago
|
updated HISTORY.txt
|
File size:
929 bytes
|
Line | |
---|
1 | import Products.ZCatalog.Catalog as MC |
---|
2 | from Products.ZCatalog.CatalogBrains import AbstractCatalogBrain |
---|
3 | |
---|
4 | oldUseBrains = MC.Catalog.useBrains |
---|
5 | MC.registry_brains = [] |
---|
6 | |
---|
7 | def useBrains(self, brains): |
---|
8 | """ Sets up the Catalog to return an object (ala ZTables) that |
---|
9 | is created on the fly from the tuple stored in the self.data |
---|
10 | Btree. |
---|
11 | """ |
---|
12 | scopy = self.schema.copy() |
---|
13 | scopy['data_record_id_']=len(self.schema.keys()) |
---|
14 | scopy['data_record_score_']=len(self.schema.keys())+1 |
---|
15 | scopy['data_record_normalized_score_']=len(self.schema.keys())+2 |
---|
16 | |
---|
17 | br = [b for b in MC.registry_brains if b[0] is brains] |
---|
18 | if br: |
---|
19 | mybrains = br[0][1] |
---|
20 | else: |
---|
21 | class mybrains(AbstractCatalogBrain, brains): |
---|
22 | pass |
---|
23 | MC.registry_brains.append((brains, mybrains)) |
---|
24 | |
---|
25 | mybrains.__record_schema__ = scopy |
---|
26 | self._v_brains = brains |
---|
27 | self._v_result_class = mybrains |
---|
28 | |
---|
29 | MC.Catalog.useBrains = useBrains |
---|
Note: See
TracBrowser
for help on using the repository browser.