本文整理汇总了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
示例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