mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Better validation error for validate version using new publisher
This commit is contained in:
parent
6cff073b7a
commit
57e61666aa
1 changed files with 21 additions and 6 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import pyblish.api
|
||||
from openpype.pipeline.publish import PublishValidationError
|
||||
|
||||
|
||||
class ValidateVersion(pyblish.api.InstancePlugin):
|
||||
|
|
@ -20,11 +21,25 @@ class ValidateVersion(pyblish.api.InstancePlugin):
|
|||
version = instance.data.get("version")
|
||||
latest_version = instance.data.get("latestVersion")
|
||||
|
||||
if latest_version is not None:
|
||||
if latest_version is not None and int(version) <= int(latest_version):
|
||||
# TODO: Remove full non-html version upon drop of old publisher
|
||||
msg = (
|
||||
"Version `{0}` from instance `{1}` that you are trying to"
|
||||
" publish, already exists in the database. Version in"
|
||||
" database: `{2}`. Please version up your workfile to a higher"
|
||||
" version number than: `{2}`."
|
||||
"Version '{0}' from instance '{1}' that you are "
|
||||
" trying to publish is lower or equal to an existing version "
|
||||
" in the database. Version in database: '{2}'."
|
||||
"Please version up your workfile to a higher version number "
|
||||
"than: '{2}'."
|
||||
).format(version, instance.data["name"], latest_version)
|
||||
assert (int(version) > int(latest_version)), msg
|
||||
|
||||
msg_html = (
|
||||
"Version <b>{0}</b> from instance <b>{1}</b> that you are "
|
||||
" trying to publish is lower or equal to an existing version "
|
||||
" in the database. Version in database: <b>{2}</b>.<br><br>"
|
||||
"Please version up your workfile to a higher version number "
|
||||
"than: <b>{2}</b>."
|
||||
).format(version, instance.data["name"], latest_version)
|
||||
raise PublishValidationError(
|
||||
title="Higher version of publish already exists",
|
||||
message=msg,
|
||||
description=msg_html
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue