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


Python User.isRegistered方法代码示例

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


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

示例1: testChangeUpdateTs

# 需要导入模块: from dao.user import User [as 别名]
# 或者: from dao.user.User import isRegistered [as 别名]
  def testChangeUpdateTs(self):
    from datetime import datetime, timedelta

    user = User.register('[email protected]')
    self.assertTrue(User.isRegistered('[email protected]'))
    user.changeUpdateTs(timedelta(days = -20))
    self.assertEqual((datetime.now() - user.getUpdateTS()).days, 20)
开发者ID:,项目名称:,代码行数:9,代码来源:

示例2: testSetClientSpecificFields

# 需要导入模块: from dao.user import User [as 别名]
# 或者: from dao.user.User import isRegistered [as 别名]
  def testSetClientSpecificFields(self):
    user = User.register('[email protected]')
    self.assertTrue(User.isRegistered('[email protected]'))

    # Check that the field doesn't exist initially    
    self.assertTrue(user.getProfile().get('test_field', 'blank'), 'blank')

    # Check that a simple value update works
    user.setClientSpecificProfileFields({'test_field': 'something beautiful'})
    self.assertTrue(user.getProfile().get('test_field', 'blank'), 'something beautiful')

    # Check that a data structure update works
    user.setClientSpecificProfileFields({'test_field': {'something': 'beautiful'}})
    self.assertTrue(user.getProfile().get('test_field', 'blank'), {'something': 'beautiful'})
开发者ID:,项目名称:,代码行数:16,代码来源:

示例3: testGetFirstStudy

# 需要导入模块: from dao.user import User [as 别名]
# 或者: from dao.user.User import isRegistered [as 别名]
  def testGetFirstStudy(self):
    user = User.register('[email protected]')
    self.assertTrue(User.isRegistered('[email protected]'))

    client = Client("testclient")
    client.update(createKey = False)
    common.makeValid(client)

    (resultPre, resultReg) = client.preRegister("this_is_the_super_secret_id", "[email protected]")
    self.assertEqual(resultPre, 0)
    self.assertEqual(resultReg, 1)

    user = User.fromEmail('[email protected]')
    self.assertEqual(user.getFirstStudy(), 'testclient')
开发者ID:,项目名称:,代码行数:16,代码来源:

示例4: __preRegister

# 需要导入模块: from dao.user import User [as 别名]
# 或者: from dao.user.User import isRegistered [as 别名]
  def __preRegister(self, userEmail):
    from dao.user import User
    from main import userclient

    if User.isRegistered(userEmail):
      User.fromEmail(userEmail).setStudy(self.clientName)
    else:
      pendingDoc = {
        'user_email': userEmail,
        'study': self.clientName,
        'last_update': datetime.now()}
      # Should I do insert or upsert here? If a user has pre-registered for one
      # study and then pre-registers for another study before registering, do we
      # want to throw an error or just update silently?
      # Update silently for now
      writeResult = get_pending_signup_db().update({'user_email': userEmail}, pendingDoc, upsert=True)
      print 'in __preRegister, writeResult = %s' % writeResult
      if 'err' in writeResult and writeResult['err'] is not None:
        e = Exception()
        e.code = writeResult['err'][0]["code"]
        e.msg = writeResult['err'][0]["errmsg"]
        raise e
    return (get_pending_signup_db().find({'study': self.clientName}).count(),
            userclient.countForStudy(self.clientName))
开发者ID:sfwatergit,项目名称:e-mission-server,代码行数:26,代码来源:client.py

示例5: testIsRegistered

# 需要导入模块: from dao.user import User [as 别名]
# 或者: from dao.user.User import isRegistered [as 别名]
 def testIsRegistered(self):
   user = User.register('[email protected]')
   self.assertTrue(User.isRegistered('[email protected]'))
开发者ID:,项目名称:,代码行数:5,代码来源:

示例6: testIsNotRegistered

# 需要导入模块: from dao.user import User [as 别名]
# 或者: from dao.user.User import isRegistered [as 别名]
 def testIsNotRegistered(self):
   self.assertFalse(User.isRegistered('[email protected]'))
开发者ID:,项目名称:,代码行数:4,代码来源:

示例7: testUnregister

# 需要导入模块: from dao.user import User [as 别名]
# 或者: from dao.user.User import isRegistered [as 别名]
 def testUnregister(self):
   user = User.register('[email protected]')
   self.assertTrue(User.isRegistered('[email protected]'))
   User.unregister('[email protected]')
   self.assertFalse(User.isRegistered('[email protected]'))
开发者ID:,项目名称:,代码行数:7,代码来源:


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