From 2d4bb8922c601f2de04174d2001816b73473919a Mon Sep 17 00:00:00 2001 From: Joshua Roesslein Date: Mon, 29 Mar 2010 09:45:42 -0500 Subject: [PATCH] Fix an issue where 'user' parameter value was getting overridden. This caused issues with lists_memberships() when trying to get memberships of an user besides the authenticated one. We now only set 'user' parameter to the authenticated user when no 'user' value is provided when calling the API method. --- tweepy/binder.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tweepy/binder.py b/tweepy/binder.py index f0de58f..8ccd166 100644 --- a/tweepy/binder.py +++ b/tweepy/binder.py @@ -81,18 +81,20 @@ def bind_api(**config): self.parameters[k] = convert_to_utf8_str(arg) + # Set 'user' paramter to the authenticated user's name + # if no 'user' parameter value provided + if(self.api.auth and 'user' not in self.parameters): + self.parameters['user'] = self.api.auth.get_username() + def build_path(self): for variable in re_path_template.findall(self.path): name = variable.strip('{}') - if name == 'user' and self.api.auth: - value = self.api.auth.get_username() - else: - try: - value = urllib.quote(self.parameters[name]) - except KeyError: - raise TweepError('No parameter value found for path variable: %s' % name) - del self.parameters[name] + try: + value = urllib.quote(self.parameters[name]) + except KeyError: + raise TweepError('No parameter value found for path variable: %s' % name) + del self.parameters[name] self.path = self.path.replace(variable, value) -- 2.25.1