本文整理匯總了Python中source.Source.constructFromArrays方法的典型用法代碼示例。如果您正苦於以下問題:Python Source.constructFromArrays方法的具體用法?Python Source.constructFromArrays怎麽用?Python Source.constructFromArrays使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類source.Source
的用法示例。
在下文中一共展示了Source.constructFromArrays方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: transactionalCreate
# 需要導入模塊: from source import Source [as 別名]
# 或者: from source.Source import constructFromArrays [as 別名]
def transactionalCreate(pointRoot, title, nodetype, content, summaryText, user,
imageURL=None, imageAuthor=None,
imageDescription=None, sourceURLs=None, sourceNames=None):
pointRoot.put()
point = Point(parent=pointRoot.key)
point.title = title
point.nodetype = nodetype
point.url = pointRoot.url
point.content = content
point.summaryText = summaryText if (len(
summaryText) != 250) else summaryText + '...'
point.authorName = user.name
point.authorURL = user.url
point.version = 1
point.current = True
point.upVotes = 1
point.downVotes = 0
point.voteTotal = 1
point.imageURL = imageURL
point.imageDescription = imageDescription
point.imageAuthor = imageAuthor
point.put()
sources = Source.constructFromArrays(sourceURLs, sourceNames, point.key)
if sources:
sourceKeys = []
for source in sources:
source.put()
sourceKeys = sourceKeys + [source.key]
point.sources = sourceKeys
point.put()
point.addToSearchIndexNew()
pointRoot.current = point.key
pointRoot.put()
user.addVote(point, voteValue=1, updatePoint=False)
user.recordCreatedPoint(pointRoot.key)
return point, pointRoot