当前位置: 首页>>代码示例>>Python>>正文


Python GenericMailer.flushQueue方法代码示例

本文整理汇总了Python中MaKaC.webinterface.mail.GenericMailer.flushQueue方法的典型用法代码示例。如果您正苦于以下问题:Python GenericMailer.flushQueue方法的具体用法?Python GenericMailer.flushQueue怎么用?Python GenericMailer.flushQueue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MaKaC.webinterface.mail.GenericMailer的用法示例。


在下文中一共展示了GenericMailer.flushQueue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _process_retry_setup

# 需要导入模块: from MaKaC.webinterface.mail import GenericMailer [as 别名]
# 或者: from MaKaC.webinterface.mail.GenericMailer import flushQueue [as 别名]
 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()
开发者ID:NIIF,项目名称:indico,代码行数:12,代码来源:base.py

示例2: _process_success

# 需要导入模块: from MaKaC.webinterface.mail import GenericMailer [as 别名]
# 或者: from MaKaC.webinterface.mail.GenericMailer import flushQueue [as 别名]
 def _process_success(self):
     Logger.get('requestHandler').info('Request {} successful'.format(request))
     # request is succesfull, now, doing tasks that must be done only once
     try:
         flush_after_commit_queue(True)
         GenericMailer.flushQueue(True)  # send emails
         self._deleteTempFiles()
     except:
         Logger.get('mail').exception('Mail sending operation failed')
     # execute redis pipeline if we have one
     if self._redisPipeline:
         try:
             self._redisPipeline.execute()
         except RedisError:
             Logger.get('redis').exception('Could not execute pipeline')
开发者ID:NIIF,项目名称:indico,代码行数:17,代码来源:base.py

示例3: process

# 需要导入模块: from MaKaC.webinterface.mail import GenericMailer [as 别名]
# 或者: from MaKaC.webinterface.mail.GenericMailer import flushQueue [as 别名]
    def process( self, params ):
        """
        """
        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


        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 (%s)' % (os.getpid(),id(self._req), self._req.unparsed_uri))

        # notify components that the request has started
        self._notify('requestStarted', self._req)

        forcedConflicts = Config.getInstance().getForceConflicts()
        try:
            while retry>0:

                if retry < MAX_RETRIES:
                    # notify components that the request is being retried
                    self._notify('requestRetry', self._req, MAX_RETRIES - retry)

                try:
                    Logger.get('requestHandler').info('\t[pid=%s] from host %s' % (os.getpid(), self.getHostIP()))
                    try:
                        # clear the fossile cache at the start of each request
                        fossilize.clearCache()
                        # delete all queued emails
                        GenericMailer.flushQueue(False)

                        DBMgr.getInstance().sync()
                        # 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( self.getHostIP() )
                        self._aw.setSession(self._getSession())
                        #raise(str(dir(self._websession)))
                        self._setSessionUser()
                        self._setLang(params)
                        if self._getAuth():
                            if self._getUser():
                                Logger.get('requestHandler').info('Request %s identified with user %s (%s)' % (id(self._req), self._getUser().getFullName(), self._getUser().getId()))
                            if not self._tohttps and Config.getInstance().getAuthenticatedEnforceSecure():
                                self._tohttps = True
                                if self._checkHttpsRedirect():
                                    return

                        #if self._getUser() != None and self._getUser().getId() == "893":
                        #    profile = True
                        self._reqParams = copy.copy( params )
                        self._checkParams( self._reqParams )

                        self._checkProtection()
                        security.Sanitization.sanitizationCheck(self._target,
                                               self._reqParams,
                                               self._aw, self._doNotSanitizeFields)
                        if self._doProcess:
                            if profile:
                                import profile, pstats
                                proffilename = os.path.join(Config.getInstance().getTempDir(), "stone%s.prof" % str(random.random()))
                                result = [None]
                                profile.runctx("result[0] = self._process()", globals(), locals(), proffilename)
                                res = result[0]
                            else:
                                res = self._process()

                        # Save web session, just when needed
                        sm = session.getSessionManager()
                        sm.maintain_session(self._req, self._websession)

                        # notify components that the request has finished
                        self._notify('requestFinished', self._req)
                        # Raise a conflict error if enabled. This allows detecting conflict-related issues easily.
                        if retry > (MAX_RETRIES - forcedConflicts):
                            raise ConflictError
                        self._endRequestSpecific2RH( True ) # I.e. implemented by Room Booking request handlers
                        DBMgr.getInstance().endRequest( True )

                        Logger.get('requestHandler').info('Request %s successful' % (id(self._req)))
                        #request succesfull, now, doing tas that must be done only once
                        try:
                            GenericMailer.flushQueue(True) # send emails
                            self._deleteTempFiles()
                        except:
                            Logger.get('mail').exception('Mail sending operation failed')
                            pass
#.........这里部分代码省略.........
开发者ID:vstitches,项目名称:indico,代码行数:103,代码来源:base.py


注:本文中的MaKaC.webinterface.mail.GenericMailer.flushQueue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。