<s> from functools import wraps <EOL> from django . http import HttpResponseRedirect <EOL> from . utils import get_dropbox_auth_flow <EOL> from . views import DROPBOX_ACCESS_TOKEN <EOL> def require_dropbox_session ( next_url = None ) : <EOL> """<STR_LIT>""" <EOL> def decorator ( view_func ) : <EOL> @ wraps ( view_func ) <EOL> def inner ( request , * args , ** kwargs ) : <EOL> if not request . session . get ( DROPBOX_ACCESS_TOKEN , None ) : <EOL> url = '<STR_LIT:/>' <EOL> if hasattr ( next_url , '<STR_LIT>' ) : <EOL> url = next_url ( request , * args , ** kwargs ) <EOL> elif next_url : <EOL> url = next_url <EOL> request . session [ '<STR_LIT>' ] = url <EOL> authorize_url = get_dropbox_auth_flow ( request . session ) . start ( ) <EOL> return HttpResponseRedirect ( authorize_url ) <EOL> return view_func ( request , * args , ** kwargs ) <EOL> return inner <EOL> return decorator </s>
