Exemplo n.º 1
0
def reviewer_list(review_request):
    """
    Returns a humanized list of target reviewers in a review request.
    """
    return humanize_list([group.display_name or group.name \
                          for group in review_request.target_groups.all()] + \
                         [user.get_full_name() or user.username \
                          for user  in review_request.target_people.all()])
Exemplo n.º 2
0
def reviewer_list(review_request):
    """
    Returns a humanized list of target reviewers in a review request.
    """
    return humanize_list([group.display_name or group.name \
                          for group in review_request.target_groups.all()] + \
                         [user.get_full_name() or user.username \
                          for user  in review_request.target_people.all()])
Exemplo n.º 3
0
    def __init__(self, allowed_types=[], msg=None, user_key=None):
        if allowed_types:
            msg = _('Unable to authenticate against this repository using one '
                    'of the supported authentication types '
                    '(%(allowed_types)s).') % {
                'allowed_types': humanize_list(allowed_types),
            }
        elif not msg:
            msg = _('Unable to authenticate against this repository using one '
                    'of the supported authentication types.')

        SCMError.__init__(self, msg)
        self.allowed_types = allowed_types
        self.user_key = user_key
Exemplo n.º 4
0
    def __init__(self, allowed_types, user_key=None):
        if allowed_types:
            msg = _('Unable to authenticate against this repository using one '
                    'of the supported authentication types '
                    '(%(allowed_types)s).') % {
                'allowed_types': humanize_list(allowed_types),
            }
        else:
            msg = _('Unable to authenticate against this repository using one '
                    'of the supported authentication types.')

        SCMError.__init__(self, msg)
        self.allowed_types = allowed_types
        self.user_key = user_key
Exemplo n.º 5
0
 def test1(self):
     """Testing humanize_list filter (length 1)"""
     self.assertEqual(djblets_utils.humanize_list(['a']), 'a')
Exemplo n.º 6
0
 def test2(self):
     """Testing humanize_list filter (length 2)"""
     self.assertEqual(djblets_utils.humanize_list(['a', 'b']), 'a and b')
Exemplo n.º 7
0
 def test_with_1_item(self):
     """Testing {{...|humanize_list}} with 1 item"""
     self.assertEqual(humanize_list(['a']),
                      'a')
Exemplo n.º 8
0
 def test0(self):
     """Testing humanize_list filter (length 0)"""
     self.assertEqual(djblets_utils.humanize_list([]), '')
Exemplo n.º 9
0
 def test_with_empty_list(self):
     """Testing {{...|humanize_list}} with empty list"""
     self.assertEqual(humanize_list([]),
                      '')
Exemplo n.º 10
0
 def test_with_4_items(self):
     """Testing {{...|humanize_list}} with 4 items"""
     self.assertEqual(humanize_list(['a', 'b', 'c', 'd']), 'a, b, c, and d')
Exemplo n.º 11
0
 def test1(self):
     """Testing humanize_list filter (length 1)"""
     self.assertEqual(djblets_utils.humanize_list(['a']), 'a')
Exemplo n.º 12
0
 def test3(self):
     """Testing humanize_list filter (length 3)"""
     self.assertEqual(djblets_utils.humanize_list(['a', 'b', 'c']),
                      'a, b and c')
Exemplo n.º 13
0
 def test3(self):
     """Testing humanize_list filter (length 3)"""
     self.assertEqual(djblets_utils.humanize_list(['a', 'b', 'c']),
                      'a, b and c')
Exemplo n.º 14
0
 def test_with_2_items(self):
     """Testing {{...|humanize_list}} with 2 items"""
     self.assertEqual(humanize_list(['a', 'b']),
                      'a and b')
Exemplo n.º 15
0
 def test4(self):
     """Testing humanize_list filter (length 4)"""
     self.assertEqual(djblets_utils.humanize_list(["a", "b", "c", "d"]), "a, b, c, and d")
Exemplo n.º 16
0
 def test3(self):
     """Testing humanize_list filter (length 3)"""
     self.assertEqual(djblets_utils.humanize_list(["a", "b", "c"]), "a, b and c")
Exemplo n.º 17
0
 def test2(self):
     """Testing humanize_list filter (length 2)"""
     self.assertEqual(djblets_utils.humanize_list(["a", "b"]), "a and b")
Exemplo n.º 18
0
 def test_with_4_items(self):
     """Testing {{...|humanize_list}} with 4 items"""
     self.assertEqual(humanize_list(['a', 'b', 'c', 'd']),
                      'a, b, c, and d')
Exemplo n.º 19
0
 def test_with_3_items(self):
     """Testing {{...|humanize_list}} with 3 items"""
     self.assertEqual(humanize_list(['a', 'b', 'c']),
                      'a, b and c')
Exemplo n.º 20
0
 def test4(self):
     """Testing humanize_list filter (length 4)"""
     self.assertEqual(djblets_utils.humanize_list(['a', 'b', 'c', 'd']),
                      'a, b, c, and d')
Exemplo n.º 21
0
 def test_with_empty_list(self):
     """Testing {{...|humanize_list}} with empty list"""
     self.assertEqual(humanize_list([]), '')
Exemplo n.º 22
0
 def test0(self):
     """Testing humanize_list filter (length 0)"""
     self.assertEqual(djblets_utils.humanize_list([]), '')
Exemplo n.º 23
0
 def test_with_1_item(self):
     """Testing {{...|humanize_list}} with 1 item"""
     self.assertEqual(humanize_list(['a']), 'a')
Exemplo n.º 24
0
 def test2(self):
     """Testing humanize_list filter (length 2)"""
     self.assertEqual(djblets_utils.humanize_list(['a', 'b']), 'a and b')
Exemplo n.º 25
0
 def test_with_2_items(self):
     """Testing {{...|humanize_list}} with 2 items"""
     self.assertEqual(humanize_list(['a', 'b']), 'a and b')
Exemplo n.º 26
0
 def test4(self):
     """Testing humanize_list filter (length 4)"""
     self.assertEqual(djblets_utils.humanize_list(['a', 'b', 'c', 'd']),
                      'a, b, c, and d')
Exemplo n.º 27
0
 def test_with_3_items(self):
     """Testing {{...|humanize_list}} with 3 items"""
     self.assertEqual(humanize_list(['a', 'b', 'c']), 'a, b and c')