def authentication_required(url, authenticator, abort_on):
 realm = authenticator.realm()
 if realm:
  msg = '<b>{}</b> says:<br/>{}'.format(html.escape(url.toDisplayString()), html.escape(realm))
 else:
  msg = '<b>{}</b> needs authentication'.format(html.escape(url.toDisplayString()))
 answer = message.ask(title='Authentication required', text=msg, mode=usertypes.PromptMode.user_pwd, abort_on=abort_on)
 if (answer is not None):
  authenticator.setUser(answer.user)
  authenticator.setPassword(answer.password)
 return answer

def authentication_required ( url , authenticator , abort_on ) : realm = authenticator . realm ( ) if realm : msg = '<b>{}</b> says:<br/>{}' . format ( html . escape ( url . toDisplayString ( ) ) , html . escape ( realm ) ) else : msg = '<b>{}</b> needs authentication' . format ( html . escape ( url . toDisplayString ( ) ) ) answer = message . ask ( title = 'Authentication required' , text = msg , mode = usertypes . PromptMode . user_pwd , abort_on = abort_on ) if ( answer is not None ) : authenticator . setUser ( answer . user ) authenticator . setPassword ( answer . password ) return answer
ask a prompt for an authentication question .