Pastebin

Paste #2880: No description

< previous paste - next paste>

Pasted by Anonymous Coward

Download View as text

    offsets = {
            "mm_foot_length"        : (8,10),
            "mm_forefoot_width"     : (3,5),
            "mm_forefoot_height"    : (2,3),
            "mm_instep_height"      : (2,3),
            "mm_heel_width"         : (2,3)
            }

    and_=sqlalchemy.sql.expression.and_

    query = sesseion.query(Footwear).filter(
            and_(
                *list(
                    and_(
                        getattr(Footwear,k) >= v + offsets[k][0],
                        getattr(Footwear,k) <= v + offsets[k][1]
                        )
                    ) for k, v in criteria.values()
                )
            )
    print query

New Paste


Do not write anything in this field if you're a human.

Go to most recent paste.