當前位置: 首頁>>代碼示例>>Python>>正文


Python GetDataFolder.PublicMessageCount方法代碼示例

本文整理匯總了Python中libDatabase.GetDataFolder.PublicMessageCount方法的典型用法代碼示例。如果您正苦於以下問題:Python GetDataFolder.PublicMessageCount方法的具體用法?Python GetDataFolder.PublicMessageCount怎麽用?Python GetDataFolder.PublicMessageCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在libDatabase.GetDataFolder的用法示例。


在下文中一共展示了GetDataFolder.PublicMessageCount方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: ChangeMonthCount

# 需要導入模塊: from libDatabase import GetDataFolder [as 別名]
# 或者: from libDatabase.GetDataFolder import PublicMessageCount [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: CountPublicMessages

# 需要導入模塊: from libDatabase import GetDataFolder [as 別名]
# 或者: from libDatabase.GetDataFolder import PublicMessageCount [as 別名]
def CountPublicMessages(objHere):
    """Counts number of public messages by month/year, stores in E3Messages.PublicMessageCount"""
    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():
                    if not objThread.Private:
                        intCount += 1
                    for objMessage in objThread.objectValues('Folder'):
                        if not objMessage.Private:
                            intCount += 1

            strLine = strLine + " " + str(intCount)
        lstLines.append(strLine)
    objMessages.PublicMessageCount = lstLines
開發者ID:CoachCoen,項目名稱:ECL,代碼行數:26,代碼來源:E3Messages.py


注:本文中的libDatabase.GetDataFolder.PublicMessageCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。