Web应用程序共享相同的内存存储

时间:2014-01-06 17:01:20

标签: project-management

我在一个用于计算用户详细信息的应用程序中工作。但不知何故,用户的价值改变了另一个用户的价值。下面是代码片段

def Compute_UserScore(self, details, ques_no):
    try:
        if(HomePage.answer_.strip() == ""):
            self.response.write("""<script type = "text/javascript">
            alert("Dear User, You can not answer same answer twice.. Take test Again !");
            </script>""")
            self.redirect('/otherPages/subjectSelect.html')
        else:
            count = 0
            HomePage.ans_no = 0
            HomePage.unans_no = 0
            HomePage.correct_no = 0
            HomePage.wrong_no = 0
            HomePage.failed_ques = list()
            HomePage.answer_ = HomePage.answer_.strip()
            question_1 = HomePage.question_.split(" gcdc_split_format ")
            while (count != (ques_no)):
                user_answer = str(details[count]).strip().capitalize()
                real_answer = str(HomePage.answer_[count]).strip().capitalize()
                if (len(str(user_answer).strip()) == 1):
                    HomePage.ans_no = HomePage.ans_no + 1
                    if(user_answer.strip() == real_answer.strip()):
                        HomePage.correct_no = HomePage.correct_no + 1
                    else:
                        HomePage.wrong_no = HomePage.wrong_no + 1
                        HomePage.failed_ques.append(str("No. " + str(int((count + 1))) + "  " + str(question_1[count])))
                else:
                    HomePage.unans_no = HomePage.unans_no + 1
                count = count + 1
            HomePage.answer_ = ""
    except:
        self.redirect('/')
    return " "

这就是我的主页的样子

class HomePage(webapp2.RequestHandler):
    percentage = None
    subject_answered = None
    username_ = None
    email_ = None
    super_date = None
    answer_ = " "
    question_ = " "
    failed_ques = list()
    wrong_no = 0
    correct_no = 0
    ans_no = 0
    unans_no = 0

问题是,当用户A进行测试时,他会看到另一个用户B的结果。阅读使用实例变量,但仍然没有计算如何使其工作

0 个答案:

没有答案