Fix a recursion bug when calling API.verify_credentials()
authorJoshua Roesslein <jroesslein@gmail.com>
Fri, 2 Apr 2010 21:00:12 +0000 (16:00 -0500)
committerJoshua Roesslein <jroesslein@gmail.com>
Fri, 2 Apr 2010 21:00:12 +0000 (16:00 -0500)
tweepy/binder.py

index 8ccd166701fff7a1f22737efd38b6103156349f7..b7ad993210e53414788e60801eebf0586d296f67 100644 (file)
@@ -81,20 +81,19 @@ 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('{}')
 
-                try:
-                    value = urllib.quote(self.parameters[name])
-                except KeyError:
-                    raise TweepError('No parameter value found for path variable: %s' % name)
-                del self.parameters[name]
+                if name == 'user' and 'user' not in self.parameters and self.api.auth:
+                    # No 'user' parameter provided, fetch it from Auth instead.
+                    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]
 
                 self.path = self.path.replace(variable, value)