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


Python models.Person类代码示例

本文整理汇总了Python中patchwork.models.Person的典型用法代码示例。如果您正苦于以下问题:Python Person类的具体用法?Python Person怎么用?Python Person使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testSecondaryEmailOptoutForm

 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)
开发者ID:doanac,项目名称:patchwork,代码行数:7,代码来源:test_mail_settings.py

示例2: testCompleteLimit

 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)
开发者ID:computersforpeace,项目名称:patchwork,代码行数:8,代码来源:test_person.py

示例3: setUp

    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()
开发者ID:anderco,项目名称:patchwork,代码行数:9,代码来源:test_series.py

示例4: setUp

    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()
开发者ID:lsandoval,项目名称:patchwork,代码行数:10,代码来源:test_list.py

示例5: create_user

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
开发者ID:lsandoval,项目名称:patchwork,代码行数:13,代码来源:utils.py

示例6: register_confirm

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')
开发者ID:computersforpeace,项目名称:patchwork,代码行数:13,代码来源:user.py

示例7: link_confirm

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)
开发者ID:getpatchwork,项目名称:patchwork,代码行数:15,代码来源:user.py

示例8: create_person

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
开发者ID:nickglobal,项目名称:patchwork,代码行数:15,代码来源:utils.py

示例9: link_confirm

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)
开发者ID:asl,项目名称:llvm-patchwork,代码行数:15,代码来源:user.py

示例10: test_existing_person_unmodified

    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)
开发者ID:alialnu,项目名称:patchwork,代码行数:16,代码来源:test_registration.py

示例11: test_existing_person_setup

    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)
开发者ID:alialnu,项目名称:patchwork,代码行数:19,代码来源:test_registration.py

示例12: setUp

 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()
开发者ID:lsandoval,项目名称:patchwork,代码行数:13,代码来源:test_encodings.py

示例13: UTF8HeaderPatchViewTest

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()
开发者ID:asl,项目名称:llvm-patchwork,代码行数:23,代码来源:encodings.py


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