<s> import math <EOL> from django . conf import settings <EOL> from django . contrib . auth import logout <EOL> from django import http <EOL> from django . utils . encoding import force_unicode <EOL> from django . utils . functional import lazy <EOL> from django . utils import translation <EOL> def _lazy_join ( separator , strings ) : <EOL> return separator . join ( [ force_unicode ( s ) <EOL> for s in strings ] ) <EOL> lazy_join = lazy ( _lazy_join , unicode ) <EOL> def bytes_to_gigabytes ( bytes ) : <EOL> return int ( math . ceil ( float ( bytes ) / <NUM_LIT> ** <NUM_LIT:3> ) ) <EOL> def add_logout_reason ( request , response , reason ) : <EOL> lang = translation . get_language_from_request ( request ) <EOL> with translation . override ( lang ) : <EOL> reason = unicode ( reason ) . encode ( '<STR_LIT:utf-8>' ) <EOL> response . set_cookie ( '<STR_LIT>' , reason , max_age = <NUM_LIT:30> ) <EOL> def logout_with_message ( request , msg ) : <EOL> """<STR_LIT>""" <EOL> logout ( request ) <EOL> response = http . HttpResponseRedirect ( <EOL> '<STR_LIT>' % ( settings . LOGOUT_URL , request . path ) ) <EOL> add_logout_reason ( request , response , msg ) <EOL> return response <EOL> def get_page_size ( request , default = <NUM_LIT:20> ) : <EOL> session = request . session <EOL> cookies = request . COOKIES <EOL> return int ( session . get ( '<STR_LIT>' , <EOL> cookies . get ( '<STR_LIT>' , <EOL> getattr ( settings , <EOL> '<STR_LIT>' , <EOL> default ) ) ) ) </s>
