本文整理匯總了Python中indico.web.flask.util.ResponseUtil.make_redirect方法的典型用法代碼示例。如果您正苦於以下問題:Python ResponseUtil.make_redirect方法的具體用法?Python ResponseUtil.make_redirect怎麽用?Python ResponseUtil.make_redirect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類indico.web.flask.util.ResponseUtil
的用法示例。
在下文中一共展示了ResponseUtil.make_redirect方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: RH
# 需要導入模塊: from indico.web.flask.util import ResponseUtil [as 別名]
# 或者: from indico.web.flask.util.ResponseUtil import make_redirect [as 別名]
#.........這裏部分代碼省略.........
""" TODO """
return errors.WPHtmlScriptError(self, escape(str(e))).display()
@jsonify_error
def _processHtmlForbiddenTag(self, e):
""" TODO """
return errors.WPRestrictedHTML(self, escape(str(e))).display()
def _process_retry_setup(self):
# clear the fossile cache at the start of each request
fossilize.clearCache()
# clear after-commit queue
flush_after_commit_queue(False)
# delete all queued emails
GenericMailer.flushQueue(False)
# clear the existing redis pipeline
if self._redisPipeline:
self._redisPipeline.reset()
def _process_retry_auth_check(self, params):
# keep a link to the web session in the access wrapper
# this is used for checking access/modification key existence
# in the user session
self._aw.setIP(request.remote_addr)
self._setSessionUser()
if self._getAuth():
if self._getUser():
Logger.get('requestHandler').info('Request %s identified with user %s (%s)' % (
request, self._getUser().getFullName(), self._getUser().getId()))
if not self._tohttps and Config.getInstance().getAuthenticatedEnforceSecure():
self._tohttps = True
if self._checkHttpsRedirect():
return self._responseUtil.make_redirect()
self._checkCSRF()
self._reqParams = copy.copy(params)
def _process_retry_do(self, profile):
profile_name, res = '', ''
try:
# old code gets parameters from call
# new code utilizes of flask.request
if len(inspect.getargspec(self._checkParams).args) < 2:
cp_result = self._checkParams()
else:
cp_result = self._checkParams(self._reqParams)
if isinstance(cp_result, (current_app.response_class, Response)):
return '', cp_result
func = getattr(self, '_checkParams_' + request.method, None)
if func:
cp_result = func()
if isinstance(cp_result, (current_app.response_class, Response)):
return '', cp_result
except NoResultFound: # sqlalchemy .one() not finding anything
raise NotFoundError(_('The specified item could not be found.'), title=_('Item not found'))
self._checkProtection()
func = getattr(self, '_checkProtection_' + request.method, None)
if func:
func()
security.Sanitization.sanitizationCheck(self._target,
示例2: RH
# 需要導入模塊: from indico.web.flask.util import ResponseUtil [as 別名]
# 或者: from indico.web.flask.util.ResponseUtil import make_redirect [as 別名]
#.........這裏部分代碼省略.........
def _processHtmlScriptError(self, e):
Logger.get('requestHandler').info('Request %s finished with ProcessHtmlScriptError: "%s"' % (request, e))
p=errors.WPHtmlScriptError(self, escape(str(e)))
return p.display()
def _processRestrictedHTML(self, e):
Logger.get('requestHandler').info('Request %s finished with ProcessRestrictedHTMLError: "%s"' % (request, e))
p=errors.WPRestrictedHTML(self, escape(str(e)))
return p.display()
def process(self, params):
if request.method not in self.HTTP_VERBS:
# Just to be sure that we don't get some crappy http verb we don't expect
raise BadRequest
profile = Config.getInstance().getProfile()
proffilename = ""
res = ""
MAX_RETRIES = 10
retry = MAX_RETRIES
textLog = []
self._startTime = datetime.now()
# clear the context
ContextManager.destroy()
ContextManager.set('currentRH', self)
#redirect to https if necessary
if self._checkHttpsRedirect():
return self._responseUtil.make_redirect()
DBMgr.getInstance().startRequest()
self._startRequestSpecific2RH() # I.e. implemented by Room Booking request handlers
textLog.append("%s : Database request started" % (datetime.now() - self._startTime))
Logger.get('requestHandler').info('[pid=%s] Request %s started' % (
os.getpid(), request))
# notify components that the request has started
self._notify('requestStarted')
forcedConflicts = Config.getInstance().getForceConflicts()
try:
while retry>0:
if retry < MAX_RETRIES:
# notify components that the request is being retried
self._notify('requestRetry', MAX_RETRIES - retry)
try:
Logger.get('requestHandler').info('\t[pid=%s] from host %s' % (os.getpid(), request.remote_addr))
try:
# clear the fossile cache at the start of each request
fossilize.clearCache()
# delete all queued emails
GenericMailer.flushQueue(False)
# clear the existing redis pipeline
if self._redisPipeline:
self._redisPipeline.reset()
DBMgr.getInstance().sync()
# keep a link to the web session in the access wrapper