Skip to content

Commit 72874c9

Browse files
committed
python 2.4 compatibility fix
1 parent 4decf77 commit 72874c9

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

shotgun_api3/shotgun.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def __init__(self, host, meta):
118118
#Store version as triple and check dev flag
119119
self.version = meta.get("version", None)
120120
if not self.version:
121-
raise ShotgunError("The Shotgun Server didn't respond with a version number. "
121+
raise ShotgunError("The Shotgun Server didn't respond with a version number. "
122122
"This may be because you are running an older version of "
123123
"Shotgun against a more recent version of the Shotgun API. "
124124
"For more information, please contact the Shotgun Support.")
@@ -1081,14 +1081,20 @@ def authenticate_human_user(self, user_login, user_password):
10811081
return data
10821082
else:
10831083
None
1084-
# Set back to default
1084+
# Set back to default - There finally and except cannot be used together in python2.4
10851085
self.config.user_login = None
10861086
self.config.user_password = None
1087-
10881087
except Fault:
1089-
# Set back to default
1088+
# Set back to default - There finally and except cannot be used together in python2.4
1089+
self.config.user_login = None
1090+
self.config.user_password = None
1091+
except:
1092+
# Set back to default - There finally and except cannot be used together in python2.4
10901093
self.config.user_login = None
10911094
self.config.user_password = None
1095+
raise
1096+
1097+
10921098

10931099

10941100
def _get_session_token(self):
@@ -1112,11 +1118,11 @@ def _build_opener(self, handler):
11121118
# handle proxy auth
11131119
if self.config.proxy_user and self.config.proxy_pass:
11141120
auth_string = "%s:%s@" % (self.config.proxy_user, self.config.proxy_pass)
1115-
else:
1121+
else:
11161122
auth_string = ""
11171123
proxy_addr = "http://%s%s:%d" % (auth_string, self.config.proxy_server, self.config.proxy_port)
11181124
proxy_support = urllib2.ProxyHandler({self.config.scheme : proxy_addr})
1119-
1125+
11201126
opener = urllib2.build_opener(proxy_support, handler)
11211127
else:
11221128
opener = urllib2.build_opener(handler)

0 commit comments

Comments
 (0)