Exemple #1
0
 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)])))
Exemple #2
0
 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),
         ]))
     )
    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"),
        })
Exemple #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'),
        })
Exemple #5
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'),
        })
Exemple #6
0
 def test_none(self):
     assert compact({"foo": None, "bar": 1}) == {"bar": 1}
Exemple #7
0
 def test_empty_string(self):
     assert compact({"foo": ""}) == {"foo": ""}
Exemple #8
0
 def test_false(self):
     assert compact({"foo": False}) == {"foo": False}
Exemple #9
0
 def test_zero(self):
     assert compact({"foo": 0}) == {"foo": 0}
 def test_none(self):
     assert compact({'foo': None, 'bar': 1}) == {'bar': 1}
 def test_empty_string(self):
     assert compact({'foo': ''}) == {'foo': ''}
 def test_false(self):
     assert compact({'foo': False}) == {'foo': False}
 def test_zero(self):
     assert compact({'foo': 0}) == {'foo': 0}