def get_application(request): try: application = request.auth.application except: application = None return application