コード例 #1
0
def clean(pr):
    '''PlayRecord --> PlayRecord

    Clean up a record so it can be stored.
    Raise ValueError on incomplete data.

    '''
    # decompose
    title, artist, played = pr
    # construct
    pr = clean_string(title), clean_string(artist), int(played)
    # validate
    if all(pr):
        return pr
    else:
        raise ValueError('invalid PlayRecord {}'.format(pr))
コード例 #2
0
ファイル: wsgi.py プロジェクト: plredmond-archive/radiosite
 def song(render=json.dumps):
     song, artist = db.get_randsong()
     return render(dict(
         song=clean_string(song),
         artist=clean_string(artist),
     ))