def addTrack(): l = Location.from_id(request.form["location_id"]) uid = User.current_id() if User.is_admin() and request.form["special"] == "true": special = 1 uid = 29 #MAGIC NUMBER!!! This is the ID of the MSS user on the server else: special = 0 ret = l.add_track(request.form["provider_id"], uid, special) return ret
def vote(self, pli_id, direc): if not "voted_arr" in session: session["voted_arr"] = [] voted = session["voted_arr"] if User.is_admin() or not pli_id in voted: v = Vote(playlist_item_id=pli_id, user_id=User.current_id(), direction=direc) v.save() voted.append(pli_id) session["voted_arr"] = voted self.update_subscribers() return common.buildDialogResponse("Thanks for the input!", 200) else: return common.buildDialogResponse("Nice try sucka! You already voted", 409)
def decorated_function(*args, **kwargs): if User.current_id() is None: return common.buildDialogResponse("Please log in.", 401) return f(*args, **kwargs)