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