本文整理汇总了Python中patchwork.models.Person.save方法的典型用法代码示例。如果您正苦于以下问题:Python Person.save方法的具体用法?Python Person.save怎么用?Python Person.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类patchwork.models.Person
的用法示例。
在下文中一共展示了Person.save方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testSecondaryEmailOptoutForm
# 需要导入模块: from patchwork.models import Person [as 别名]
# 或者: from patchwork.models.Person import save [as 别名]
def testSecondaryEmailOptoutForm(self):
p = Person(email=self.secondary_email, user=self.user)
p.save()
form_re = self._form_re(self.optout_url, p.email)
response = self.client.get(self.url)
self.assertEqual(response.status_code, 200)
self.assertTrue(form_re.search(response.content.decode()) is not None)
示例2: testCompleteLimit
# 需要导入模块: from patchwork.models import Person [as 别名]
# 或者: from patchwork.models.Person import save [as 别名]
def testCompleteLimit(self):
for i in range(3,10):
person = Person(email = 'test%[email protected]' % i)
person.save()
response = self.client.get('/submitter/', {'q': 'test', 'l': 5})
self.assertEquals(response.status_code, 200)
data = json.loads(response.content)
self.assertEquals(len(data), 5)
示例3: setUp
# 需要导入模块: from patchwork.models import Person [as 别名]
# 或者: from patchwork.models.Person import save [as 别名]
def setUp(self):
# Create a 'chris' User and Person
mail = '[email protected]'
self.user = User.objects.create_user('chris', mail, 'securepass')
person = Person(email=mail)
person.link_to_user(self.user)
person.save()
super(EventLogTest, self).setUp()
示例4: setUp
# 需要导入模块: from patchwork.models import Person [as 别名]
# 或者: from patchwork.models.Person import save [as 别名]
def setUp(self):
defaults.project.save()
for (name, email, date) in self.patchmeta:
patch_name = 'testpatch' + name
person = Person(name = name, email = email)
person.save()
patch = Patch(project = defaults.project, msgid = patch_name,
submitter = person, content = '', date = date)
patch.save()
示例5: create_user
# 需要导入模块: from patchwork.models import Person [as 别名]
# 或者: from patchwork.models.Person import save [as 别名]
def create_user():
global _user_idx
userid = "test%d" % _user_idx
email = "%[email protected]" % userid
_user_idx += 1
user = User.objects.create_user(userid, email, userid)
user.save()
person = Person(email=email, name=userid, user=user)
person.save()
return user
示例6: register_confirm
# 需要导入模块: from patchwork.models import Person [as 别名]
# 或者: from patchwork.models.Person import save [as 别名]
def register_confirm(request, conf):
conf.user.is_active = True
conf.user.save()
conf.deactivate()
try:
person = Person.objects.get(email__iexact = conf.user.email)
except Person.DoesNotExist:
person = Person(email = conf.user.email,
name = conf.user.profile.name())
person.user = conf.user
person.save()
return render_to_response('patchwork/registration-confirm.html')
示例7: link_confirm
# 需要导入模块: from patchwork.models import Person [as 别名]
# 或者: from patchwork.models.Person import save [as 别名]
def link_confirm(request, conf):
try:
person = Person.objects.get(email__iexact=conf.email)
except Person.DoesNotExist:
person = Person(email=conf.email)
person.link_to_user(conf.user)
person.save()
conf.deactivate()
context = {
'person': person,
}
return render(request, 'patchwork/user-link-confirm.html', context)
示例8: create_person
# 需要导入模块: from patchwork.models import Person [as 别名]
# 或者: from patchwork.models.Person import save [as 别名]
def create_person(**kwargs):
"""Create a 'Person' object."""
num = Person.objects.count()
values = {
'email': 'test_person_%[email protected]' % num,
'name': 'test_person_%d' % num,
'user': None,
}
values.update(kwargs)
person = Person(**values)
person.save()
return person
示例9: link_confirm
# 需要导入模块: from patchwork.models import Person [as 别名]
# 或者: from patchwork.models.Person import save [as 别名]
def link_confirm(request, conf):
context = PatchworkRequestContext(request)
try:
person = Person.objects.get(email__iexact = conf.email)
except Person.DoesNotExist:
person = Person(email = conf.email)
person.link_to_user(conf.user)
person.save()
conf.deactivate()
context['person'] = person
return render_to_response('patchwork/user-link-confirm.html', context)
示例10: test_existing_person_unmodified
# 需要导入模块: from patchwork.models import Person [as 别名]
# 或者: from patchwork.models.Person import save [as 别名]
def test_existing_person_unmodified(self):
"""Check that an unconfirmed registration can't modify an existing
Person object."""
person = Person(name=self.user.fullname, email=self.user.email)
person.save()
# register
data = self.default_data.copy()
data['first_name'] = 'invalid'
data['last_name'] = 'invalid'
self.assertEqual(data['email'], person.email)
response = self.client.post('/register/', data)
self.assertEqual(response.status_code, 200)
self.assertEqual(Person.objects.get(pk=person.pk).name,
self.user.fullname)
示例11: test_existing_person_setup
# 需要导入模块: from patchwork.models import Person [as 别名]
# 或者: from patchwork.models.Person import save [as 别名]
def test_existing_person_setup(self):
""" Check that the person object created after registration has the
correct details """
person = Person(name=self.user.fullname, email=self.user.email)
person.save()
# register
self.assertEqual(EmailConfirmation.objects.count(), 0)
response = self.client.post('/register/', self.default_data)
self.assertEqual(response.status_code, 200)
# confirm
conf = EmailConfirmation.objects.filter()[0]
response = self.client.get(_confirmation_url(conf))
self.assertEqual(response.status_code, 200)
person = Person.objects.get(email=self.user.email)
self.assertEqual(person.name, self.user.fullname)
示例12: UTF8HeaderPatchViewTest
# 需要导入模块: from patchwork.models import Person [as 别名]
# 或者: from patchwork.models.Person import save [as 别名]
class UTF8HeaderPatchViewTest(UTF8PatchViewTest):
patch_filename = '0002-utf-8.patch'
patch_encoding = 'utf-8'
patch_author_name = u'P\xe4tch Author'
def setUp(self):
defaults.project.save()
self.patch_author = Person(name = self.patch_author_name,
email = defaults.patch_author_person.email)
self.patch_author.save()
self.patch_content = read_patch(self.patch_filename,
encoding = self.patch_encoding)
self.patch = Patch(project = defaults.project,
msgid = 'x', name = defaults.patch_name,
submitter = self.patch_author,
content = self.patch_content)
self.patch.save()
self.client = Client()
def tearDown(self):
self.patch.delete()
self.patch_author.delete()
defaults.project.delete()