Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parent property of PathTemplate in case of optional key #1013

Closed
wants to merge 5 commits into from

Conversation

ClementHector
Copy link

@ClementHector ClementHector commented Mar 19, 2025

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 19, 2025 15:21
@ClementHector ClementHector marked this pull request as draft March 19, 2025 15:40
@ClementHector ClementHector changed the title Fix parent propety in case of optional key Fix parent property in case of optional key Mar 19, 2025
@ClementHector ClementHector changed the title Fix parent property in case of optional key Fix parent property of PathTemplate in case of optional key Mar 19, 2025
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.

1 participant