mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Fix hound complaints
This commit is contained in:
parent
0e96071996
commit
00285cacc0
4 changed files with 20 additions and 15 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import os
|
||||
import sys
|
||||
import pyblish.api
|
||||
import shotgun_api3
|
||||
from shotgun_api3.shotgun import AuthenticationFault
|
||||
|
|
@ -128,5 +127,5 @@ def get_login():
|
|||
reg = OpenPypeSettingsRegistry()
|
||||
try:
|
||||
return str(reg.get_item("shotgrid_login"))
|
||||
except Exception as e:
|
||||
except Exception as _:
|
||||
return None
|
||||
|
|
|
|||
|
|
@ -4,16 +4,16 @@ import openpype.api
|
|||
|
||||
class ValidateShotgridUser(pyblish.api.ContextPlugin):
|
||||
"""
|
||||
Check if user is valid and have access to the project.
|
||||
Check if user is valid and have access to the project.
|
||||
"""
|
||||
|
||||
label = "Validate Shotgrid User"
|
||||
order = openpype.api.ValidateContentsOrder
|
||||
|
||||
def process(self, context):
|
||||
sg = context.data.get('shotgridSession')
|
||||
sg = context.data.get("shotgridSession")
|
||||
|
||||
login = context.data.get('shotgridUser')
|
||||
login = context.data.get("shotgridUser")
|
||||
self.log.info("Login shotgrid set in OpenPype is {}".format(login))
|
||||
project = context.data.get("shotgridProject")
|
||||
self.log.info("Current shotgun project is {}".format(project))
|
||||
|
|
@ -21,16 +21,18 @@ class ValidateShotgridUser(pyblish.api.ContextPlugin):
|
|||
if not (login and sg and project):
|
||||
raise KeyError()
|
||||
|
||||
user = sg.find_one(
|
||||
"HumanUser",
|
||||
[["login", "is", login]],
|
||||
["projects"]
|
||||
)
|
||||
user = sg.find_one("HumanUser", [["login", "is", login]], ["projects"])
|
||||
|
||||
self.log.info(user)
|
||||
self.log.info(login)
|
||||
user_projects_id = [p["id"] for p in user.get("projects", [])]
|
||||
if not project.get('id') in user_projects_id:
|
||||
raise PermissionError("Login {} don't have access to the project {}".format(login, project))
|
||||
if not project.get("id") in user_projects_id:
|
||||
raise PermissionError(
|
||||
"Login {} don't have access to the project {}".format(
|
||||
login, project
|
||||
)
|
||||
)
|
||||
|
||||
self.log.info("Login {} have access to the project {}".format(login, project))
|
||||
self.log.info(
|
||||
"Login {} have access to the project {}".format(login, project)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,9 @@ class ShotgridModule(
|
|||
|
||||
def get_plugin_paths(self) -> Dict[str, Any]:
|
||||
return {
|
||||
"publish": [os.path.join(SHOTGRID_MODULE_DIR, "plugins", "publish")]
|
||||
"publish": [
|
||||
os.path.join(SHOTGRID_MODULE_DIR, "plugins", "publish")
|
||||
]
|
||||
}
|
||||
|
||||
def get_launch_hook_paths(self) -> str:
|
||||
|
|
|
|||
|
|
@ -23,7 +23,9 @@ class BaseEnumEntity(InputEntity):
|
|||
for item in self.enum_items:
|
||||
key = tuple(item.keys())[0]
|
||||
if key in enum_keys:
|
||||
reason = 'Key "{}" is more than once in enum items.'.format(key)
|
||||
reason = 'Key "{}" is more than once in enum items.'.format(
|
||||
key
|
||||
)
|
||||
raise EntitySchemaError(self, reason)
|
||||
|
||||
enum_keys.add(key)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue