Matching/Filtering Utilities - durian.match

durian.match.mtuplelist_to_matchdict(mtuplelist)

Converts a list of (name, kind, what) tuples to a match dict. Where name is the field to match, kind is a matchable number mapping to CONST_TO_MATCHABLE.

Possible types are: CONDITION_EXACT, CONDITION_STARTSWITH,
CONDITION_ENDSWITH, ``CONDITION_CONTAINS.

Probably best explained by an example:

>>> mtuplelist = [("name", CONDITION_ENDSWITH, "Constanza"),
...               ("zipcode", CONDITION_STARTSWITH, "70")]
>>> mtuplelist_to_matchdict(mtuplelist)
{"name": Endswith("Constanza"), "zipcode": Startswith("70")}

Previous topic

Django Models - durian.models

Next topic

Matching Conditions - durian.match.able

This Page