Merge pull request #2914 from pypeclub/enhancement/OP-2947_move-formatting-and-workfile-functions

General: Move formatting and workfile functions
This commit is contained in:
Jakub Trllo 2022-03-18 18:25:46 +01:00 committed by GitHub
commit 5aaa4c159b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 184 additions and 51 deletions

View file

@ -5,11 +5,11 @@ import uuid
import clique
from pymongo import UpdateOne
from openpype_modules.ftrack.lib import BaseAction, statics_icon
from avalon.api import AvalonMongoDB
from openpype.api import Anatomy
import avalon.pipeline
from openpype.api import Anatomy
from openpype.lib import StringTemplate, TemplateUnsolved
from openpype_modules.ftrack.lib import BaseAction, statics_icon
class DeleteOldVersions(BaseAction):
@ -563,18 +563,16 @@ class DeleteOldVersions(BaseAction):
try:
context = representation["context"]
context["root"] = anatomy.roots
path = avalon.pipeline.format_template_with_optional_keys(
context, template
)
path = StringTemplate.format_strict_template(template, context)
if "frame" in context:
context["frame"] = self.sequence_splitter
sequence_path = os.path.normpath(
avalon.pipeline.format_template_with_optional_keys(
StringTemplate.format_strict_template(
context, template
)
)
except KeyError:
except (KeyError, TemplateUnsolved):
# Template references unavailable data
return (None, None)