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


Python User.gql方法代码示例

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


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

示例1: post

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import gql [as 别名]
	def post(self):
		email = self.session.get(EMAIL_KEY)
		users = User.gql('WHERE email = :1', email)
		template_params={
		}
		if (users.count(1) == 1):
			word = ''
			random = Random()
			for i in range(1,8):
				word += random.choice('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789')
			user = users.get()
			user.password = word
			m = hashlib.md5()
			encodedString = word.encode('ascii', errors='replace')
			m.update(encodedString)
			user.passwordHash = str(m.hexdigest()) 
			user.put()
			template_values = {
				"password":word
			}
			messageTemplate = jinja_environment.get_template('templates/userForms/changePassMail.html')
			message = mail.EmailMessage(sender="Diet Futar <[email protected]>")
			message.subject="Diet-futar, uj jelszo"
			message.to = email
			message.html = messageTemplate.render(template_values)
			message.send()
			template_params[EMAIL_KEY] = email
		template = jinja_environment.get_template('templates/userForms/changePassSuccess.html')
		self.printPage("Uj jelszo", template.render(template_params), True, True)
开发者ID:lajthabalazs,项目名称:diet-futar,代码行数:31,代码来源:user_forms.py

示例2: test_remove

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import gql [as 别名]
 def test_remove(self, cubmail):
     print "removing "+cubmail
     users = User.gql("WHERE cubmail = :1", cubmail)
     myclass = users.get()
     try:
         db.delete(myclass)
     except (Exception):
         print "can't find "+cubmail+"\n"
开发者ID:akivab,项目名称:WeSoSmart,代码行数:10,代码来源:user_test.py

示例3: _delete_all

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import gql [as 别名]
 def _delete_all(self):
     for base in (Competition, UserComp, Scores, Comment):
         for item in base.query():
             item.key.delete()
     for photo in Photo.query():
         delete_blob(photo.blob)
         photo.key.delete()
     for user in User.gql('WHERE username != :1', 'test'):
         user.key.delete()
开发者ID:PreludeAndFugue,项目名称:prelude-hmpc,代码行数:11,代码来源:test.py

示例4: get

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import gql [as 别名]
	def get(self):
		email = self.session.get(EMAIL_KEY)
		users = User.gql('WHERE email = :1', email)
		template_params={
		}
		if (users.count(1) == 1):
			template_params[EMAIL_KEY] = email
		template = jinja_environment.get_template('templates/userForms/changePass.html')
		self.printPage("Uj jelszo", template.render(template_params), True, True)
开发者ID:lajthabalazs,项目名称:diet-futar,代码行数:11,代码来源:user_forms.py

示例5: IsUsernameAvailable

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import gql [as 别名]
 def IsUsernameAvailable(self,request):
     username = request.get("username")
     userid = request.get("userid")
     user = User.gql('WHERE username = :1',username).get()
     if user:
         if str(user.key()) == userid:
           return "True"
         else:
           return "Invalid"
     else:
         return "True"
开发者ID:Git-Host,项目名称:cpedialog,代码行数:13,代码来源:rpc.py

示例6: IsEmailAvailable

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import gql [as 别名]
 def IsEmailAvailable(self,request):
     email = request.get("email")
     userid = request.get("userid")
     user = User.gql('WHERE email = :1',email).get()
     if user:
         if str(user.key()) == userid:
           return "True"
         else:
           return "Invalid"
     else:
         return "True"
开发者ID:Git-Host,项目名称:cpedialog,代码行数:13,代码来源:rpc.py

示例7: getSalt

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import gql [as 别名]
def getSalt(email):
    print 'Content-Type: text/plain;charset=UTF-8'
    print ''
    logging.debug('email: ' + email)
    user = User.gql('WHERE email = :1', email).get()
    if user is not None:
        salt = user.password_salt
    else:
        #send back a dummy salt
        salt = User.generate_salt()
        
    print salt
开发者ID:bgourlie,项目名称:barterhub,代码行数:14,代码来源:async_server.py

示例8: doLogin

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import gql [as 别名]
def doLogin(args):
    user = None
    login_info = args.split(',',2)
    try:
        email_address = login_info[0]
        password_hash = login_info[1]
        user = User.gql('WHERE email_address = :1 AND password_hash = :2', email_address, password_hash).get()
    except IndexError:
        pass
    
    print 'Content-Type: text/plain;charset=UTF-8'
    print ''
    if user is None:
        print '0'
    else:
        Session().set_user(user)
        print '1'
开发者ID:bgourlie,项目名称:barterhub,代码行数:19,代码来源:async_server.py

示例9: test_get_key

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import gql [as 别名]
 def test_get_key(self, cubmail):
     result = User.gql("WHERE cubmail = :1", cubmail).get()
     return result.key()
开发者ID:akivab,项目名称:WeSoSmart,代码行数:5,代码来源:user_test.py

示例10: test_exists

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import gql [as 别名]
 def test_exists(self,cubmail):
     return User.gql("WHERE cubmail = :1", cubmail).get()        
开发者ID:akivab,项目名称:WeSoSmart,代码行数:4,代码来源:user_test.py


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