Web · Wiki · Activities · Blog · Lists · Chat · Meeting · Bugs · Git · Translate · Archive · People · Donate

Commit d75f3eb3fbbacded016912b6f0bea8b2ca71d984

fix launch, favorites and queries (by alsroot)
app/app.py
(5 / 6)
  
6868
6969@app.route('/launch/<context_guid>')
7070def launch(context_guid):
71 c=client.Context.find(guid=context_guid)
72 client.launch(c[0]['guid'])
71 client.launch(context_guid)
7372 return redirect(url_for('context_grid'))
7473
7574@app.route('/favorites')
111111 vote = request.args.get('vote', None)
112112 if context and vote:
113113 context = context[5:] #remove "stars-" from id
114 c=client.Context.find(guid=context)
115 c[0]['vote'] = vote
116 c[0].post()
114 c = client.Context(context)
115 c['vote'] = vote == 'true'
116 c.post()
117117 return jsonify(vote=vote)
118118
119119@app.route('/resource/search/')
164164 page = int(request.args.get('page', 1))
165165 offset = _PAGE_SIZE * (page - 1)
166166
167 result = client.Context.find(full_query)
167 result = client.Context.find(full_query, reply=['guid', 'title', 'vote'])
168168 for i in range(offset, offset + _PAGE_SIZE):
169169 try:
170170 r.append(result[i])