Example #1
0
def get_key_context(user, project):
    try:
        key = ProjectKey.objects.get(user=user, project=project)
    except ProjectKey.DoesNotExist:
        if can_see_global_keys(user, project):
            key_list = list(ProjectKey.objects.filter(project=project, user__isnull=True)[0:2])
            if len(key_list) == 1:
                key = key_list[0]
            else:
                key = None
        else:
            key = None

    if key is None:
        dsn = 'SENTRY_DSN'
        dsn_public = 'SENTRY_PUBLIC_DSN'
    else:
        dsn = key.dsn_private
        dsn_public = key.dsn_public

    return {
        'key': key,
        'dsn': dsn,
        'dsn_public': dsn_public,
        'raven_js_url': get_raven_js_url(),
    }
Example #2
0
def get_key_context(user, project):
    try:
        key = ProjectKey.objects.get(user=user, project=project)
    except ProjectKey.DoesNotExist:
        try:
            key = ProjectKey.objects.filter(
                project=project,
                user__isnull=True,
            )[0]
        except IndexError:
            key = None

    if key is None:
        dsn = 'SENTRY_DSN'
        dsn_public = 'SENTRY_PUBLIC_DSN'
    else:
        dsn = key.dsn_private
        dsn_public = key.dsn_public

    return {
        'key': key,
        'dsn': dsn,
        'dsn_public': dsn_public,
        'raven_js_url': get_raven_js_url(),
    }
Example #3
0
def get_key_context(user, project):
    try:
        key = ProjectKey.objects.filter(
            project=project,
            user__isnull=True,
            roles=ProjectKey.roles.store,
        )[0]
    except IndexError:
        key = None

    if key is None:
        dsn = 'SENTRY_DSN'
        dsn_public = 'SENTRY_PUBLIC_DSN'
    else:
        dsn = key.dsn_private
        dsn_public = key.dsn_public

    return {
        'key': key,
        'dsn': dsn,
        'dsn_public': dsn_public,
        'raven_js_url': get_raven_js_url(),
    }
Example #4
0
 def test_with_default_raven_js_url(self):
     self.assertEquals(get_raven_js_url(), 'cdn.ravenjs.com/1.1.7/jquery,native/raven.min.js')
Example #5
0
 def test_with_custom_raven_js_url(self):
     url = 'my.cdn/1.0/raven.min.js'
     with self.settings(SENTRY_RAVEN_JS_URL=url):
         self.assertEquals(get_raven_js_url(), url)
Example #6
0
 def test_with_default_raven_js_url(self):
     self.assertEquals(get_raven_js_url(), 'cdn.ravenjs.com/1.1.11/jquery,native/raven.min.js')
Example #7
0
 def test_with_custom_raven_js_url(self):
     url = 'my.cdn/1.0/raven.min.js'
     with self.settings(SENTRY_RAVEN_JS_URL=url):
         self.assertEquals(get_raven_js_url(), url)
Example #8
0
File: tests.py Project: 755/sentry
 def test_with_default_raven_js_url(self):
     self.assertEquals(get_raven_js_url(), 'd3nslu0hdya83q.cloudfront.net/dist/1.0/raven.min.js')
Example #9
0
 def test_with_default_raven_js_url(self):
     self.assertEquals(
         get_raven_js_url(),
         'd3nslu0hdya83q.cloudfront.net/dist/1.0/raven.min.js')