コード例 #1
0
ファイル: __init__.py プロジェクト: vsham20/kinto.py
    def get(self, endpoint, **kwargs):
        # Remove nullable values from the kwargs, and slugify the values.
        kwargs = dict((k, utils.slugify(v)) for k, v in iteritems(kwargs) if v)

        try:
            pattern = self.endpoints[endpoint]
            return pattern.format(root=self._root, **kwargs)
        except KeyError as e:
            msg = "Cannot get {endpoint} endpoint, {field} is missing"
            raise KintoException(
                msg.format(endpoint=endpoint, field=','.join(e.args)))
コード例 #2
0
ファイル: __init__.py プロジェクト: vsham20/kinto.py
    def get(self, endpoint, **kwargs):
        # Remove nullable values from the kwargs, and slugify the values.
        kwargs = dict((k, utils.slugify(v))
                      for k, v in iteritems(kwargs) if v)

        try:
            pattern = self.endpoints[endpoint]
            return pattern.format(root=self._root, **kwargs)
        except KeyError as e:
            msg = "Cannot get {endpoint} endpoint, {field} is missing"
            raise KintoException(msg.format(endpoint=endpoint,
                                 field=','.join(e.args)))
コード例 #3
0
ファイル: test_utils.py プロジェクト: itsnauman/kinto.py
 def test_slugify_converts_integers(self):
     assert utils.slugify(1) == '1'
コード例 #4
0
ファイル: test_utils.py プロジェクト: itsnauman/kinto.py
 def test_slugify_do_no_modify_valid_ids(self):
     for value in ['en-US', 'en_GB']:
         assert utils.slugify(value) == value
コード例 #5
0
ファイル: test_utils.py プロジェクト: itsnauman/kinto.py
 def test_slugify_replaces_equivalent_chars(self):
     assert utils.slugify(u'chârs') == 'chars'
コード例 #6
0
ファイル: test_utils.py プロジェクト: itsnauman/kinto.py
 def test_slugify_removes_unknown_characters(self):
     assert utils.slugify(u'chars!') == 'chars'
コード例 #7
0
ファイル: test_utils.py プロジェクト: itsnauman/kinto.py
 def test_slugify_replaces_spaces_by_hyphens(self):
     assert utils.slugify(u'text with spaces') == 'text-with-spaces'