當前位置: 首頁>>代碼示例>>Python>>正文


Python Profile.all方法代碼示例

本文整理匯總了Python中models.profile.Profile.all方法的典型用法代碼示例。如果您正苦於以下問題:Python Profile.all方法的具體用法?Python Profile.all怎麽用?Python Profile.all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.profile.Profile的用法示例。


在下文中一共展示了Profile.all方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_signup_page_flow

# 需要導入模塊: from models.profile import Profile [as 別名]
# 或者: from models.profile.Profile import all [as 別名]
  def test_signup_page_flow(self):
    # Check that things are empty
    self.assertLength(0, Profile.all())

    # Sign up with the form
    response = self.app.post(self.uri_for('signup'), self.SIGNUP_DATA)
    self.assertRedirects(response, self.uri_for('dashboard', tour=''))

    # Check that we are actually logged in
    response = self.app.get(response.location)
    self.assertLoggedIn()

    # Check that one of everything was created
    self.assertLength(1, Profile.all())

    profile = Profile.all().get()

    # Check the basic data
    self.assertEqual(self.SIGNUP_DATA['email'], profile.email)
    self.assertEqual(self.SIGNUP_DATA['name'], profile.name)

    # Logout and log back in to test that the password works
    self.logout()
    response = self.login(self.SIGNUP_DATA['email'],
                          self.SIGNUP_DATA['password'])
    self.assertRedirects(response, self.uri_for('dashboard'))
開發者ID:carylF,項目名稱:Caryl-Ford,代碼行數:28,代碼來源:test_signup.py

示例2: test_signup_with_existing_email

# 需要導入模塊: from models.profile import Profile [as 別名]
# 或者: from models.profile.Profile import all [as 別名]
  def test_signup_with_existing_email(self):
    response = self.app.post(self.uri_for('signup'), self.SIGNUP_DATA)
    self.assertRedirects(response)
    self.assertLength(1, Profile.all())

    response = self.app.post(self.uri_for('signup'), self.SIGNUP_DATA)
    self.assertOk(response)
    self.assertLength(1, Profile.all())

    email_field = response.pyquery('input#email')
    self.assertLength(1, email_field)
    self.assertNotEqual('', email_field.attr['data-error'])
開發者ID:carylF,項目名稱:Caryl-Ford,代碼行數:14,代碼來源:test_signup.py

示例3: test_signup_sends_welcome_email

# 需要導入模塊: from models.profile import Profile [as 別名]
# 或者: from models.profile.Profile import all [as 別名]
  def test_signup_sends_welcome_email(self):
    # Sign up successfully
    response = self.app.post(self.uri_for('signup'), self.SIGNUP_DATA)
    self.assertRedirects(response, self.uri_for('dashboard', tour=''))

    # Check that a profile was created
    profile = Profile.get_by_email(self.SIGNUP_DATA['email'])
    self.assertIsNotNone(profile)

    # Check that a mail-sending task is in the queue
    tasks = self.taskqueue_stub.GetTasks('mail')
    self.assertLength(1, tasks)

    # Run the task (it should be a deferred call) and check that an e-mail
    # is sent
    task, = tasks
    deferred.run(base64.b64decode(task['body']))
    messages = self.mail_stub.get_sent_messages()
    self.assertLength(1, messages)

    message, = messages
    self.assertEqual('"%s" <%s>' % (profile.name, profile.email), message.to)
    self.assertEqual('Welcome to Daily Meeting!', message.subject)
    self.assertEqual('"Daily Meeting" <[email protected]>',
                     message.sender)
    self.assertEqual('"Daily Meeting Support" <[email protected]>',
                     message.reply_to)
    activation_key = Profile.all().get().activation_key
    activation_url = self.uri_for('profile.activate', k=activation_key)
    self.assertIn(activation_url, message.body.decode())
    self.assertIn(activation_url, message.html.decode())
開發者ID:carylF,項目名稱:Caryl-Ford,代碼行數:33,代碼來源:test_signup.py

示例4: get

# 需要導入模塊: from models.profile import Profile [as 別名]
# 或者: from models.profile.Profile import all [as 別名]
  def get(self):	
	path = os.path.join(os.path.dirname(__file__),
	                    '../views/admin/index.html')
	
	template_values = {
		'name': self.__class__.__name__,
		'profiles': Profile.all(),
	}
	
	self.response.out.write(template.render(path, template_values))
開發者ID:ciriarte,項目名稱:laundry,代碼行數:12,代碼來源:admin.py

示例5: get_profiles

# 需要導入模塊: from models.profile import Profile [as 別名]
# 或者: from models.profile.Profile import all [as 別名]
 def get_profiles(self):
   return Profile.all().ancestor(self)
開發者ID:nardorb,項目名稱:OneStop,代碼行數:4,代碼來源:account.py

示例6: list

# 需要導入模塊: from models.profile import Profile [as 別名]
# 或者: from models.profile.Profile import all [as 別名]
 def list(self):
   editors = Profile.all().filter('is_editor = ', True)
   return self.render_to_response('editors/list.haml', {'editors': editors})
開發者ID:carylF,項目名稱:Caryl-Ford,代碼行數:5,代碼來源:editor.py


注:本文中的models.profile.Profile.all方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。