Skip to content

Conversation

@ClementHector
Copy link

Context

The parent property of PathTemplate doesn't create a correct PathTemplate when optional keys are used. For example, if you create a template shots/{Sequence}[-{seq_num}]/{Shot}/{Step}/work, the parent property will return a templatePath without the optional [-{seq_num}] part.

Problem

When creating a PathTemplate with optional keys, the parent property omits these keys in the generated path. This can result in incorrect or incomplete paths.

Solution

To solve this issue, instead of passing self.definition to the PathTemplate constructor, we use self._repr_def, which contains the optional keys.

Testing

A test has been added to verify that the parent property now correctly includes optional keys in the generated PathTemplate.

@ClementHector ClementHector marked this pull request as ready for review March 25, 2025 15:24
@julien-lang julien-lang changed the title Fix parent property of PathTemplate in case of optional key SG-38756 Fix parent property of PathTemplate in case of optional key Apr 10, 2025
@julien-lang
Copy link
Contributor

Thanks for your contribution @ClementHector! We are going to review and test.

@ClementHector
Copy link
Author

With pleasure @julien-lang , don't hesitate to ask me for corrections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants