SGTK template weirdness when entity has period in name

Hey, gang,

We have some entities that have periods in the name (i.e. “code”) and it’s causing some unexpected behaviors when we use the Publish App on them.

It’s occurring in a hook I added to the Publish App that copies the file being published into the project’s filesystem (Publish App hook to save file using tk-multi-publish2 templates?). This is what I’m doing:

  1. Use create_filesystem_structure to create the directories and FilesystemLocation entities
  2. Use as_template_fields to find where to copy the file to

Here’s what I’m seeing:

  1. create_filesystem_structure escapes the period out of the name (e.g. test.character -> testCharacter) when creating the dirs and FilesystemLocation entities
  2. as_template_fields looks for a FilesystemLocation without escaping the period (e.g. test.character). It can’t find one and throws an exception: “TankError: Cannot resolve template data for context”

Any ideas?

1 Like

Unfortunately I don’t have enough time to properly investigate this, but I did mock up a quick test where I named a Shot with a . in the name, and that didn’t throw an error. I got back the fields with the shot.70 renamed to shot-70:

fields {'Shot': 'shot-70', 'Sequence': 'succulents', 'Step': 'LAY'}

This is what I would normally expect because the folder creation will rename the . to - and then that will be stored in the path cache/FilesystemLocation entities. The Context.as_template_fields() should then extract the values from the path cache.

So I wonder if there is an issue with your cached paths. I presume it is working perfectly fine for entities that don’t have .?

1 Like

It is working for paths without a period.

What is the lifespan of the cache path? Is it something I should managing, to be safe?

Ah, crap, I think you’re right. I restarted the Shotgun Desktop App and now it’s working.

I failed the first test of Computer Engineering. I didn’t try turning it off and on again. :stuck_out_tongue:

1 Like