Bases: ContextPlugin
Validate intent of the publish.
It is required to fill the intent of this publish. Chech the log for more details
Source code in client/ayon_core/plugins/publish/validate_intent.py
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 | class ValidateIntent(pyblish.api.ContextPlugin):
"""Validate intent of the publish.
It is required to fill the intent of this publish. Chech the log
for more details
"""
order = pyblish.api.ValidatorOrder
label = "Validate Intent"
enabled = False
# Can be modified by settings
profiles = [{
"hosts": [],
"task_types": [],
"tasks": [],
"validate": False
}]
def process(self, context):
# Skip if there are no profiles
validate = True
if self.profiles:
# Collect data from context
task_name = context.data.get("task")
task_type = context.data.get("taskType")
host_name = context.data.get("hostName")
filter_data = {
"hosts": host_name,
"task_types": task_type,
"tasks": task_name
}
matching_profile = filter_profiles(
self.profiles, filter_data, logger=self.log
)
if matching_profile:
validate = matching_profile["validate"]
if not validate:
self.log.debug((
"Validation of intent was skipped."
" Matching profile for current context disabled validation."
))
return
intent = context.data.get("intent") or {}
self.log.debug(str(intent))
intent_value = intent.get("value")
if not intent_value:
raise PublishValidationError(
"Please make sure that you select the intent of this publish."
)
|