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


Python Config.getInstance方法代码示例

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


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

示例1: _setMailText

# 需要导入模块: from Configuration import Config [as 别名]
# 或者: from Configuration.Config import getInstance [as 别名]
 def _setMailText(self):
     text = self.text
     if self.note:
         text = text + "Note: %s" % self.note
     if self.confSumary:
         #try:
             from MaKaC.common.output import outputGenerator
             from MaKaC.accessControl import AdminList, AccessWrapper
             import MaKaC.webinterface.urlHandlers as urlHandlers
             admin = AdminList().getInstance().getList()[0]
             aw = AccessWrapper()
             aw.setUser(admin)
             path = Config.getInstance().getStylesheetsDir()
             if os.path.exists("%s/text.xsl" % path):
                 stylepath = "%s/text.xsl" % path
             outGen = outputGenerator(aw)
             vars = { \
                     "modifyURL": urlHandlers.UHConferenceModification.getURL( self.conf ), \
                     "sessionModifyURLGen": urlHandlers.UHSessionModification.getURL, \
                     "contribModifyURLGen": urlHandlers.UHContributionModification.getURL, \
                     "subContribModifyURLGen":  urlHandlers.UHSubContribModification.getURL, \
                     "materialURLGen": urlHandlers.UHMaterialDisplay.getURL, \
                     "resourceURLGen": urlHandlers.UHFileAccess.getURL }
             confText = outGen.getOutput(self.conf,stylepath,vars)
             text += "\n\n\n" + confText
         #except:
         #    text += "\n\n\nSorry could not embed text version of the agenda..."
     self.mail.setText(text)
开发者ID:bubbas,项目名称:indico,代码行数:30,代码来源:timerExec.py

示例2: getCSSPath

# 需要导入模块: from Configuration import Config [as 别名]
# 或者: from Configuration.Config import getInstance [as 别名]
 def getCSSPath(self, stylesheet):
     if stylesheet.strip() != "":
         basepath = Config.getInstance().getHtdocsDir()
         path = os.path.join(basepath, "css", "%s.css" % stylesheet)
         if os.path.exists(path):
             return path
     return ""
开发者ID:lukasnellen,项目名称:indico,代码行数:9,代码来源:info.py

示例3: getXSLPath

# 需要导入模块: from Configuration import Config [as 别名]
# 或者: from Configuration.Config import getInstance [as 别名]
 def getXSLPath(self, stylesheet):
     if stylesheet.strip() != "":
         basepath = Config.getInstance().getStylesheetsDir()
         path = os.path.join(basepath, "%s.xsl" % stylesheet)
         if os.path.exists(path):
             return path
     return ""
开发者ID:lukasnellen,项目名称:indico,代码行数:9,代码来源:info.py

示例4: prerun

# 需要导入模块: from Configuration import Config [as 别名]
# 或者: from Configuration.Config import getInstance [as 别名]
    def prerun(self):
        # Date checkings...
        from MaKaC.conference import ConferenceHolder
        if not ConferenceHolder().hasKey(self.conf.getId()) or \
                self.conf.getStartDate() <= nowutc():
            self.conf.removeAlarm(self)
            return True
        # Email
        self.setSubject("Event reminder: %s"%self.conf.getTitle())
        try:
            locationText = self.conf.getLocation().getName()
            if self.conf.getLocation().getAddress() != "":
                locationText += ", %s" % self.conf.getLocation().getAddress()
            if self.conf.getRoom().getName() != "":
                locationText += " (%s)" % self.conf.getRoom().getName()
        except:
            locationText = ""
        if locationText != "":
            locationText = i18nformat(""" _("Location"): %s""") % locationText

        if self.getToAllParticipants() :
            for p in self.conf.getParticipation().getParticipantList():
                self.addToUser(p)

        from MaKaC.webinterface import urlHandlers
        if Config.getInstance().getShortEventURL() != "":
            url = "%s%s" % (Config.getInstance().getShortEventURL(),self.conf.getId())
        else:
            url = urlHandlers.UHConferenceDisplay.getURL( self.conf )
        self.setText("""Hello,
    Please note that the event "%s" will start on %s (%s).
    %s

    You can access the full event here:
    %s

Best Regards

    """%(self.conf.getTitle(),\
                self.conf.getAdjustedStartDate().strftime("%A %d %b %Y at %H:%M"),\
                self.conf.getTimezone(),\
                locationText,\
                url,\
                ))
        self._setMailText()
        return False
开发者ID:bubbas,项目名称:indico,代码行数:48,代码来源:timerExec.py

示例5: _connect

# 需要导入模块: from Configuration import Config [as 别名]
# 或者: from Configuration.Config import getInstance [as 别名]
    def _connect(self):
        # Maybe we already have a client in this instance
        if self._client is not None:
            return
        # If not, we might have one from another instance
        self._client = ContextManager.get('GenericCacheClient', None)
        if self._client is not None:
            return
        # If not, create a new one
        backend = Config.getInstance().getCacheBackend()
        if backend == 'memcached':
            import memcache
            self._client = memcache.Client(Config.getInstance().getMemcachedServers())
        else:
            self._client = FileCacheClient(Config.getInstance().getXMLCacheDir())

        ContextManager.set('GenericCacheClient', self._client)
开发者ID:aninhalacerda,项目名称:indico,代码行数:19,代码来源:cache.py

示例6: getCachePath

# 需要导入模块: from Configuration import Config [as 别名]
# 或者: from Configuration.Config import getInstance [as 别名]
 def getCachePath( self ):
     path = os.path.join(Config.getInstance().getXMLCacheDir(),self._subDirName)
     if not os.path.exists(path):
         try:
             os.mkdir(path)
         except:
             pass
     return path
开发者ID:aninhalacerda,项目名称:indico,代码行数:10,代码来源:cache.py

示例7: __init__

# 需要导入模块: from Configuration import Config [as 别名]
# 或者: from Configuration.Config import getInstance [as 别名]
 def __init__(self):
     obj.__init__(self)
     self.fromAddr = ""
     self.toAddr = []
     self.toUser = []
     self.ccAddr = []
     self.subject = ""
     self.text = ""
     self.smtpServer = Config.getInstance().getSmtpServer()
开发者ID:bubbas,项目名称:indico,代码行数:11,代码来源:timerExec.py

示例8: _sendErrorEmail

# 需要导入模块: from Configuration import Config [as 别名]
# 或者: from Configuration.Config import getInstance [as 别名]
    def _sendErrorEmail(self, e):
        ty, ex, tb = sys.exc_info()
        tracebackList = traceback.format_list( traceback.extract_tb( tb ) )
        sm = sendMail()
        sm.setFromAddr(Config.getInstance().getSupportEmail())
        sm.addToAddr(Config.getInstance().getSupportEmail())
        sm.setSubject("[Indico] Error running a task")
        sm.setText("""

                    - Details of the exception:
                        %s

                    - Traceback:

                        %s

                    --

                    <Indico support> indico-project @ cern.ch
                    """%(e, "\n".join( tracebackList )) )
        sm.run()
开发者ID:bubbas,项目名称:indico,代码行数:23,代码来源:timerExec.py

示例9: getBaseTPLPath

# 需要导入模块: from Configuration import Config [as 别名]
# 或者: from Configuration.Config import getInstance [as 别名]
 def getBaseTPLPath(self):
     tplDir = Config.getInstance().getTPLDir()
     return os.path.join(tplDir, "events")
开发者ID:vstitches,项目名称:indico,代码行数:5,代码来源:info.py

示例10: __init__

# 需要导入模块: from Configuration import Config [as 别名]
# 或者: from Configuration.Config import getInstance [as 别名]
 def __init__( self ):
     self._styles = Config.getInstance().getStyles()
     self._eventStylesheets = Config.getInstance().getEventStylesheets()
     self._defaultEventStylesheet = Config.getInstance().getDefaultEventStylesheet()
开发者ID:vstitches,项目名称:indico,代码行数:6,代码来源:info.py

示例11: getStyles

# 需要导入模块: from Configuration import Config [as 别名]
# 或者: from Configuration.Config import getInstance [as 别名]
 def getStyles(self):
     try:
         return self._styles
     except AttributeError:
         self._styles = Config.getInstance().getStyles()
         return self._styles
开发者ID:vstitches,项目名称:indico,代码行数:8,代码来源:info.py

示例12: new

# 需要导入模块: from Configuration import Config [as 别名]
# 或者: from Configuration.Config import getInstance [as 别名]
 def new(cls, *args, **kwargs):
     backend = Config.getInstance().getCacheBackend()
     storageCls = cls.__CACHE_STORAGE_LIST.get(backend, cls.__CACHE_STORAGE_DEFAULT)
     return storageCls(*args, **kwargs)
开发者ID:aninhalacerda,项目名称:indico,代码行数:6,代码来源:cache.py

示例13: _connect

# 需要导入模块: from Configuration import Config [as 别名]
# 或者: from Configuration.Config import getInstance [as 别名]
 def _connect(self):
     client = redis.StrictRedis.from_url(Config.getInstance().getRedisCacheURL())
     client.connection_pool.connection_kwargs['socket_timeout'] = 1
     return client
开发者ID:iason-andr,项目名称:indico,代码行数:6,代码来源:cache.py

示例14: recover

# 需要导入模块: from Configuration import Config [as 别名]
# 或者: from Configuration.Config import getInstance [as 别名]
 def recover(self):
     self.smtpServer = Config.getInstance().getSmtpServer()
     TrashCanManager().remove(self)
开发者ID:bubbas,项目名称:indico,代码行数:5,代码来源:timerExec.py

示例15: __init__

# 需要导入模块: from Configuration import Config [as 别名]
# 或者: from Configuration.Config import getInstance [as 别名]
 def __init__(self, cache):
     super(FileCacheStorage, self).__init__(cache)
     self._dir = os.path.join(Config.getInstance().getXMLCacheDir(), self._name)
     if not os.path.exists(self._dir):
         os.makedirs(self._dir)
开发者ID:aninhalacerda,项目名称:indico,代码行数:7,代码来源:cache.py


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