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


Python User.signup方法代码示例

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


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

示例1: ipn

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import signup [as 别名]
def ipn():
  request.parameter_storage_class = ImmutableOrderedMultiDict

  # Store any/all ipn requests for future
  db.rpush('ipn', json.dumps(request.form))
  log_event('ipn', request.form)

  # Fetch details from request
  username = str(request.form['item_number'])

  # Double check all the details are correct
  if request.form['receiver_email'] != config.paypal_email:
    return 'Payment was not sent to correct email address'
  elif request.form['payment_status'] != 'Completed':
    return 'Payment status was not completed'
  elif request.form['mc_currency'] != 'USD':
    return 'Payment was not in USD'
  elif request.form['mc_gross'] != ('%.2f' % config.price):
    return 'Payment was not for the correct amount'


  # Validate that the actual request is correct
  validate_url = config.paypal_url + '?cmd=_notify-validate'

  values = request.form
  for x, y in values.iteritems():
    validate_url += "&{x}={y}".format(x=x,y=y)

  print 'Validating IPN using {url}'.format(url=validate_url)

  result = requests.get(validate_url)

  if result.text == 'VERIFIED':
    print "PayPal transaction was verified successfully."

    # Everything okay, actually perform the signup
    log_event('signup-complete', {"username": username})
    User.signup(db, username)
  else:
    print 'Paypal IPN string did not validate'

  return result.text
开发者ID:passwordly,项目名称:password.ly,代码行数:44,代码来源:public.py

示例2: setUp

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import signup [as 别名]
    def setUp(self):
        self.username = TestUser.USERNAME
        self.password = TestUser.PASSWORD

        self.master_user = User()
        self.master_user.set_master(True)

        try:
            self.user = User.login(self.username, self.password)
        except ResourceRequestNotFound:
            # if the user doesn't exist, that's fine
            self.user = User.signup(self.username, self.password)
        existing = Role.Query.as_user(self.master_user).using(self.USING).all()
        if existing:
            ParseBatcher().batch_delete(existing,_using=self.USING,_as_user=self.master_user)
开发者ID:freeflysecurity,项目名称:ParsePy,代码行数:17,代码来源:tests.py

示例3: testCanSignUp

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import signup [as 别名]
 def testCanSignUp(self):
     self._destroy_user()
     user = User.signup(self.username, self.password)
     self.assert_(user is not None)
     self.assert_(user.username == self.username)
开发者ID:freeflysecurity,项目名称:ParsePy,代码行数:7,代码来源:tests.py

示例4: _get_user

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import signup [as 别名]
 def _get_user(self):
     try:
         user = User.signup(self.username, self.password)
     except:
         user = User.Query.get(username=self.username)
     return user
开发者ID:freeflysecurity,项目名称:ParsePy,代码行数:8,代码来源:tests.py

示例5: testCanQueryBySession

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import signup [as 别名]
 def testCanQueryBySession(self):
     User.signup(self.username, self.password)
     logged = User.login(self.username, self.password)
     queried = User.Query.where(sessionToken=logged.sessionToken).get()
     self.assert_(queried.objectId == logged.objectId,
                  'Could not find user %s by session' % logged.username)
开发者ID:devavrat,项目名称:ParsePy,代码行数:8,代码来源:tests.py


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