本文整理汇总了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