Beispiel #1
0
def fullList(conditions):
    torrents= db.conn.cursor()
    torrents.execute("""
            SELECT t_id, torrents.name, torrents.description, license,
                categories.name
            FROM torrents
            INNER JOIN categories USING (c_id) """ + conditions)
    rows = ''
    for torrent in torrents:
        rows += fullListRowTemplate % {
                'name_in_url': render.getUrlPrettyName(torrent[1]),
                'id': torrent[0],
                'name': torrent[1],
                'description': render.torrentDescription(torrent[2]),
                'license': torrent[3],
                'category': torrent[4]}
    return fullListBodyTemplate % rows
Beispiel #2
0
def details(t_id):
    torrent = db.conn.cursor()
    torrent.execute("""
            SELECT t_id, torrents.name, torrents.description,
                license, categories.name
            INNER JOIN categories USING (c_id)
            WHERE t_id=%s""", (t_id,))
    if torrent.rowcount == 0:
        raise exceptions.Error404()
    assert torrent.rowcount == 1
    torrent = torrent.fetchone()
    return detailsTemplate % {
            'name_in_url': render.getUrlPrettyName(torrent[1]),
            'id': torrent[0],
            'name': torrent[1],
            'description': render.torrentDescription(torrent[2]),
            'license': torrent[3],
            'category': torrent[4]}