Changeset 9766


Ignore:
Timestamp:
5 Dec 2012, 06:01:47 (12 years ago)
Author:
uli
Message:

Define interfaces for more general object queries and fix typo.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py

    r9764 r9766  
    303303        """
    304304
    305     def export_all(site, filapath=None):
     305    def export_all(site, filepath=None):
    306306        """Export all items in `site` as CSV file.
    307307
     
    12241224        """Return the currently used global or site-wide IExportContainer.
    12251225        """
     1226
     1227class IFilteredQuery(IKofaObject):
     1228    """A query for objects.
     1229    """
     1230
     1231    defaults = schema.Dict(
     1232        title = u'Default Parameters',
     1233        required = True,
     1234        )
     1235
     1236    def __init__(**parameters):
     1237        """Instantiate a filtered query by passing in parameters.
     1238        """
     1239
     1240    def query():
     1241        """Get an iterable of objects denoted by the set parameters.
     1242
     1243        The search should be applied to objects inside current
     1244        site. It's the caller's duty to set the correct site before.
     1245
     1246        Result can be any iterable like a catalog result set, a list,
     1247        or similar.
     1248        """
     1249
     1250class IFilteredCatalogQuery(IFilteredQuery):
     1251    """A catalog-based query for objects.
     1252    """
     1253
     1254    cat_name = schema.TextLine(
     1255        title = u'Registered name of the catalog to search.',
     1256        required = True,
     1257        )
     1258
     1259    def query_catalog(catalog):
     1260        """Query catalog with the parameters passed to constructor.
     1261        """
Note: See TracChangeset for help on using the changeset viewer.