Skip to content

Commit

Permalink
Merge efac376 into b5180be
Browse files Browse the repository at this point in the history
  • Loading branch information
barbara-darkshot committed Oct 24, 2019
2 parents b5180be + efac376 commit baf4dbb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 7 additions & 5 deletions hooks/publish_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,16 +376,17 @@ def publish(self, settings, item):
publish_name = self.get_publish_name(settings, item)
publish_version = self.get_publish_version(settings, item)
publish_path = self.get_publish_path(settings, item)
publish_dependencies = self.get_publish_dependencies(settings, item)
publish_dependencies_paths = self.get_publish_dependencies(settings, item)
publish_user = self.get_publish_user(settings, item)
publish_fields = self.get_publish_fields(settings, item)
# catch-all for any extra kwargs that should be passed to register_publish.
publish_kwargs = self.get_publish_kwargs(settings, item)

# if the parent item has a publish path, include it in the list of
# if the parent item has publish data, get it id to include it in the list of
# dependencies
if "sg_publish_path" in item.parent.properties:
publish_dependencies.append(item.parent.properties.sg_publish_path)
publish_dependencies_ids = []
if "sg_publish_data" in item.parent.properties:
publish_dependencies_ids.append(item.parent.properties.sg_publish_data["id"])

# handle copying of work to publish if templates are in play
self._copy_work_to_publish(settings, item)
Expand All @@ -402,7 +403,8 @@ def publish(self, settings, item):
"version_number": publish_version,
"thumbnail_path": item.get_thumbnail_as_path(),
"published_file_type": publish_type,
"dependency_paths": publish_dependencies,
"dependency_paths": publish_dependencies_paths,
"dependency_ids": publish_dependencies_ids,
"sg_fields": publish_fields
}

Expand Down
2 changes: 2 additions & 0 deletions tests/test_basic_publish_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def test_publish(self):
}
item_dict = {"description": "description value", "thumbnail_path": "thumbnail_path value"}
parent = self.PublishItem("blah", "blah", "blah")
parent.properties.sg_publish_data = {"type": "PublishedFile", "id": 32}
publish_item = self.PublishItem("baz", "baz", "baz")
publish_item._parent = parent
publish_item._global_properties = self.PublishData.from_dict(global_props_dict)
Expand All @@ -107,6 +108,7 @@ def test_publish(self):
"thumbnail_path": item_dict["thumbnail_path"],
"published_file_type": global_props_dict["publish_type"],
"dependency_paths": global_props_dict["publish_dependencies"],
"dependency_ids": [32],
"sg_fields": global_props_dict["publish_fields"]
}
expected_kwargs.update(global_props_dict["publish_kwargs"])
Expand Down

0 comments on commit baf4dbb

Please sign in to comment.