From a2db31dad58397c50706043a146e44f2bbdb728e Mon Sep 17 00:00:00 2001 From: Jesse Kretschmer Date: Mon, 10 Mar 2014 18:05:25 -0700 Subject: [PATCH] Added backwards compatability with strings get_attachment_download_url formerly allowed for strings. I just upgraded from 3.0.11 and noticed the difference. Here was a change the caused the api to expect an int: SHA: a4ae8de4cd2f01479499954b10ba3d2ef616fd9e --- shotgun_api3/shotgun.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) mode change 100755 => 100644 shotgun_api3/shotgun.py diff --git a/shotgun_api3/shotgun.py b/shotgun_api3/shotgun.py old mode 100755 new mode 100644 index 007ee5aa3..0181456f2 --- a/shotgun_api3/shotgun.py +++ b/shotgun_api3/shotgun.py @@ -1318,8 +1318,9 @@ def set_up_auth_cookie(self): def get_attachment_download_url(self, attachment): """Returns the URL for downloading provided Attachment. - :param attachment: (mixed) If type is an int, construct url to download - Attachment with id from Shotgun. + :param attachment: (mixed) If type is a str convert to int. + If type is an int, construct url to download Attachment with id from + Shotgun. If type is a dict, and a url key is present, use that url. If type is a dict, and url key is not present, check if we have an id and type keys and the type is 'Attachment' in which case we @@ -1335,6 +1336,8 @@ def get_attachment_download_url(self, attachment): attachment_id = None if isinstance(attachment, int): attachment_id = attachment + elif isinstance(attachment, str): + attachment_id = int(attachment) elif isinstance(attachment, dict): try: url = attachment['url']