本文整理汇总了Python中sentry.models.Release.is_valid_version方法的典型用法代码示例。如果您正苦于以下问题:Python Release.is_valid_version方法的具体用法?Python Release.is_valid_version怎么用?Python Release.is_valid_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sentry.models.Release
的用法示例。
在下文中一共展示了Release.is_valid_version方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: finish_release
# 需要导入模块: from sentry.models import Release [as 别名]
# 或者: from sentry.models.Release import is_valid_version [as 别名]
def finish_release(self, version, **values):
if not Release.is_valid_version(version):
raise HookValidationError('Invalid release version: %s' % version)
values.setdefault('date_released', timezone.now())
try:
with transaction.atomic():
release = Release.objects.create(
version=version, organization_id=self.project.organization_id, **values
)
except IntegrityError:
release = Release.objects.get(
version=version,
organization_id=self.project.organization_id,
)
release.update(**values)
release.add_project(self.project)
Activity.objects.create(
type=Activity.RELEASE,
project=self.project,
ident=Activity.get_version_ident(version),
data={'version': version},
datetime=values['date_released'],
)
self.set_refs(release=release, **values)
示例2: start_release
# 需要导入模块: from sentry.models import Release [as 别名]
# 或者: from sentry.models.Release import is_valid_version [as 别名]
def start_release(self, version, **values):
if not Release.is_valid_version(version):
raise HookValidationError('Invalid release version: %s' % version)
try:
with transaction.atomic():
release = Release.objects.create(
version=version, organization_id=self.project.organization_id, **values
)
except IntegrityError:
release = Release.objects.get(
version=version,
organization_id=self.project.organization_id,
)
release.update(**values)
release.add_project(self.project)
示例3: set_commits
# 需要导入模块: from sentry.models import Release [as 别名]
# 或者: from sentry.models.Release import is_valid_version [as 别名]
def set_commits(self, version, commit_list):
"""
Commits should be ordered oldest to newest.
Calling this method will remove all existing commit history.
"""
if not Release.is_valid_version(version):
raise HookValidationError('Invalid release version: %s' % version)
project = self.project
try:
with transaction.atomic():
release = Release.objects.create(
organization_id=project.organization_id, version=version
)
except IntegrityError:
release = Release.objects.get(organization_id=project.organization_id, version=version)
release.add_project(project)
release.set_commits(commit_list)
示例4: validate_version
# 需要导入模块: from sentry.models import Release [as 别名]
# 或者: from sentry.models.Release import is_valid_version [as 别名]
def validate_version(self, attrs, source):
value = attrs[source]
if not Release.is_valid_version(value):
raise serializers.ValidationError('Invalid value for release')
return attrs
示例5: validate_version
# 需要导入模块: from sentry.models import Release [as 别名]
# 或者: from sentry.models.Release import is_valid_version [as 别名]
def validate_version(self, attrs, source):
value = attrs[source]
if not Release.is_valid_version(value):
raise serializers.ValidationError('Release with name %s is not allowed' % value)
return attrs