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


Python GetDataFolder.MessageCount方法代码示例

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


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

示例1: ChangeMonthCount

# 需要导入模块: from libDatabase import GetDataFolder [as 别名]
# 或者: from libDatabase.GetDataFolder import MessageCount [as 别名]
def ChangeMonthCount(objHere, intYear, intMonth, intIncrease = 1, blnPublicCount = False):
    objE3Messages = GetDataFolder(objHere, 'E3Messages')
    if blnPublicCount:
        lstMessageCount = objE3Messages.PublicMessageCount
    else:
        lstMessageCount = objE3Messages.MessageCount
    blnFound = False
    lstResult = []
    for strYearLine in lstMessageCount:
        if not blnFound and strYearLine[:4] == str(intYear):
            blnFound = True
            lstCounts = strYearLine.split()
            lstCounts[intMonth] = str(int(lstCounts[intMonth]) + intIncrease)
            strYearLine = " ".join(lstCounts)
        lstResult.append(strYearLine)
    if not blnFound:
        lstCounts = []
        for intI in range(0, 13):
            lstCounts.append("0")
        lstCounts[intMonth] = str(intIncrease)
        lstCounts[0] = str(intYear)
        lstResult.append(" ".join(lstCounts))
    if blnPublicCount:
        objE3Messages.PublicMessageCount = lstResult
    else:
        objE3Messages.MessageCount = lstResult
开发者ID:CoachCoen,项目名称:ECL,代码行数:28,代码来源:E3Messages.py

示例2: CountAllMessages

# 需要导入模块: from libDatabase import GetDataFolder [as 别名]
# 或者: from libDatabase.GetDataFolder import MessageCount [as 别名]
def CountAllMessages(objHere):
    """Counts number of messages by month/year, stores in E3Messages.MessageCount"""
    dtmNow = datetime.datetime.today()
    objMessages = GetDataFolder(objHere, 'E3Messages')
    lstLines = []
    for intYear in range(dtmNow.year, 1996, -1):
        strLine = str(intYear)
        for intMonth in range(1, 13):
            intCount = 0
            try:
                objMonth = objMessages.unrestrictedTraverse('%s/%s-%s' % (intYear, intYear, str(intMonth).zfill(2)))
            except:
                objMonth = None
            if objMonth:
                for objThread in objMonth.objectValues():
                    intCount = intCount + 1 + len(objThread.objectValues('Folder'))

            strLine = strLine + " " + str(intCount)
        lstLines.append(strLine)
    objMessages.MessageCount = lstLines
开发者ID:CoachCoen,项目名称:ECL,代码行数:22,代码来源:E3Messages.py


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