コード例 #1
0
ファイル: bdz.py プロジェクト: nb/iphone-versions
def cyr_to_lat_station(lat):
    """Returns the cyrllic name of the station, if such a station exists. Otherwise you get the original name."""
    if lat == 'missing': return ''
    cyrs = utils.cyr_from_lat_all(lat)    
    intersect = utils.intersection_by_key(set(cyrs), set(all_stations), normalize_station_name)
    if intersect: return list(intersect)[0].title()
    if cyrs: return list(cyrs)[0].title()
    return None
コード例 #2
0
ファイル: bdz.py プロジェクト: nb/iphone-versions
def add_to_user_stations(*stations):
    """Adds these stations to the user-defined stations list in a cookie. Doesn't add stations, which are in the short lists."""
    global forced_user_stations
    known_stations = utils.intersection_by_key(set(stations), set(main_stations + other_stations), normalize_station_name)
    unknown_stations = set(stations) - known_stations
    if not unknown_stations: return
    new_user_stations = list(set(user_stations() + list(unknown_stations)))
    forced_user_stations = new_user_stations
    new_user_stations_cookie = u'|'.join(new_user_stations).encode('utf-8')
    web.setcookie('user_stations', quote(new_user_stations_cookie), 365 * 24 * 60 * 60)