Ignore:
Timestamp:
17 Jan 2010, 14:08:43 (15 years ago)
Author:
uli
Message:

Modify certcourse source to reduce catalog lookups.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-importers/src/waeup/interfaces.py

    r4831 r4833  
    2727    """
    2828    catalog = None
     29    _cached_values = None
    2930    def getValues(self):
    30         if self.catalog is None:
    31             self.catalog = getUtility(ICatalog, name='courses_catalog')
    32         return list(self.catalog.searchResults(code=('', 'z*')))
     31        if self._cached_values is not None:
     32            return self._cached_values
     33        self.catalog = getUtility(ICatalog, name='courses_catalog')
     34        self._cached_values = list(
     35            self.catalog.searchResults(code=('', 'z*')))
     36        return self._cached_values
     37
     38    def getToken(self, value):
     39        return value.code
    3340       
    3441    def getTitle(self, value):
Note: See TracChangeset for help on using the changeset viewer.