| Total Complexity | 6 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | # -*- coding: utf-8 -*- |
||
| 2 | |||
| 3 | from plone.indexer.interfaces import IIndexableObject |
||
| 4 | from Products.ZCatalog.ZCatalog import ZCatalog |
||
| 5 | from zope.component import queryMultiAdapter |
||
| 6 | |||
| 7 | |||
| 8 | def catalog_object(self, object, uid=None, idxs=None, |
||
| 9 | update_metadata=1, pghandler=None): |
||
| 10 | |||
| 11 | try: |
||
| 12 | # Never catalog temporary objects |
||
| 13 | temporary = object.isTemporary() |
||
| 14 | if temporary is True: |
||
| 15 | return |
||
| 16 | except AttributeError: |
||
| 17 | pass |
||
| 18 | |||
| 19 | if idxs is None: |
||
| 20 | idxs = [] |
||
| 21 | self._increment_counter() |
||
| 22 | |||
| 23 | w = object |
||
| 24 | if not IIndexableObject.providedBy(object): |
||
| 25 | # This is the CMF 2.2 compatible approach, which should be used |
||
| 26 | # going forward |
||
| 27 | wrapper = queryMultiAdapter((object, self), IIndexableObject) |
||
| 28 | if wrapper is not None: |
||
| 29 | w = wrapper |
||
| 30 | |||
| 31 | ZCatalog.catalog_object(self, w, uid, idxs, |
||
| 32 | update_metadata, pghandler=pghandler) |
||
| 33 |