Opened 9 years ago
Closed 9 years ago
#5339 closed defect (fixed)
urlparse fails
Reported by: | ayleph | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | programming | Keywords: | api, feed, pump |
Cc: | Parent Tickets: |
Description
Running latest master on python2.7, media uploads via pump clients fail when attempting to reach the feed URL.
From sapienTech's pypump logs:
In[2]: myimage = pump.Image(display_name='Test from PyPumpShell') In [2]: myimage.from_file('/home/user/Desktop/MediaGoblinApp/goblinoid/images/newman.jpg') --------------------------------------------------------------------------- PyPumpException Traceback (most recent call last) /home/user/Documents/2015_summer/MediaGoblin/PyPump/pypump-shell in <module>() ----> 1 myimage.from_file('/home/user/Desktop/MediaGoblinApp/goblinoid/images/newman.jpg') /home/user/Documents/2015_summer/MediaGoblin/PyPump/pypump/models/image.pyc in from_file(self, filename) 119 self._post_activity(data) 120 else: --> 121 self._post_activity(data, unserialize=False) 122 123 # update image with display_name and content /home/user/Documents/2015_summer/MediaGoblin/PyPump/pypump/models/__init__.pyc in _post_activity(self, activity, unserialize) 105 ) 106 --> 107 data = self._pump.request(feed_url, method="POST", data=activity) 108 109 if not data: /home/user/Documents/2015_summer/MediaGoblin/PyPump/pypump/pypump.pyc in request(self, endpoint, method, data, raw, params, retries, client, headers, timeout, **kwargs) 339 ) 340 --> 341 raise PyPumpException(error) 342 343 def _requester(self, fnc, endpoint, raw=False, **kwargs): PyPumpException: Request Failed to https://pump.goblinrefuge.com/api/user/sapientech/feed (response: <html> <head> <title>Server Error</title> </head> <body> <h1>Server Error</h1> <div style="text-align:center;font-family: monospace"> <h1>YEOWCH... that's an error!</h1> <pre> .-------------------------. | __ _ | | -, \_,------,_// | | <\ ,-- --.\ | | / (x ) ( X ) | | ' '--, ,--'\ | | / \ -v-v-u-v / | | . '.__.--__'.\ | | / ',___/ / \__/' | | | | ,'\_'/, || | | \_| | | | | || | | W',_ ||| |||_'' | | | '------'| | | |__| |_|_ | | ,,,-' '-,,, | '-------------------------' </pre> <p>Sorry, our goblins had a little too much to drink.</p> <p>You may want to <a href="mailto:goblinpolice@goblinrefuge.com?Subject=Goblin%20Error" target="_top">alert the Goblin Police</a> and let them know what happened.</p> </div> </body> </html> | status: 500)
From goblinrefuge.com server logs:
Error - <type 'exceptions.AttributeError'>: 'function' object has no attribute 'urlparse' URL: https://pump.goblinrefuge.com/api/user/sapientech/feed File '/path/to/mediagoblin/lib/python2.7/site-packages/Paste-1.7.5.1-py2.7.egg/paste/exceptions/errormiddleware.py', line 144 in __call__ app_iter = self.application(environ, sr_checker) File '/path/to/mediagoblin/mediagoblin/app.py', line 342 in __call__ return self.call_backend(environ, start_response) File '/path/to/mediagoblin/lib/python2.7/site-packages/Werkzeug-0.10.1-py2.7.egg/werkzeug/wsgi.py', line 591 in __call__ return self.app(environ, start_response) File '/path/to/mediagoblin/mediagoblin/app.py', line 276 in call_backend return self._finish_call_backend(request, environ, start_response) File '/path/to/mediagoblin/mediagoblin/app.py', line 318 in _finish_call_backend response = controller(request) File '/path/to/mediagoblin/mediagoblin/decorators.py', line 427 in wrapper return controller(request, *args, **kwargs) File '/path/to/mediagoblin/mediagoblin/api/views.py', line 291 in feed_endpoint urlmap=request.app.url_map File '/path/to/mediagoblin/mediagoblin/tools/routing.py', line 83 in extract_url_arguments parsed_url = urlparse.urlparse(url) AttributeError: 'function' object has no attribute 'urlparse' CGI Variables ------------- CONTENT_LENGTH: '1284' CONTENT_TYPE: 'application/json' CSRF_TOKEN: '3243560790715536161' DOCUMENT_ROOT: sanitized GATEWAY_INTERFACE: 'CGI/1.1' HTTPS: 'on' HTTP_ACCEPT: '*/*' HTTP_ACCEPT_ENCODING: 'gzip, deflate' HTTP_AUTHORIZATION: sanitized HTTP_CONNECTION: 'keep-alive' HTTP_CONTENT_LENGTH: '1284' HTTP_HOST: 'pump.goblinrefuge.com' HTTP_USER_AGENT: 'python-requests/2.7.0 CPython/2.7.6 Linux/3.13.0-53-lowlatency' PATH_INFO: '/api/user/sapientech/feed' PATH_TRANSLATED: sanitized REDIRECT_STATUS: '200' REMOTE_ADDR: '127.0.0.1' REMOTE_PORT: '48098' REQUEST_METHOD: 'POST' REQUEST_URI: '/api/user/sapientech/feed' SCRIPT_FILENAME: sanitized SERVER_ADDR: '127.0.0.1' SERVER_NAME: 'pump.goblinrefuge.com' SERVER_PORT: '8443' SERVER_PROTOCOL: 'HTTP/1.1' SERVER_SOFTWARE: 'lighttpd/1.4.35' WSGI Variables -------------- application: <mediagoblin.app.MediaGoblinApp object at 0x7fcf00776190> paste.throw_errors: True werkzeug.request: <Request 'https://pump.goblinrefuge.com/api/user/sapientech/feed' [POST]> wsgi process: 'Multiprocess' ------------------------------------------------------------
Change History (5)
comment:1 by , 9 years ago
Cc: | added |
---|
comment:3 by , 9 years ago
Judging by the deletion of test code, it looks like activity.get_object
was removed sometime around 2d73983.
commit 2d73983e8ca353f47ad25642e1e0c292d94b20d5 Author: Jessica Tallon <> Date: Mon May 25 17:22:32 2015 +0200 Fix some problems with activity mixins and migrations ... --- a/mediagoblin/tests/test_modelmethods.py +++ b/mediagoblin/tests/test_modelmethods.py @@ -232,55 +232,3 @@ class TestUserUrlForSelf(MGClientTestCase): self.user(u'lindsay').url_for_self(fake_urlgen()) assert excinfo.errisinstance(TypeError) assert 'object is not callable' in str(excinfo) - -class TestActivitySetGet(object): - """ Test methods on the Activity and ActivityIntermediator models """ - - @pytest.fixture(autouse=True) - def setup(self, test_app): - self.app = test_app - self.user = fixture_add_user() - self.obj = fixture_media_entry() - self.target = fixture_media_entry() - - def test_set_activity_object(self): - """ Activity.set_object should produce ActivityIntermediator """ - # The fixture will set self.obj as the object on the activity. - activity = fixture_add_activity(self.obj, actor=self.user) - - # Assert the media has been associated with an AI - assert self.obj.activity is not None - - # Assert the AI on the media and object are the same - assert activity.object == self.obj.activity - - def test_activity_set_target(self): - """ Activity.set_target should produce ActivityIntermediator """ - # This should set everything needed on the target - activity = fixture_add_activity(self.obj, actor=self.user) - activity.set_target(self.target) - - # Assert the media has been associated with the AI - assert self.target.activity is not None - - # assert the AI on the media and target are the same - assert activity.target == self.target.activity - - def test_get_activity_object(self): - """ Activity.get_object should return a set object """ - activity = fixture_add_activity(self.obj, actor=self.user) - - print("self.obj.activity = {0}".format(self.obj.activity)) - - # check we now can get the object - assert activity.get_object is not None - assert activity.get_object.id == self.obj.id - - def test_get_activity_target(self): - """ Activity.set_target should return a set target """ - activity = fixture_add_activity(self.obj, actor=self.user) - activity.set_target(self.target) - - # check we can get the target - assert activity.get_target is not None - assert activity.get_target.id == self.target.id ...
edit: removed email addresses
comment:4 by , 9 years ago
I've fixed the import problem in http://git.savannah.gnu.org/cgit/mediagoblin.git/commit/?id=750ddf32b5b0f9845ee7d4bb70171d9ff8170a0c (master) and http://git.savannah.gnu.org/cgit/mediagoblin.git/commit/?h=stable&id=e2a8d303071dc3701436a8a28701e4659ddf5784 (stable).
Thanks for noticing this, ayleph!
comment:5 by , 9 years ago
Cc: | removed |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Summary: | API feed request fails → urlparse fails |
This ticket ended up having multiple issues. I'm going to split it. Since berker has already solved the urlparse issue, I'll rename this ticket to something about urlparse and close it. I'll open a new ticket for the API feed issue.
Here are some notes from investigation.
I had six==1.9.0 installed on my system. I tried reverting back to six==1.5.2 (which used to be pinned in setup.py), but that didn't make a difference.
I tried reverting 39da994, but now I get a different error: