def login_decorator(func):
 def wrap(provider, *args, **kwargs):
  error = None
  result = authomatic.core.LoginResult(provider)
  try:
   func(provider, *args, **kwargs)
  except Exception as e:
   if provider.settings.report_errors:
    error = e
    provider._log(logging.ERROR, u'Reported suppressed exception: {0}!'.format(repr(error)))
   else:
    if provider.settings.debug:
     provider.write(_error_traceback_html(sys.exc_info(), traceback.format_exc()))
    raise
  if (provider.user or error):
   result = authomatic.core.LoginResult(provider)
   result.error = error
   if isinstance(provider.session, authomatic.core.Session):
    provider.session.delete()
   provider._log(logging.INFO, u'Procedure finished.')
   if provider.callback:
    provider.callback(result)
   return result
  else:
   provider.save_session()
 return wrap

def login_decorator ( func ) : def wrap ( provider , * args , ** kwargs ) : error = None result = authomatic . core . LoginResult ( provider ) try : func ( provider , * args , ** kwargs ) except Exception as e : if provider . settings . report_errors : error = e provider . _log ( logging . ERROR , u'Reported suppressed exception: {0}!' . format ( repr ( error ) ) ) else : if provider . settings . debug : provider . write ( _error_traceback_html ( sys . exc_info ( ) , traceback . format_exc ( ) ) ) raise if ( provider . user or error ) : result = authomatic . core . LoginResult ( provider ) result . error = error if isinstance ( provider . session , authomatic . core . Session ) : provider . session . delete ( ) provider . _log ( logging . INFO , u'Procedure finished.' ) if provider . callback : provider . callback ( result ) return result else : provider . save_session ( ) return wrap
decorate the :meth: .