예제 #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
파일: dugnad.py 프로젝트: ireneteix/dugnad
 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