本文整理匯總了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
示例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