本文整理汇总了Python中libDatabase.GetDataFolder.objectValues方法的典型用法代码示例。如果您正苦于以下问题:Python GetDataFolder.objectValues方法的具体用法?Python GetDataFolder.objectValues怎么用?Python GetDataFolder.objectValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libDatabase.GetDataFolder
的用法示例。
在下文中一共展示了GetDataFolder.objectValues方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: u30to31StorePastStats
# 需要导入模块: from libDatabase import GetDataFolder [as 别名]
# 或者: from libDatabase.GetDataFolder import objectValues [as 别名]
def u30to31StorePastStats(objContext, blnSkip = False):
""" Done as upgrade from 3.0 to 3.1
Gather data that is easy and reliable accessible:
* Payments
* Messages sent (advert/non-advert)
* Expiries
* Members joining"""
# Create empty dictionary (date:eventtype:count)
# Go through members, count events found
# Go through messages, count them
# Store results
# (notes: some records may already exists, if so add new properties, otherwise create new record)
if blnSkip:
print "Skipped: Get and store past statistics"
return
print "Get and store past statistics"
dictStats = {}
objMembers = GetDataFolder(objContext, 'E3Member')
for objBatch in objMembers.objectValues('Folder'):
for objMember in objBatch.objectValues('E3Member'):
# Check starting date
if objMember.ImportedFromMailman:
for objPeriod in objMember.FromMailman.objectValues('E3Period'):
if objPeriod.PeriodType == "Free":
AddPastStat(dictStats, objPeriod.GetStartDate(), "JoinedYesterday")
else:
AddPastStat(dictStats, objMember.GetCreatedDate(), "JoinedYesterday")
# Get payments
for objPayment in objMember.Historic.objectValues("E3Payment"):
AddPastStat(dictStats, objPayment.GetDate(), "PaymentYesterday")
for objEvent in objMember.Historic.objectValues("E3Event"):
if objEvent.EventType == "ExpiryMessageSent":
AddPastStat(dictStats, objEvent.GetDate(), "ExpiredYesterday")
# Now do the message count
objMessages = GetDataFolder(objContext, 'E3Messages')
for objYear in objMessages.objectValues('Folder'):
print objYear.id
for objMonth in objYear.objectValues('Folder'):
print objMonth.id
for objMessage in objMonth.objectValues('Folder'):
dtmDate = date(year = objMessage.mailDate.year(), month = objMessage.mailDate.month(), day = objMessage.mailDate.day())
if 'adv' in objMessage.mailSubject.lower():
AddPastStat(dictStats, dtmDate, "AdvertPostedYesterday")
else:
AddPastStat(dictStats, dtmDate, "NonAdvertPostedYesterday")
SaveStats(objContext, dictStats)
示例2: AddPropertyToOfferings
# 需要导入模块: from libDatabase import GetDataFolder [as 别名]
# 或者: from libDatabase.GetDataFolder import objectValues [as 别名]
def AddPropertyToOfferings(objHere, strPropertyName, varDefault, strType):
objMembers = GetDataFolder(objHere, 'E3Member')
for objBatch in objMembers.objectValues('Folder'):
for objMember in objBatch.objectValues('E3Member'):
for objOffering in objMember.Offerings.objectValues("E3Offering"):
if not strPropertyName in objOffering.propertyIds():
objOffering.manage_addProperty(strPropertyName, varDefault, strType)
示例3: UsernameExists
# 需要导入模块: from libDatabase import GetDataFolder [as 别名]
# 或者: from libDatabase.GetDataFolder import objectValues [as 别名]
def UsernameExists(objHere, strUsername):
objMembers = GetDataFolder(objHere, "E3Member")
for objBatch in objMembers.objectValues('Folder'):
for objMember in objBatch.objectValues('E3Member'):
if objMember.Username.lower() == strUsername.lower():
return True
return False
示例4: SaveStats
# 需要导入模块: from libDatabase import GetDataFolder [as 别名]
# 或者: from libDatabase.GetDataFolder import objectValues [as 别名]
def SaveStats(objContext, dictStats):
print "Saving stats"
# Update all existing stats
objStats = GetDataFolder(objContext, "E3ListStat")
for objStat in objStats.objectValues("E3ListStat"):
dtmDate = objStat.GetDateOfCount()
if dictStats.has_key(dtmDate):
for strItem in ("JoinedYesterday", "PaymentYesterday", "ExpiredYesterday", "AdvertPostedYesterday", "NonAdvertPostedYesterday"):
if not objStat.hasProperty(strItem):
objStat.manage_addProperty(strItem, dictStats[dtmDate][strItem], 'int')
del(dicStats[dtmDate])
for strItem in cnStatsList:
if not objStat.hasProperty(strItem):
objStat.manage_addProperty(strItem, 0, "int")
dodListStat = GetDOD(objContext, "E3ListStat")
for dtmDate in dictStats.keys():
objStat = dodListStat.NewObject()
objStat.SetDateOfCount(dtmDate)
for strItem in ("JoinedYesterday", "PaymentYesterday", "ExpiredYesterday", "AdvertPostedYesterday", "NonAdvertPostedYesterday"):
if dictStats[dtmDate].has_key(strItem):
objStat.manage_addProperty(strItem, dictStats[dtmDate][strItem], 'int')
for strItem in cnStatsList:
if not objStat.hasProperty(strItem):
objStat.manage_addProperty(strItem, 0, "int")
示例5: ExtractEmailAddresses
# 需要导入模块: from libDatabase import GetDataFolder [as 别名]
# 或者: from libDatabase.GetDataFolder import objectValues [as 别名]
def ExtractEmailAddresses(objHere):
"""Processes all messages"""
# objUnknownMember = SearchOne(objHere, 'E3Member', 'Username', 'Unknown')
# if not objUnknownMember:
# objDataObjectDefinition = GetDataFolder(objHere, 'DataObjectDefinitions').E3Member
# objUnknownMember = objDataObjectDefinition.NewObject()
# objUnknownMember.Username = 'Unknown'
objArchive = GetDataFolder(objHere, 'E3Messages')
objEmailAddresses = GetDataFolder(objHere, 'E3EmailAddress')
objMembers = GetDataFolder(objHere, 'E3Member')
dictAllEmailAddresses = GetAllEmailAddresses(objMembers, objEmailAddresses.Catalogue)
dodMember = GetDOD(objHere, 'E3Member')
dodEmailAddress = GetDOD(objHere, 'E3EmailAddress')
intDone = 0
for objYear in objArchive.objectValues():
for objMonth in objYear.objectValues():
for objThread in objMonth.objectValues():
dictAllEmailAddresses = ExtractOneAddress(objThread, dictAllEmailAddresses, dodMember, dodEmailAddress)
intDone = intDone + 1
# if intDone > 100:
# return "done"
for objMessage in objThread.objectValues('Folder'):
intDone = intDone + 1
dictAllEmailAddresses = ExtractOneAddress(objMessage, dictAllEmailAddresses, dodMember, dodEmailAddress)
return "%s done" % intDone
示例6: ConvertNameToUstring
# 需要导入模块: from libDatabase import GetDataFolder [as 别名]
# 或者: from libDatabase.GetDataFolder import objectValues [as 别名]
def ConvertNameToUstring(objHere):
objMembers = GetDataFolder(objHere, 'E3Member')
for objBatch in objMembers.objectValues('Folder'):
for objMember in objBatch.objectValues('E3Member'):
strName = ToUnicode(objMember.Name)
objMember.manage_delProperties(("Name", ))
objMember.manage_addProperty("Name", strName, "ustring")
示例7: ParkingAccounts
# 需要导入模块: from libDatabase import GetDataFolder [as 别名]
# 或者: from libDatabase.GetDataFolder import objectValues [as 别名]
def ParkingAccounts(objHere):
objMembers = GetDataFolder(objHere, 'E3Member')
for objBatch in objMembers.objectValues('Folder'):
for objMember in objBatch.objectValues('E3Member'):
if objMember.GetNextExpiryFromMailman() < cnFirstDate:
if objMember.Name <> 'Unknown':
print objMember.Name
示例8: RemindToConfirm
# 需要导入模块: from libDatabase import GetDataFolder [as 别名]
# 或者: from libDatabase.GetDataFolder import objectValues [as 别名]
def RemindToConfirm(objHere):
objMembers = GetDataFolder(objHere, 'E3Member')
for objBatch in objMembers.objectValues('Folder'):
for objMember in objBatch.objectValues('E3Member'):
if objMember.VisitCount < 2:
objMember.RemindToConfirm()
return "Done"
示例9: RemoveProfessionalName
# 需要导入模块: from libDatabase import GetDataFolder [as 别名]
# 或者: from libDatabase.GetDataFolder import objectValues [as 别名]
def RemoveProfessionalName(objHere):
objMembers = GetDataFolder(objHere, 'E3Member')
for objBatch in objMembers.objectValues('Folder'):
for objMember in objBatch.objectValues('E3Member'):
if "FullName" in objMember.objectIds():
if not objMember.Name:
objMember.Name = objMember.FullName
示例10: ChangeEmailSettings
# 需要导入模块: from libDatabase import GetDataFolder [as 别名]
# 或者: from libDatabase.GetDataFolder import objectValues [as 别名]
def ChangeEmailSettings(objHere):
# Old setting:
# (member).ListMemberships.ECL.myDeliveryMode
# (member).ListMemberships.ECL.EmailAddress
# New settings:
# (member).EmailDigestMode
# (member).EmailFrequency-ECL
# (member).EmailDeliveryAddress
# Unchanged:
# (member).NoMail
# (member).ContactEmailAddress
# Might happen later:
# (member).EmailFrequency-ECL-Adverts, etc
objMembers = GetDataFolder(objHere, 'E3Member')
for objBatch in objMembers.objectValues('Folder'):
for objMember in objBatch.objectValues('E3Member'):
if not objMember.hasProperty("EmailDigestMode"):
strDeliveryMode = objMember.ListMemberships.ECL.GetDeliveryMode()
strEmailAddress = objMember.ListMemberships.ECL.EmailAddress
objMember.manage_addProperty("EmailDeliveryAddress", strEmailAddress, "ustring")
if "Digest" in strDeliveryMode:
strFrequency = "Daily"
strDigestMode = strDeliveryMode
else:
strFrequency = "Direct"
strDigestMode = "StructuredDigest"
objMember.manage_addProperty("EmailDigestMode", strDigestMode, "string")
objMember.manage_addProperty("EmailFrequency_ECL", strFrequency, "string")
示例11: PostFixCheck
# 需要导入模块: from libDatabase import GetDataFolder [as 别名]
# 或者: from libDatabase.GetDataFolder import objectValues [as 别名]
def PostFixCheck(objHere):
strResult = """<fieldset>
<legend>Post-fix check</legend>"""
strResult += "<ol>\n"
objMembers = GetDataFolder(objHere, 'E3Member')
for objBatch in objMembers.objectValues('Folder'):
for objMember in objBatch.objectValues('E3Member'):
if "ListMemberships" in objMember.objectIds():
if "ECL" in objMember.ListMemberships.objectIds():
strOldDeliveryMode = objMember.ListMemberships.ECL.myDeliveryMode
strOldDeliveryAddress = objMember.ListMemberships.ECL.EmailAddress
strDeliveryFrequency = objMember.EmailFrequency_ECL
strDigestMode = objMember.EmailDigestMode
strDeliveryAddress = objMember.EmailDeliveryAddress
if strOldDeliveryMode == "NoMail" and strDeliveryFrequency == "Direct" and objMember.NoMail:
pass
elif strOldDeliveryMode == "Direct" and strDeliveryFrequency == "Direct" and strDigestMode == "StructuredDigest":
pass
elif strOldDeliveryMode in ["MIMEDigest", "TextDigest", "StructuredDigest", "TopicsList"] and strDeliveryFrequency == "Daily" and strDigestMode == strOldDeliveryMode:
pass
else:
strResult += "<li>%s, from %s to %s - %s</li>" % (objMember.id, strOldDeliveryMode, strDeliveryFrequency, strDigestMode)
strResult += "</ol>\n"
strResult += "</fieldset>"
return strResult
示例12: ListUnconfirmedMembers
# 需要导入模块: from libDatabase import GetDataFolder [as 别名]
# 或者: from libDatabase.GetDataFolder import objectValues [as 别名]
def ListUnconfirmedMembers(objHere):
lstAddresses = []
lstMembershipTypes = []
objMembers = GetDataFolder(objHere, 'E3Member')
for objBatch in objMembers.objectValues('Folder'):
for objMember in objBatch.objectValues('E3Member'):
if not objMember.MembershipType in lstMembershipTypes:
lstMembershipTypes.append(objMember.MembershipType)
if objMember.MembershipType == "Full" and not objMember.HasConfirmedEmailAddress:
lstAddresses.append(objMember)
strAddresses = ""
for objMember in lstAddresses:
strAddresses += '<li>%s (%s)</li>\n' % (objMember.EmailDeliveryAddress, objMember.id)
strMembershipTypes = ""
for strMembershipType in lstMembershipTypes:
strMembershipTypes += "<li>%s</li>\n" % strMembershipType
strResult = """
<h2>Membership types</h2>
<ol>
%s
</ol>
<h2>Members without confirmed email addresses</h2>
<ol>
%s
</ol>
""" % (strMembershipTypes, strAddresses)
return strResult
示例13: u32to33AddProfileProperties
# 需要导入模块: from libDatabase import GetDataFolder [as 别名]
# 或者: from libDatabase.GetDataFolder import objectValues [as 别名]
def u32to33AddProfileProperties(objHere, blnSkip = False):
if blnSkip:
print "Skipping: AddProfileProperties"
return
objMembers = GetDataFolder(objHere, 'E3Member')
for objBatch in objMembers.objectValues('Folder'):
for objMember in objBatch.objectValues('E3Member'):
AddProperties(objMember,
(('FullName', '', 'ustring'),
('TagLine', '', 'ustring'),
('Biography', '', 'utext'),
('Testimonials', '', 'utext'),
('Country', '', 'ustring'),
('Location', '', 'ustring'),
('Postcode', '', 'ustring'),
('CommercialComments', '', 'utext'),
('CommunityComments', '', 'utext'),
('ContactEmailAddress', '', 'ustring'),
('PhoneNumber', '', 'ustring'),
('Languages', '', 'utext'),
('WebsiteAddress', '', 'ustring'),
('HostOfChapter', '', 'ustring'),
('ShowFullName', 'Hide', 'string'),
('ShowCountry', 'Hide', 'string'),
('ShowLocation', 'Hide', 'string'),
('ShowPostcode', 'Hide', 'string'),
('ShowEmailAddress', 'Hide', 'string'),
('ShowPhoneNumber', 'Hide', 'string'),
('ShowBiography', 'Hide', 'string'),
('ShowCommunityComments', 'Hide', 'string')))
示例14: CountBookReviews
# 需要导入模块: from libDatabase import GetDataFolder [as 别名]
# 或者: from libDatabase.GetDataFolder import objectValues [as 别名]
def CountBookReviews(objHere):
objBooks = GetDataFolder(objHere, 'MCIBook')
intResult = 0
for objBatch in objBooks.objectValues():
for objBook in objBatch.objectValues('MCIBook'):
if objBook.Review:
intResult = intResult + 1
return intResult
示例15: CategoryNamesSelected
# 需要导入模块: from libDatabase import GetDataFolder [as 别名]
# 或者: from libDatabase.GetDataFolder import objectValues [as 别名]
def CategoryNamesSelected(objHere, objQuery):
lstResult = []
objCategories = GetDataFolder(objHere, 'MCIBookCategory')
for objCategory in objCategories.objectValues():
if objQuery.has_key('BookCategory' + objCategory.id):
lstResult.append(objCategory.CategoryName)
for objSubCategory in objCategory.objectValues():
if objQuery.has_key('BookCategory' + objSubCategory.id):
lstResult.append(objSubCategory.CategoryName)
objReaderCategories = GetDataFolder(objHere, 'MCIReaderCategory')
for objReaderCategory in objReaderCategories.objectValues():
if objQuery.has_key('ReaderCategory' + objReaderCategory.id):
lstResult.append(objReaderCategory.CategoryName)
strResult = ", ".join(lstResult)
return strResult