• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python sentry.get_version函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sentry.get_version函数的典型用法代码示例。如果您正苦于以下问题:Python get_version函数的具体用法?Python get_version怎么用?Python get_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_version函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _needs_upgrade

def _needs_upgrade():
    version_configured = options.get('sentry:version-configured')
    if not version_configured:
        # If we were never previously upgraded (being a new install)
        # we want to force an upgrade, even if the values are set.
        return True

    smtp_disabled = not is_smtp_enabled()

    # Check all required options to see if they've been set
    for key in options.filter(flag=options.FLAG_REQUIRED):
        # ignore required flags which can be empty
        if key.flags & options.FLAG_ALLOW_EMPTY:
            continue
        # Ignore mail.* keys if smtp is disabled
        if smtp_disabled and key.name[:5] == 'mail.':
            continue
        if not options.isset(key.name):
            return True

    if version_configured != sentry.get_version():
        # Everything looks good, but version changed, so let's bump it
        options.set('sentry:version-configured', sentry.get_version())

    return False
开发者ID:yaoqi,项目名称:sentry,代码行数:25,代码来源:sentry_react.py


示例2: test_simple

    def test_simple(self, safe_urlread, safe_urlopen,
                    mock_get_all_package_versions):
        mock_get_all_package_versions.return_value = {'foo': '1.0'}
        safe_urlread.return_value = json.dumps({
            'notices': [],
            'version': {'stable': '1.0.0'},
        })

        assert options.set('system.admin-email', '[email protected]')
        send_beacon()

        install_id = options.get('sentry:install-id')
        assert install_id and len(install_id) == 40

        safe_urlopen.assert_called_once_with(BEACON_URL, json={
            'install_id': install_id,
            'version': sentry.get_version(),
            'data': {
                'organizations': 1,
                'users': 0,
                'projects': 1,
                'teams': 1,
                'events.24h': 0,
            },
            'admin_email': '[email protected]',
            'packages': mock_get_all_package_versions.return_value,
        }, timeout=5)
        safe_urlread.assert_called_once_with(safe_urlopen.return_value)

        assert options.get('sentry:latest_version') == '1.0.0'
开发者ID:280185386,项目名称:sentry,代码行数:30,代码来源:test_beacon.py


示例3: put

 def put(self, request):
     # TODO(dcramer): this should validate options before saving them
     for k, v in request.DATA.iteritems():
         if v and isinstance(v, basestring):
             v = v.strip()
         try:
             if not v:
                 options.delete(k)
             else:
                 options.set(k, v)
         except options.UnknownOption:
             # TODO(dcramer): unify API errors
             return Response({
                 'error': 'unknown_option',
                 'errorDetail': {
                     'option': k,
                 },
             }, status=400)
         except TypeError as e:
             return Response({
                 'error': 'invalid_type',
                 'errorDetail': {
                     'option': k,
                     'message': unicode(e),
                 },
             }, status=400)
     # TODO(dcramer): this has nothing to do with configuring options and
     # should not be set here
     options.set('sentry:version-configured', sentry.get_version())
     return Response(status=200)
开发者ID:IthacaDream,项目名称:sentry,代码行数:30,代码来源:system_options.py


示例4: test_simple

    def test_simple(self, safe_urlread, safe_urlopen):
        self.create_project(platform='java')

        safe_urlread.return_value = json.dumps({
            'notices': [],
            'version': {'stable': '1.0.0'},
        })

        with self.settings(SENTRY_ADMIN_EMAIL='[email protected]'):
            send_beacon()

        install_id = options.get('sentry:install-id')
        assert install_id and len(install_id) == 40

        safe_urlopen.assert_called_once_with(BEACON_URL, json={
            'install_id': install_id,
            'version': sentry.get_version(),
            'data': {
                'platforms': ['java'],
                'organizations': 2,
                'users': 2,
                'projects': 2,
                'teams': 2,
                'events.24h': 0,
            },
            'admin_email': '[email protected]',
        }, timeout=5)
        safe_urlread.assert_called_once_with(safe_urlopen.return_value)

        assert options.get('sentry:latest_version') == '1.0.0'
开发者ID:GpadillaQ,项目名称:sentry,代码行数:30,代码来源:test_beacon.py


示例5: put

    def put(self, request):
        # TODO(dcramer): this should validate options before saving them
        for k, v in six.iteritems(request.DATA):
            if v and isinstance(v, six.string_types):
                v = v.strip()
            try:
                option = options.lookup_key(k)
            except options.UnknownOption:
                # TODO(dcramer): unify API errors
                return Response({
                    'error': 'unknown_option',
                    'errorDetail': {
                        'option': k,
                    },
                }, status=400)

            try:
                if not (option.flags & options.FLAG_ALLOW_EMPTY) and not v:
                    options.delete(k)
                else:
                    options.set(k, v)
            except TypeError as e:
                return Response({
                    'error': 'invalid_type',
                    'errorDetail': {
                        'option': k,
                        'message': six.text_type(e),
                    },
                }, status=400)
        # TODO(dcramer): this has nothing to do with configuring options and
        # should not be set here
        options.set('sentry:version-configured', sentry.get_version())
        return Response(status=200)
开发者ID:ForkRepo,项目名称:sentry,代码行数:33,代码来源:system_options.py


示例6: _needs_upgrade

def _needs_upgrade():
    version_configured = options.get('sentry:version-configured')
    if not version_configured:
        # If we were never previously upgraded (being a new install)
        # we want to force an upgrade, even if the values are set.
        return True

    # Check all required options to see if they've been set
    for key in options.filter(flag=options.FLAG_REQUIRED):
        if not options.get(key.name):
            return True

    if version_configured != sentry.get_version():
        # Everything looks good, but version changed, so let's bump it
        options.set('sentry:version-configured', sentry.get_version())

    return False
开发者ID:IthacaDream,项目名称:sentry,代码行数:17,代码来源:sentry_react.py


示例7: put

 def put(self, request):
     try:
         for k, v in request.DATA.iteritems():
             options.set(k, v)
     except Exception as e:
         return Response(unicode(e), status=400)
     options.set('sentry:version-configured', sentry.get_version())
     return Response(status=200)
开发者ID:rkeilty,项目名称:sentry,代码行数:8,代码来源:system_options.py


示例8: get_sentry_version

def get_sentry_version(context):
    import sentry

    current = sentry.get_version()

    latest = options.get("sentry:latest_version") or current
    update_available = Version(latest) > Version(current)

    context["sentry_version"] = SentryVersion(current, latest, update_available)
    return ""
开发者ID:josephmc5,项目名称:sentry,代码行数:10,代码来源:sentry_helpers.py


示例9: get_sentry_version

def get_sentry_version(context):
    import sentry

    current = sentry.get_version()

    latest = Option.objects.get_value("sentry:latest_version", current)
    update_available = Version(latest) > Version(current)

    context["sentry_version"] = SentryVersion(current, latest, update_available)
    return ""
开发者ID:beyondtime,项目名称:sentry,代码行数:10,代码来源:sentry_helpers.py


示例10: set_sentry_version

def set_sentry_version(latest=None, **kwargs):
    import sentry
    current = sentry.get_version()

    version = options.get('sentry:latest_version')

    for ver in (current, version):
        if Version(ver) >= Version(latest):
            return

    options.set('sentry:latest_version', (latest or current))
开发者ID:josephmc5,项目名称:sentry,代码行数:11,代码来源:core.py


示例11: set_sentry_version

def set_sentry_version(latest=None, **kwargs):
    import sentry
    current = sentry.get_version()

    version = Option.objects.get_value(key='sentry:latest_version', default='')

    for ver in (current, version):
        if Version(ver) >= Version(latest):
            return

    Option.objects.set_value(
        key='sentry:latest_version', value=(latest or current))
开发者ID:theatlantic,项目名称:django-sentry,代码行数:12,代码来源:models.py


示例12: send_beacon

def send_beacon():
    """
    Send a Beacon to a remote server operated by the Sentry team.

    See the documentation for more details.
    """
    from sentry import options
    from sentry.models import Organization, Project, Team, User

    if not settings.SENTRY_BEACON:
        logger.info('Not sending beacon (disabled)')
        return

    install_id = options.get('sentry:install-id')
    if not install_id:
        logger.info('Generated installation ID: %s', install_id)
        install_id = sha1(uuid4().hex).hexdigest()
        options.set('sentry:install-id', install_id)

    end = timezone.now()
    events_24h = tsdb.get_sums(
        model=tsdb.models.internal,
        keys=['events.total'],
        start=end - timedelta(hours=24),
        end=end,
    )['events.total']

    payload = {
        'install_id': install_id,
        'version': sentry.get_version(),
        'admin_email': settings.SENTRY_ADMIN_EMAIL,
        'data': {
            # TODO(dcramer): we'd also like to get an idea about the throughput
            # of the system (i.e. events in 24h)
            'users': User.objects.count(),
            'projects': Project.objects.count(),
            'teams': Team.objects.count(),
            'organizations': Organization.objects.count(),
            'events.24h': events_24h,
        }
    }

    # TODO(dcramer): relay the response 'notices' as admin broadcasts
    try:
        request = safe_urlopen(BEACON_URL, json=payload, timeout=5)
        response = safe_urlread(request)
    except Exception:
        logger.warning('Failed sending beacon', exc_info=True)
        return

    data = json.loads(response)
    if 'version' in data:
        options.set('sentry:latest_version', data['version']['stable'])
开发者ID:carriercomm,项目名称:sentry-1,代码行数:53,代码来源:beacon.py


示例13: send_beacon

def send_beacon():
    """
    Send a Beacon to a remote server operated by the Sentry team.

    See the documentation for more details.
    """
    from sentry import options
    from sentry.models import Organization, Project, Team, User

    if not settings.SENTRY_BEACON:
        logger.info('Not sending beacon (disabled)')
        return

    # TODO(dcramer): move version code off of PyPi and into beacon
    install_id = options.get('sentry:install-id')
    if not install_id:
        logger.info('Generated installation ID: %s', install_id)
        install_id = sha1(uuid4().hex).hexdigest()
        options.set('sentry:install-id', install_id)

    internal_project_ids = filter(bool, [
        settings.SENTRY_PROJECT, settings.SENTRY_FRONTEND_PROJECT,
    ])
    platform_list = list(set(Project.objects.exclude(
        id__in=internal_project_ids,
    ).values_list('platform', flat=True)))

    payload = {
        'install_id': install_id,
        'version': sentry.get_version(),
        'admin_email': settings.SENTRY_ADMIN_EMAIL,
        'data': {
            # TODO(dcramer): we'd also like to get an idea about the throughput
            # of the system (i.e. events in 24h)
            'platforms': platform_list,
            'users': User.objects.count(),
            'projects': Project.objects.count(),
            'teams': Team.objects.count(),
            'organizations': Organization.objects.count(),
        }
    }

    # TODO(dcramer): relay the response 'notices' as admin broadcasts
    try:
        request = safe_urlopen(BEACON_URL, json=payload, timeout=5)
        response = safe_urlread(request)
    except Exception:
        logger.warning('Failed sending beacon', exc_info=True)
        return

    data = json.loads(response)
    if 'version' in data:
        options.set('sentry:latest_version', data['version']['stable'])
开发者ID:DZTPY,项目名称:sentry,代码行数:53,代码来源:beacon.py


示例14: put

 def put(self, request):
     # TODO(dcramer): this should validate options before saving them
     for k, v in request.DATA.iteritems():
         try:
             options.set(k, v)
         except options.UnknownOption:
             # TODO(dcramer): unify API errors
             return Response({
                 'error': 'unknown_option',
                 'errorDetail': {
                     'option': k,
                 },
             }, status=400)
     options.set('sentry:version-configured', sentry.get_version())
     return Response(status=200)
开发者ID:dca,项目名称:sentry,代码行数:15,代码来源:system_options.py


示例15: widget

    def widget(self, request, group, **kwargs):
        resp = Responsibility.objects.filter(group=group)
        resp = resp.order_by('user__first_name', 'user__last_name',
                             'user__username')
        resp = list(resp)

        available = group.project.team.member_set.exclude(
            user__in=[x.user for x in resp])

        if tuple(map(int, sentry.get_version().split('.')[:2])) >= (5, 3):
            # URL args changed in Sentry 5.3
            args = (group.project.team.slug, group.project.slug,
                    group.id, self.slug)
        else:
            args = (group.project.slug, group.id, self.slug)
        plugin_url = reverse('sentry-group-plugin-action', args=args)

        return self.render('sentry_responsible/widget.html', {
            'responsible': resp,
            'plugin_url': plugin_url,
            'available': list(available),
        })
开发者ID:andialbrecht,项目名称:sentry-responsible,代码行数:22,代码来源:plugin.py


示例16: test_simple

    def test_simple(self, safe_urlread, safe_urlopen, mock_get_all_package_versions):
        mock_get_all_package_versions.return_value = {"foo": "1.0"}
        safe_urlread.return_value = json.dumps({"notices": [], "version": {"stable": "1.0.0"}})

        with self.settings(SENTRY_ADMIN_EMAIL="[email protected]"):
            send_beacon()

        install_id = options.get("sentry:install-id")
        assert install_id and len(install_id) == 40

        safe_urlopen.assert_called_once_with(
            BEACON_URL,
            json={
                "install_id": install_id,
                "version": sentry.get_version(),
                "data": {"organizations": 1, "users": 0, "projects": 1, "teams": 1, "events.24h": 0},
                "admin_email": "[email protected]",
                "packages": mock_get_all_package_versions.return_value,
            },
            timeout=5,
        )
        safe_urlread.assert_called_once_with(safe_urlopen.return_value)

        assert options.get("sentry:latest_version") == "1.0.0"
开发者ID:cloudrifles,项目名称:sentry,代码行数:24,代码来源:test_beacon.py


示例17: mark_as_configured

def mark_as_configured():
    sentry.options.set('sentry:version-configured', sentry.get_version())
开发者ID:SUNNYWILLHAPPEN,项目名称:sentry-docker,代码行数:2,代码来源:create_team_or_project.py


示例18: send_beacon

def send_beacon():
    """
    Send a Beacon to a remote server operated by the Sentry team.

    See the documentation for more details.
    """
    from sentry import options
    from sentry.models import Broadcast, Organization, Project, Team, User

    if not settings.SENTRY_BEACON:
        logger.info('Not sending beacon (disabled)')
        return

    install_id = options.get('sentry:install-id')
    if not install_id:
        logger.info('Generated installation ID: %s', install_id)
        install_id = sha1(uuid4().hex).hexdigest()
        options.set('sentry:install-id', install_id)

    end = timezone.now()
    events_24h = tsdb.get_sums(
        model=tsdb.models.internal,
        keys=['events.total'],
        start=end - timedelta(hours=24),
        end=end,
    )['events.total']

    payload = {
        'install_id': install_id,
        'version': sentry.get_version(),
        'admin_email': options.get('system.admin-email'),
        'data': {
            # TODO(dcramer): we'd also like to get an idea about the throughput
            # of the system (i.e. events in 24h)
            'users': User.objects.count(),
            'projects': Project.objects.count(),
            'teams': Team.objects.count(),
            'organizations': Organization.objects.count(),
            'events.24h': events_24h,
        },
        'packages': get_all_package_versions(),
    }

    # TODO(dcramer): relay the response 'notices' as admin broadcasts
    try:
        request = safe_urlopen(BEACON_URL, json=payload, timeout=5)
        response = safe_urlread(request)
    except Exception:
        logger.warning('Failed sending beacon', exc_info=True)
        return

    data = json.loads(response)

    if 'version' in data:
        options.set('sentry:latest_version', data['version']['stable'])

    if 'notices' in data:
        upstream_ids = set()
        for notice in data['notices']:
            upstream_ids.add(notice['id'])
            Broadcast.objects.create_or_update(
                upstream_id=notice['id'],
                defaults={
                    'title': notice['title'],
                    'link': notice.get('link'),
                    'message': notice['message'],
                }
            )

        Broadcast.objects.filter(
            upstream_id__isnull=False,
        ).exclude(
            upstream_id__in=upstream_ids,
        ).update(
            is_active=False,
        )
开发者ID:280185386,项目名称:sentry,代码行数:76,代码来源:beacon.py


示例19: configure

# encoding: utf-8
from __future__ import print_function
import sys

# Bootstrap the Sentry environment
from sentry.utils.runner import configure

configure()

# Do something crazy
import sentry
from sentry.models import Team, Project, ProjectKey, User, Organization
from sentry.web.frontend.project_settings import OriginsField
from django.forms import ValidationError

SENTRY_VERSION = tuple(map(lambda x: int(x) if x.isdigit() else x, sentry.get_version().split(".")))


def create_team(admin_username, team_name, organization_name=None):
    user = User.objects.get(username=admin_username)
    if organization_name is None:
        organization_name = team_name
    org, new_org = Organization.objects.get_or_create(name=organization_name, defaults={"owner": user})
    team, new = Team.objects.get_or_create(name=team_name, defaults={"organization": org})
    return team, new


def create_project(team_name, project_name, platform="python"):
    team = Team.objects.get(name=team_name)
    defaults = {"platform": platform, "organization": team.organization}
    project, new = Project.objects.get_or_create(name=project_name, team=team, defaults=defaults)
开发者ID:tonyseek,项目名称:sentry-docker,代码行数:31,代码来源:create_team_or_project.py


示例20: sentry_version

def sentry_version():
    from sentry import get_version
    return get_version()
开发者ID:kmike,项目名称:django-sentry,代码行数:3,代码来源:sentry_helpers.py



注:本文中的sentry.get_version函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python analytics.record函数代码示例发布时间:2022-05-27
下一篇:
Python sentinel.SentinelAPI类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap