예제 #1
0
파일: faux.py 프로젝트: pasala91/test
 def _invocation_to_s(self, *args, **kwargs):
     """
     Convert a function invocation into a pretty printable string.
     """
     return "({})".format(", ".join(
         compact([self._args_to_s(*args),
                  self._kwargs_to_s(**kwargs)])))
예제 #2
0
파일: faux.py 프로젝트: yaoqi/sentry
 def _invocation_to_s(self, *args, **kwargs):
     """
     Convert a function invocation into a pretty printable string.
     """
     return u'({})'.format(
         ', '.join(compact([
             self._args_to_s(*args),
             self._kwargs_to_s(**kwargs),
         ]))
     )
예제 #3
0
    def _default_logging(self):
        from sentry.app import env

        if (not env.request or not hasattr(env.request, "resolver_match")
                or not hasattr(env.request.resolver_match, "kwargs")):
            return {}

        request_params = env.request.resolver_match.kwargs

        return compact({
            "org": request_params.get("organization_slug"),
            "team": request_params.get("team_slug"),
            "project": request_params.get("project_slug"),
        })
예제 #4
0
    def _default_logging(self):
        from sentry.app import env

        if not env.request or \
           not hasattr(env.request, 'resolver_match') or \
           not hasattr(env.request.resolver_match, 'kwargs'):
            return {}

        request_params = env.request.resolver_match.kwargs

        return compact({
            'org': request_params.get('organization_slug'),
            'team': request_params.get('team_slug'),
            'project': request_params.get('project_slug'),
        })
예제 #5
0
파일: mediator.py 프로젝트: Kayle009/sentry
    def _default_logging(self):
        from sentry.app import env

        if not env.request or \
           not hasattr(env.request, 'resolver_match') or \
           not hasattr(env.request.resolver_match, 'kwargs'):
            return {}

        request_params = env.request.resolver_match.kwargs

        return compact({
            'org': request_params.get('organization_slug'),
            'team': request_params.get('team_slug'),
            'project': request_params.get('project_slug'),
        })
예제 #6
0
 def test_none(self):
     assert compact({"foo": None, "bar": 1}) == {"bar": 1}
예제 #7
0
 def test_empty_string(self):
     assert compact({"foo": ""}) == {"foo": ""}
예제 #8
0
 def test_false(self):
     assert compact({"foo": False}) == {"foo": False}
예제 #9
0
 def test_zero(self):
     assert compact({"foo": 0}) == {"foo": 0}
예제 #10
0
 def test_none(self):
     assert compact({'foo': None, 'bar': 1}) == {'bar': 1}
예제 #11
0
 def test_empty_string(self):
     assert compact({'foo': ''}) == {'foo': ''}
예제 #12
0
 def test_false(self):
     assert compact({'foo': False}) == {'foo': False}
예제 #13
0
 def test_zero(self):
     assert compact({'foo': 0}) == {'foo': 0}