Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

发Post时带附件会出现502错误 #10

Open
zonyitoo opened this issue Oct 30, 2013 · 1 comment
Open

发Post时带附件会出现502错误 #10

zonyitoo opened this issue Oct 30, 2013 · 1 comment
Labels

Comments

@zonyitoo
Copy link
Owner

重现:100%

重现步骤

  1. server/test/test_post.py:97,去掉注释
  2. server目录下运行python test/test_post.py

服务器Log

======================================================================
ERROR: test_POST_topic (__main__.TestPost)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_post.py", line 101, in test_POST_topic
    data=json.dumps(data)
  File "/home/zonyitoo/workspace/sysubbs-apiserver/venv/lib/python2.7/site-packages/werkzeug/test.py", line 771, in post
    return self.open(*args, **kw)
  File "/home/zonyitoo/workspace/sysubbs-apiserver/venv/lib/python2.7/site-packages/flask/testing.py", line 108, in open
    follow_redirects=follow_redirects)
  File "/home/zonyitoo/workspace/sysubbs-apiserver/venv/lib/python2.7/site-packages/werkzeug/test.py", line 735, in open
    response = self.run_wsgi_app(environ, buffered=buffered)
  File "/home/zonyitoo/workspace/sysubbs-apiserver/venv/lib/python2.7/site-packages/werkzeug/test.py", line 658, in run_wsgi_app
    rv = run_wsgi_app(self.application, environ, buffered=buffered)
  File "/home/zonyitoo/workspace/sysubbs-apiserver/venv/lib/python2.7/site-packages/werkzeug/test.py", line 854, in run_wsgi_app
    app_iter = app(environ, start_response)
  File "/home/zonyitoo/workspace/sysubbs-apiserver/venv/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/zonyitoo/workspace/sysubbs-apiserver/venv/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/zonyitoo/workspace/sysubbs-apiserver/venv/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/zonyitoo/workspace/sysubbs-apiserver/venv/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/zonyitoo/workspace/sysubbs-apiserver/venv/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/zonyitoo/workspace/sysubbs-apiserver/venv/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/zonyitoo/workspace/sysubbs-apiserver/venv/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/zonyitoo/workspace/sysubbs-apiserver/venv/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "../server/basic/auth.py", line 291, in decorated
    return func(*args, **kwargs)
  File "../server/handler/jbs/post_handler.py", line 197, in update_post
    ret = self.__processor__.update_post(**data)
  File "../server/processor/jbs/postprocessor.py", line 109, in update_post
    return self.__add_post('update', boardname, id, title, content, attachment)
  File "../server/processor/jbs/postprocessor.py", line 88, in __add_post
    resp = r.json()
  File "/home/zonyitoo/workspace/sysubbs-apiserver/venv/lib/python2.7/site-packages/requests/models.py", line 690, in json
    return json.loads(self.text or self.content, **kwargs)
  File "/usr/lib64/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python2.7/json/decoder.py", line 365, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python2.7/json/decoder.py", line 383, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

原因是server/processor/jbs/postprocessor.py:81处,返回的不是正常的JSON字符串,而是

<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/0.8.52</center>
</body>
</html>
@ragnraok
Copy link
Collaborator

Well, @ltaoist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants