示例#1
0
def radio_save():
    radios = {}
    post = dict(request.POST)
    for key in post:
        name, value = key.split('_')
        if name != "name": continue
        radio_name = post.get('name_' + value)
        radio_stream = post.get('stream_' + value)
        if radio_name == "" or radio_stream == "": continue
        radios[radio_name] = radio_stream
    storage.save_table('radio', radios)
    return radio(successfully_saved=True)
示例#2
0
文件: main.py 项目: bwilkins/fridge
def additem():
    post = request.POST
    wishlist = not is_admin() or post.get('wishlist', False)
    cost = post['cost'] if is_admin() else 0;
    item = database.Item(post['code'], post['name'], cost, post['category'], description=post['description'], wishlist=wishlist)
    session.add(item)
    session.commit()
    redirect('/item/%s' % post['code'])
示例#3
0
 def userlog(self, db, uid):
     query = "select * from transcriptions where project = ? and user = ? order by updated desc"
     rows = db.execute(query, [self.slug, uid]).fetchall()
     posts = []
     sort = {}
     for term in self.sort:
         sort[term] = []
     for row in rows:
         post = Post(dict(row))
         for term in self.sort:
             value = post.get(term)
             if value and value not in sort[term]:
                 sort[term].append(value)
         if not post.excluded():
             posts.append(post)
     for term in self.sort:
         sort[term].sort()
     return posts, sort