コード例 #1
0
ファイル: formatter.py プロジェクト: fidlej/jakybyt
def formatUsedFilter():
    params = handler.getUsedFilterParams(web)
    #TODO: use ungettext for days
    #TODO: use better format for building type
    formats = {
            "maxPrice": _(u"max. %s CZK"),
            "maxUnitPrice": _(u"max. %s CZK/m²"),
            "minArea": _(u"min. %s m²"),
            "minFloor": _(u"min. %s floor"),
            "b": _(u"stavba %s"),
            "days": _(u"max. %s days old"),
        }

    parts = []
    keys = params.keys()
    if "loc" in keys:
        keys.remove("loc")

    keys.sort()
    for key in keys:
        part = formats.get(key, "%s") % params[key]
        parts.append(part)

    if "loc" in params:
        parts += handler.getFilteredLocalities(web)
    return ", ".join(parts)
コード例 #2
0
ファイル: formatter.py プロジェクト: fidlej/jakybyt
def htmlCheckedLoc(value):
    localities = handler.getFilteredLocalities(web)
    if value is None:
        if len(localities) == 0:
            return ' checked="checked"'
        else:
            return ""

    if value == -1:
        if len(localities) > 0:
            return ' checked="checked"'
        else:
            return ""

    if locality.LOCALITY_CHOICES[value] in localities:
        return ' checked="checked"'
    else:
        return ""
コード例 #3
0
ファイル: formatter.py プロジェクト: fidlej/jakybyt
def htmlFilteredLocalities():
    localities = handler.getFilteredLocalities(web)
    return ", ".join(
            web.websafe(loc).replace(" ", " ") for loc in localities)