functions.py (horizon-18.6.2) | : | functions.py (horizon-18.6.3) | ||
---|---|---|---|---|
skipping to change at line 42 | skipping to change at line 42 | |||
def bytes_to_gigabytes(bytes): | def bytes_to_gigabytes(bytes): | |||
# Converts the number of bytes to the next highest number of Gigabytes | # Converts the number of bytes to the next highest number of Gigabytes | |||
# For example 5000000 (5 Meg) would return '1' | # For example 5000000 (5 Meg) would return '1' | |||
return int(math.ceil(float(bytes) / units.Gi)) | return int(math.ceil(float(bytes) / units.Gi)) | |||
def add_logout_reason(request, response, reason, status='success'): | def add_logout_reason(request, response, reason, status='success'): | |||
# Store the translated string in the cookie | # Store the translated string in the cookie | |||
lang = translation.get_language_from_request(request) | lang = translation.get_language_from_request(request) | |||
with translation.override(lang): | with translation.override(lang): | |||
reason = str(reason) | reason = force_text(reason).encode('unicode_escape').decode('ascii') | |||
response.set_cookie('logout_reason', reason, max_age=10) | response.set_cookie('logout_reason', reason, max_age=10) | |||
response.set_cookie('logout_status', status, max_age=10) | response.set_cookie('logout_status', status, max_age=10) | |||
def logout_with_message(request, msg, redirect=True, status='success'): | def logout_with_message(request, msg, redirect=True, status='success'): | |||
"""Send HttpResponseRedirect to LOGOUT_URL. | """Send HttpResponseRedirect to LOGOUT_URL. | |||
`msg` is a message displayed on the login page after the logout, to explain | `msg` is a message displayed on the login page after the logout, to explain | |||
the logout reason. | the logout reason. | |||
""" | """ | |||
logout(request) | logout(request) | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added |