trivial: Use swob date-header helpers more

Related-Change: Ia7c619fe563ab89ff5b1beb03219e763a8798cc9
Change-Id: I91723b349df5cec409ef000f0a397e180a9de7a2
Signed-off-by: Tim Burke <tim.burke@gmail.com>
This commit is contained in:
Tim Burke
2025年11月24日 13:14:23 -08:00
committed by Matthew Oliver
parent 96e7db0b3e
commit 41376fca5d

View File

@@ -300,7 +300,7 @@ __all__ = ['TempURL', 'filter_factory',
from calendar import timegm
from os.path import basename
from time import time, strftime, strptime, gmtime
from time import time, strptime
from ipaddress import ip_address, ip_network
from urllib.parse import parse_qs, urlencode
@@ -311,7 +311,7 @@ from swift.common.http import is_success
from swift.common.digest import get_allowed_digests, \
extract_digest_and_algorithm, DEFAULT_ALLOWED_DIGESTS, get_hmac
from swift.common.swob import header_to_environ_key, HTTPUnauthorized, \
HTTPBadRequest, wsgi_to_str
HTTPBadRequest, wsgi_to_str, date_header_format
from swift.common.utils import split_path, \
streq_const_time, quote, get_logger, close_if_possible
from swift.common.registry import register_swift_info, register_sensitive_param
@@ -688,9 +688,9 @@ class TempURL(object):
out_headers.append(('Content-Disposition', value))
# include Expires header for better cache-control
out_headers.append(('Expires', strftime(
"%a, %d%b %Y %H:%M:%S GMT",
gmtime(temp_url_expires))))
out_headers.append((
'Expires',
date_header_format(temp_url_expires)))
ctx._response_headers = out_headers
start_response(
ctx._response_status,

View File

@@ -242,7 +242,7 @@ from swift.common.http import (
is_success, is_client_error, HTTP_NOT_FOUND)
from swift.common.swob import HTTPPreconditionFailed, HTTPServiceUnavailable, \
HTTPServerError, HTTPBadRequest, str_to_wsgi, bytes_to_wsgi, wsgi_quote, \
wsgi_unquote
wsgi_unquote, DATE_HEADER_FORMAT_STRING
from swift.common.exceptions import (
ListingIterNotFound, ListingIterError)
@@ -461,7 +461,7 @@ class VersionedWritesContext(WSGIContext):
'x-timestamp',
calendar.timegm(time.strptime(
get_resp.headers['last-modified'],
'%a, %d%b %Y %H:%M:%S GMT')))
DATE_HEADER_FORMAT_STRING)))
vers_obj_name = self._build_versions_object_name(
object_name, ts_source)

View File

@@ -164,7 +164,7 @@ from swift.common.swob import HTTPPreconditionFailed, HTTPServiceUnavailable, \
HTTPBadRequest, str_to_wsgi, bytes_to_wsgi, wsgi_quote, \
wsgi_to_str, wsgi_unquote, Request, HTTPNotFound, HTTPException, \
HTTPRequestEntityTooLarge, HTTPInternalServerError, HTTPNotAcceptable, \
HTTPConflict, HTTPLengthRequired
HTTPConflict, HTTPLengthRequired, DATE_HEADER_FORMAT_STRING
from swift.common.storage_policy import POLICIES
from swift.common.utils import get_logger, Timestamp, drain_and_close, \
config_true_value, close_if_possible, closing_if_possible, \
@@ -449,7 +449,7 @@ class ObjectContext(ObjectVersioningContext):
'x-timestamp',
calendar.timegm(time.strptime(
get_resp.headers['last-modified'],
'%a, %d%b %Y %H:%M:%S GMT')))
DATE_HEADER_FORMAT_STRING)))
vers_obj_name = self._build_versions_object_name(
object_name, ts_source)
Reference in New Issue
openstack/swift
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.

The note is not visible to the blocked user.