当前位置: 首页>>代码示例>>Python>>正文


Python User.all方法代码示例

本文整理汇总了Python中model.User.User.all方法的典型用法代码示例。如果您正苦于以下问题:Python User.all方法的具体用法?Python User.all怎么用?Python User.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model.User.User的用法示例。


在下文中一共展示了User.all方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: post

# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import all [as 别名]
 def post(self):
     loggedIn= False
     username=self.request.get('username')
     password=self.request.get('password')
     use = User.all().filter('username',username)
     if use.count() == 1:
         #user found
         user = use.get()
         if(user.password == password):
             i = uuid.uuid1()
             sess = Session(user=user.username,sessId=str(i))
             sess.put()
             self.session['sessId']=str(i)
             loggedIn = True
             template_params={'loggedIn':loggedIn,
                             'user': user.username}
             render_template(self,'login.html',template_params)
         else:
             #no user found/something went wrong
             loginError = True
             template_params={
                 'loggedIn': loggedIn,
                 'loginError': loginError,
             }
             render_template(self,'login.html',template_params)
     else:
         #no user found/something went wrong
         loginError = True
         template_params={
             'loggedIn': loggedIn,
             'loginError': loginError,
         }
         render_template(self,'login.html',template_params)
开发者ID:aquafemi,项目名称:Jirga,代码行数:35,代码来源:jirgaSettings.py

示例2: post

# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import all [as 别名]
 def post(self):
     loggedIn= False
     username=self.request.headers.get('Username')
     password=self.request.headers.get('Password')
     print("username="+username)
     print("password="+password)
     use = User.all().filter('username',username)
     if use.count() == 1:
         #user found
         user = use.get()
         if(user.password == password):
             print("match")
             i = uuid.uuid1()
             sess = Session(user=user.username,sessId=str(i))
             sess.put()
             self.response.headers['Content-Type'] = 'application/json'
             obj = {
                 'sessKey':str(i)
             }
             self.response.out.write(json.dumps(obj))
         else:
             #no user found/something went wrong
             print("badpass")
     else:
         print("badname")
开发者ID:aquafemi,项目名称:Jirga,代码行数:27,代码来源:jsonLogin.py

示例3: post

# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import all [as 别名]
 def post(self):
     loggedIn= True
     username=self.request.get('username')
     password=self.request.get('password')
     android=self.request.get('android')
     use = User.all().filter('username',username)
     self.session.delete(username)
开发者ID:aquafemi,项目名称:Jirga,代码行数:9,代码来源:logout.py

示例4: getuser

# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import all [as 别名]
 def getuser(self):
     if self.session.get('sessId'):
         i = str(self.session.get('sessId'))
         sess = Session.all().filter('sessId',i).get()
         user = User.all().filter('username',sess.user).get()
         return user
     else:
         return None
开发者ID:aquafemi,项目名称:Jirga,代码行数:10,代码来源:sessions_module.py

示例5: post

# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import all [as 别名]
    def post(self):
        loggedIn= False
        username=self.request.get('username')
        password=self.request.get('password')
        android=self.request.get('android')
        use = User.all().filter('username',username)
        if use.count() == 1:
            #user found
            user = use.get()
            if(user.password == password):
                i = uuid.uuid1()
                sess = Session(user=user.username,sessId=str(i))
                sess.put()
                self.session['sessId']=str(i)
                badPass = False
                loggedIn = True
                template_params={'loggedIn':loggedIn,
                                'user': user.username}
                render_template(self,'login.html',template_params)
            else:
                #no user found/something went wrong
                loginError = True
                template_params={
                    'loggedIn': loggedIn,
                    'loginError': loginError,
                }
                render_template(self,'login.html',template_params)

            if android is not None and (android)==1:
                if(badPass):
                    self.response.write("FAIL-BADPASS")
                if(loginError):
                    self.response.write("FAIL-LOGINERROR")
                else:
                    self.response.write("OK")
            else:
                self.redirect("/")

        else:
            if android is not None and (android)==1:
                self.response.write("FAIL-BADNAME")
            else:
                #no user found/something went wrong
                loginError = True
                template_params={
                    'loggedIn': loggedIn,
                    'loginError': loginError,
                }
                render_template(self,'login.html',template_params)
开发者ID:aquafemi,项目名称:Jirga,代码行数:51,代码来源:login.py

示例6: get

# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import all [as 别名]
 def get(self,sessId):
     sess = Session.all().filter('sessId',sessId).get()
     if sess is not None:
         user = User.all().filter('username',sess.user).get()
         print("user" + user.username)
         if(user is not None):
             jirgas = Jirga.get(user.jirgas)
             result = []
             self.response.headers['Content-Type'] = 'application/json'
             for jirga in jirgas:
                 obj2 = {
                     'name': jirga.title,
                     'key': jirga.jirgaId,
                 }
                 result.append(obj2)
                 print(jirga.title)
             self.response.out.write(json.dumps(result))
         else:
             self.response.write("FAIL - not logged in")
开发者ID:aquafemi,项目名称:Jirga,代码行数:21,代码来源:getMyJirgas.py

示例7: post

# 需要导入模块: from model.User import User [as 别名]
# 或者: from model.User.User import all [as 别名]
 def post(self):
     success = False
     template_params={}
     username=self.request.get('username')
     password=self.request.get('password')
     android=self.request.get('android')
     use = User.all().filter('username',username)
     if use.count() == 0:
         #no collisions
         nameTaken = False
         if (password is not None) and (password != ""):
             #valid password
             badPass = False
             #create user account
             usernew = User(username=username,password=password)
             usernew.put()
             success=True
             template_params={'success':success}
         else:
             #invalid password
             badPass = True
             template_params={'success':success,'badPass':badPass}
         if android is not None and (android)==1:
             if(badPass):
                 self.response.write("FAIL-BADPASS")
             else:
                 self.response.write("OK")
         else:
             render_template(self,'createUser.html',template_params)
     else:
         if android is not None and (android)==1:
             self.response.write("FAIL-BADNAME")
         else:
             #username taken
             nameTaken = True
             template_params={'success':success,'nameTaken':nameTaken}
             render_template(self,'createUser.html',template_params)
开发者ID:aquafemi,项目名称:Jirga,代码行数:39,代码来源:signup.py


注:本文中的model.User.User.all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。