Пример #1
0
def rateother():
    if request.method=='GET':
        return render_template('rateother.html')
    else:
        button=request.form['button']
        ratee=request.form['ratee']
        q1=int(request.form['q1'])
        q2=int(request.form['q2'])
        q3=int(request.form['q3'])
        q4=int(request.form['q4'])
        if button == 'Save':
            group = util.getGroup(session['email'])
            if group.count(str(ratee)) == 0:
                redirect(url_for('error'))
            if q1 < 1 or q1 > 10:
                redirect(url_for('error'))
            if q2 < 1 or q2 > 10:
                redirect(url_for('error'))
            if q3 < 1 or q3 > 10:
                redirect(url_for('error'))
            if q4 < 1 or q4 > 10:
                redirect(url_for('error'))
            ratings = [q1,q2,q3,q4]
            util.setRate(session['email'], ratee, 'Project 1', ratings)
            redirect(url_for('results'))
        elif button == 'Cancel':
            redirect(url_for('results'))
import util

print "Testing Login Authorization"
print util.loginAuthorized('*****@*****.**',8680)

print util.getGroup('*****@*****.**')
print util.getInfo('*****@*****.**')

q=9
print (q > 10 or q <0)
ratings = [q, 6, 8]
print ratings


util.setRate('*****@*****.**','*****@*****.**','Project 1',ratings)

print str(util.getAllMyRatings('*****@*****.**'))

util.setRate('*****@*****.**','*****@*****.**','Project 1', [8, 5, 9])
util.setRate('*****@*****.**','*****@*****.**', 'Project 1', 5)

print str(util.getAllMyRatings('*****@*****.**'))
print str(util.getAllMyRatings('*****@*****.**'))