i18n finishup
This commit is contained in:
parent
0b3fac8992
commit
24590669d8
@ -16,7 +16,6 @@
|
|||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from random import random
|
from random import random
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
from swift.account import server as account_server
|
from swift.account import server as account_server
|
||||||
from swift.common.db import AccountBroker
|
from swift.common.db import AccountBroker
|
||||||
|
@ -18,7 +18,6 @@ import random
|
|||||||
from logging import DEBUG
|
from logging import DEBUG
|
||||||
from math import sqrt
|
from math import sqrt
|
||||||
from time import time
|
from time import time
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
from eventlet import GreenPool, sleep
|
from eventlet import GreenPool, sleep
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ import time
|
|||||||
import traceback
|
import traceback
|
||||||
from urllib import unquote
|
from urllib import unquote
|
||||||
from xml.sax import saxutils
|
from xml.sax import saxutils
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
from webob import Request, Response
|
from webob import Request, Response
|
||||||
from webob.exc import HTTPAccepted, HTTPBadRequest, \
|
from webob.exc import HTTPAccepted, HTTPBadRequest, \
|
||||||
|
@ -18,7 +18,6 @@ import time
|
|||||||
import random
|
import random
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
import eventlet.pools
|
import eventlet.pools
|
||||||
from eventlet.green.httplib import CannotSendRequest
|
from eventlet.green.httplib import CannotSendRequest
|
||||||
|
@ -29,7 +29,6 @@ BufferedHTTPResponse.
|
|||||||
from urllib import quote
|
from urllib import quote
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
from eventlet.green.httplib import CONTINUE, HTTPConnection, HTTPMessage, \
|
from eventlet.green.httplib import CONTINUE, HTTPConnection, HTTPMessage, \
|
||||||
HTTPResponse, HTTPSConnection, _UNKNOWN
|
HTTPResponse, HTTPSConnection, _UNKNOWN
|
||||||
|
@ -16,7 +16,9 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import signal
|
import signal
|
||||||
|
import gettext
|
||||||
from re import sub
|
from re import sub
|
||||||
|
|
||||||
from swift.common import utils
|
from swift.common import utils
|
||||||
|
|
||||||
|
|
||||||
@ -40,6 +42,7 @@ class Daemon(object):
|
|||||||
utils.validate_configuration()
|
utils.validate_configuration()
|
||||||
utils.capture_stdio(self.logger, **kwargs)
|
utils.capture_stdio(self.logger, **kwargs)
|
||||||
utils.drop_privileges(self.conf.get('user', 'swift'))
|
utils.drop_privileges(self.conf.get('user', 'swift'))
|
||||||
|
gettext.install('swift', unicode=1)
|
||||||
|
|
||||||
def kill_children(*args):
|
def kill_children(*args):
|
||||||
signal.signal(signal.SIGTERM, signal.SIG_IGN)
|
signal.signal(signal.SIGTERM, signal.SIG_IGN)
|
||||||
|
@ -27,7 +27,6 @@ import cPickle as pickle
|
|||||||
import errno
|
import errno
|
||||||
from random import randint
|
from random import randint
|
||||||
from tempfile import mkstemp
|
from tempfile import mkstemp
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
from eventlet import sleep
|
from eventlet import sleep
|
||||||
import simplejson as json
|
import simplejson as json
|
||||||
|
@ -20,7 +20,6 @@ import random
|
|||||||
import math
|
import math
|
||||||
import time
|
import time
|
||||||
import shutil
|
import shutil
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
from eventlet import GreenPool, sleep, Timeout
|
from eventlet import GreenPool, sleep, Timeout
|
||||||
from eventlet.green import subprocess
|
from eventlet.green import subprocess
|
||||||
|
@ -26,7 +26,6 @@ import socket
|
|||||||
import time
|
import time
|
||||||
from bisect import bisect
|
from bisect import bisect
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
CONN_TIMEOUT = 0.3
|
CONN_TIMEOUT = 0.3
|
||||||
IO_TIMEOUT = 2.0
|
IO_TIMEOUT = 2.0
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
from webob import Request
|
from webob import Request
|
||||||
from webob.exc import HTTPServerError
|
from webob.exc import HTTPServerError
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ import time
|
|||||||
import eventlet
|
import eventlet
|
||||||
from webob import Request, Response
|
from webob import Request, Response
|
||||||
from webob.exc import HTTPNotFound
|
from webob.exc import HTTPNotFound
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
from swift.common.utils import split_path, cache_from_env, get_logger
|
from swift.common.utils import split_path, cache_from_env, get_logger
|
||||||
from swift.proxy.server import get_container_memcache_key
|
from swift.proxy.server import get_container_memcache_key
|
||||||
|
@ -34,7 +34,6 @@ from ConfigParser import ConfigParser, NoSectionError, NoOptionError
|
|||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from tempfile import mkstemp
|
from tempfile import mkstemp
|
||||||
import cPickle as pickle
|
import cPickle as pickle
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
from eventlet import greenio, GreenPool, sleep, Timeout, listen
|
from eventlet import greenio, GreenPool, sleep, Timeout, listen
|
||||||
|
@ -21,6 +21,7 @@ import signal
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import mimetools
|
import mimetools
|
||||||
|
import gettext
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
from eventlet import greenio, GreenPool, sleep, wsgi, listen
|
from eventlet import greenio, GreenPool, sleep, wsgi, listen
|
||||||
@ -120,6 +121,7 @@ def run_wsgi(conf_file, app_section, *args, **kwargs):
|
|||||||
sock = get_socket(conf, default_port=kwargs.get('default_port', 8080))
|
sock = get_socket(conf, default_port=kwargs.get('default_port', 8080))
|
||||||
# remaining tasks should not require elevated privileges
|
# remaining tasks should not require elevated privileges
|
||||||
drop_privileges(conf.get('user', 'swift'))
|
drop_privileges(conf.get('user', 'swift'))
|
||||||
|
gettext.install('swift', unicode=1)
|
||||||
|
|
||||||
# finally after binding to ports and privilege drop, run app __init__ code
|
# finally after binding to ports and privilege drop, run app __init__ code
|
||||||
app = loadapp('config:%s' % conf_file, global_conf={'log_name': log_name})
|
app = loadapp('config:%s' % conf_file, global_conf={'log_name': log_name})
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from random import random
|
from random import random
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
from swift.container import server as container_server
|
from swift.container import server as container_server
|
||||||
from swift.common.db import ContainerBroker
|
from swift.common.db import ContainerBroker
|
||||||
|
@ -21,7 +21,6 @@ import traceback
|
|||||||
from urllib import unquote
|
from urllib import unquote
|
||||||
from xml.sax import saxutils
|
from xml.sax import saxutils
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
import simplejson
|
import simplejson
|
||||||
from eventlet.timeout import Timeout
|
from eventlet.timeout import Timeout
|
||||||
|
@ -19,7 +19,6 @@ import signal
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from random import random, shuffle
|
from random import random, shuffle
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
from eventlet import spawn, patcher, Timeout
|
from eventlet import spawn, patcher, Timeout
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ import os
|
|||||||
import time
|
import time
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
from random import random
|
from random import random
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
from swift.obj import server as object_server
|
from swift.obj import server as object_server
|
||||||
from swift.obj.replicator import invalidate_hash
|
from swift.obj.replicator import invalidate_hash
|
||||||
|
@ -22,7 +22,6 @@ import logging
|
|||||||
import hashlib
|
import hashlib
|
||||||
import itertools
|
import itertools
|
||||||
import cPickle as pickle
|
import cPickle as pickle
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
from eventlet import GreenPool, tpool, Timeout, sleep, hubs
|
from eventlet import GreenPool, tpool, Timeout, sleep, hubs
|
||||||
|
@ -26,7 +26,6 @@ from hashlib import md5
|
|||||||
from tempfile import mkstemp
|
from tempfile import mkstemp
|
||||||
from urllib import unquote
|
from urllib import unquote
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
from webob import Request, Response, UTC
|
from webob import Request, Response, UTC
|
||||||
from webob.exc import HTTPAccepted, HTTPBadRequest, HTTPCreated, \
|
from webob.exc import HTTPAccepted, HTTPBadRequest, HTTPCreated, \
|
||||||
|
@ -19,7 +19,6 @@ import signal
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from random import random
|
from random import random
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
from eventlet import patcher, Timeout
|
from eventlet import patcher, Timeout
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ from datetime import datetime
|
|||||||
from urllib import unquote, quote
|
from urllib import unquote, quote
|
||||||
import uuid
|
import uuid
|
||||||
import functools
|
import functools
|
||||||
from gettext import gettext as _
|
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
|
|
||||||
from eventlet import sleep
|
from eventlet import sleep
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
# See http://code.google.com/p/python-nose/issues/detail?id=373
|
||||||
|
# The code below enables nosetests to work with i18n _() blocks
|
||||||
|
|
||||||
|
import __builtin__
|
||||||
|
|
||||||
|
setattr(__builtin__, '_', lambda x: x)
|
||||||
|
|
@ -3019,8 +3019,8 @@ class TestSegmentedIterable(unittest.TestCase):
|
|||||||
self.assertRaises(Exception,
|
self.assertRaises(Exception,
|
||||||
proxy_server.SegmentedIterable(self.controller, None,
|
proxy_server.SegmentedIterable(self.controller, None,
|
||||||
[None])._load_next_segment)
|
[None])._load_next_segment)
|
||||||
self.assertEquals(self.controller.exception_args[0],
|
self.assert_(self.controller.exception_args[0].startswith(
|
||||||
'ERROR: While processing manifest /a/c/o tx1')
|
'ERROR: While processing manifest'))
|
||||||
|
|
||||||
def test_load_next_segment_with_no_segments(self):
|
def test_load_next_segment_with_no_segments(self):
|
||||||
self.assertRaises(StopIteration,
|
self.assertRaises(StopIteration,
|
||||||
@ -3079,8 +3079,8 @@ class TestSegmentedIterable(unittest.TestCase):
|
|||||||
self.assertRaises(Exception,
|
self.assertRaises(Exception,
|
||||||
proxy_server.SegmentedIterable(self.controller, 'lc', [{'name':
|
proxy_server.SegmentedIterable(self.controller, 'lc', [{'name':
|
||||||
'o1'}])._load_next_segment)
|
'o1'}])._load_next_segment)
|
||||||
self.assertEquals(self.controller.exception_args[0],
|
self.assert_(self.controller.exception_args[0].startswith(
|
||||||
'ERROR: While processing manifest /a/c/o tx1')
|
'ERROR: While processing manifest'))
|
||||||
self.assertEquals(str(self.controller.exception_info[1]),
|
self.assertEquals(str(self.controller.exception_info[1]),
|
||||||
'Could not load object segment /a/lc/o1: 404')
|
'Could not load object segment /a/lc/o1: 404')
|
||||||
|
|
||||||
@ -3088,8 +3088,8 @@ class TestSegmentedIterable(unittest.TestCase):
|
|||||||
# Iterator value isn't a dict
|
# Iterator value isn't a dict
|
||||||
self.assertRaises(Exception, ''.join,
|
self.assertRaises(Exception, ''.join,
|
||||||
proxy_server.SegmentedIterable(self.controller, None, [None]))
|
proxy_server.SegmentedIterable(self.controller, None, [None]))
|
||||||
self.assertEquals(self.controller.exception_args[0],
|
self.assert_(self.controller.exception_args[0].startswith(
|
||||||
'ERROR: While processing manifest /a/c/o tx1')
|
'ERROR: While processing manifest'))
|
||||||
|
|
||||||
def test_iter_with_no_segments(self):
|
def test_iter_with_no_segments(self):
|
||||||
segit = proxy_server.SegmentedIterable(self.controller, 'lc', [])
|
segit = proxy_server.SegmentedIterable(self.controller, 'lc', [])
|
||||||
@ -3118,8 +3118,8 @@ class TestSegmentedIterable(unittest.TestCase):
|
|||||||
self.assertRaises(Exception, ''.join,
|
self.assertRaises(Exception, ''.join,
|
||||||
proxy_server.SegmentedIterable(self.controller, 'lc', [{'name':
|
proxy_server.SegmentedIterable(self.controller, 'lc', [{'name':
|
||||||
'o1'}]))
|
'o1'}]))
|
||||||
self.assertEquals(self.controller.exception_args[0],
|
self.assert_(self.controller.exception_args[0].startswith(
|
||||||
'ERROR: While processing manifest /a/c/o tx1')
|
'ERROR: While processing manifest'))
|
||||||
self.assertEquals(str(self.controller.exception_info[1]),
|
self.assertEquals(str(self.controller.exception_info[1]),
|
||||||
'Could not load object segment /a/lc/o1: 404')
|
'Could not load object segment /a/lc/o1: 404')
|
||||||
|
|
||||||
@ -3128,8 +3128,8 @@ class TestSegmentedIterable(unittest.TestCase):
|
|||||||
self.assertRaises(Exception,
|
self.assertRaises(Exception,
|
||||||
proxy_server.SegmentedIterable(self.controller, None,
|
proxy_server.SegmentedIterable(self.controller, None,
|
||||||
[None]).app_iter_range(None, None).next)
|
[None]).app_iter_range(None, None).next)
|
||||||
self.assertEquals(self.controller.exception_args[0],
|
self.assert_(self.controller.exception_args[0].startswith(
|
||||||
'ERROR: While processing manifest /a/c/o tx1')
|
'ERROR: While processing manifest'))
|
||||||
|
|
||||||
def test_app_iter_range_with_no_segments(self):
|
def test_app_iter_range_with_no_segments(self):
|
||||||
self.assertEquals(''.join(proxy_server.SegmentedIterable(
|
self.assertEquals(''.join(proxy_server.SegmentedIterable(
|
||||||
|
Loading…
Reference in New Issue
Block a user