~ubuntu-branches/ubuntu/trusty/swift/trusty-updates

« back to all changes in this revision

Viewing changes to swift/proxy/controllers/base.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, James Page, Chuck Short
  • Date: 2013-08-13 10:37:13 UTC
  • mfrom: (1.2.21)
  • Revision ID: package-import@ubuntu.com-20130813103713-1ctbx4zifyljs2aq
Tags: 1.9.1-0ubuntu1
[ James Page ]
* d/control: Update VCS fields for new branch locations.

[ Chuck Short ]
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
import functools
30
30
import inspect
31
31
import itertools
 
32
from gettext import gettext as _
32
33
from urllib import quote
33
34
 
34
35
from eventlet import spawn_n, GreenPile
37
38
 
38
39
from swift.common.wsgi import make_pre_authed_env
39
40
from swift.common.utils import normalize_timestamp, config_true_value, \
40
 
    public, split_path, list_from_csv, GreenthreadSafeIterator
 
41
    public, split_path, list_from_csv, GreenthreadSafeIterator, \
 
42
    quorum_size
41
43
from swift.common.bufferedhttp import http_connect
42
44
from swift.common.exceptions import ChunkReadTimeout, ConnectionTimeout
43
45
from swift.common.http import is_informational, is_success, is_redirection, \
218
220
    Note: This call bypasses auth. Success does not imply that the
219
221
          request has authorization to the account.
220
222
    """
221
 
    (version, account, container, _) = \
 
223
    (version, account, container, unused) = \
222
224
        split_path(env['PATH_INFO'], 3, 4, True)
223
225
    info = get_info(app, env, account, container, ret_not_found=True)
224
226
    if not info:
749
751
            for hundred in (HTTP_OK, HTTP_MULTIPLE_CHOICES, HTTP_BAD_REQUEST):
750
752
                hstatuses = \
751
753
                    [s for s in statuses if hundred <= s < hundred + 100]
752
 
                if len(hstatuses) > len(statuses) / 2:
 
754
                if len(hstatuses) >= quorum_size(len(statuses)):
753
755
                    status = max(hstatuses)
754
756
                    status_index = statuses.index(status)
755
757
                    resp.status = '%s %s' % (status, reasons[status_index])