Changeset 9801


Ignore:
Timestamp:
14 Dec 2012, 14:07:55 (12 years ago)
Author:
uli
Message:

get_filtered() now accepts any keyword parameters and can handle catalog queries more properly.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
2 edited

Legend:

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

    r9797 r9801  
    9898        return get_students(x)
    9999
    100     def get_filtered(self, site, current_session=None,
    101                      current_level=None, faccode=None, depcode=None, ):
    102         query = StudentsQuery(
    103             current_session=current_session,
    104             current_level=current_level,
    105             faccode=faccode, depcode=depcode)
     100    def get_filtered(self, site, **kw):
     101        """Get students filtered by keywords.
     102
     103        The keys must be valid students catalog index names. Returns a
     104        simple empty list or a catalog result set with `Student`
     105        objects.
     106
     107        .. seealso:: `waeup.kofa.students.catalog.StudentsCatalog`
     108
     109        """
     110        # Pass only given keywords to StudentsQuery. This way we avoid
     111        # trouble with `None` value ambivalences and queries are also
     112        # faster (normally less indexes to ask). Drawback is, that
     113        # developers must look into catalog to see what keywords are
     114        # valid.
     115        query = StudentsQuery(**kw)
    106116        return query.query()
    107117
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r9797 r9801  
    748748      data from a given student object.
    749749    """
    750     def get_filtered(site, current_session=None, current_level=None,
    751                      faculty_code=None, department_code=None):
     750    def get_filtered(site, **kw):
    752751        """Get a filtered set of students.
    753752        """
Note: See TracChangeset for help on using the changeset viewer.