Conversation
Added the ability to pass a dictionary as a publish path with `local_storage` ad `relative_path` values. Added unit tests for explicit local storage publishing.
barbara-darkshot
left a comment
There was a problem hiding this comment.
Hi @gplsteph !
I like this idea but I'd request some code changes.
Instead of using a dictionary to pass the local_storage to the register_publish() method, I'd introduce a new kwargs that I could then use in the _calc_path_cache() method called by _create_published_file() to be able to filter by root name
This will avoid to have duplicate piece of code and also, with some slight modifications, have the same behavior for the find_publish() method
https://github.com/shotgunsoftware/tk-core/blob/master/python/tank/util/shotgun/publish_creation.py#L250

https://github.com/shotgunsoftware/tk-core/blob/master/python/tank/util/shotgun/publish_creation.py#L303

https://github.com/shotgunsoftware/tk-core/blob/master/python/tank/util/shotgun/publish_creation.py#L519

https://github.com/shotgunsoftware/tk-core/blob/master/python/tank/util/shotgun/publish_creation.py#L803

https://github.com/shotgunsoftware/tk-core/blob/master/python/tank/util/shotgun/publish_creation.py#L822

This is how we could extend the find_publish() method to have the same behavior by specifying the local storage name

SG TK does its best to retrieve a
LocalStoragefrom a path for publishes, however there are many use cases where multiple storages could have the same root path on a platform, but different root paths for other platforms.A typical case is just having a drive letter on Windows, but different mount points for the other platforms, for example:
These changes allow to explicitly pass a
{ "local_storage", "relative_path"}as thepathparameter toregister_publishfor cases where these values are known in advance.Unit tests were added to cover the added feature.