本文整理匯總了Python中source.Source.url方法的典型用法代碼示例。如果您正苦於以下問題:Python Source.url方法的具體用法?Python Source.url怎麽用?Python Source.url使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類source.Source
的用法示例。
在下文中一共展示了Source.url方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: transactionalCreateTree
# 需要導入模塊: from source import Source [as 別名]
# 或者: from source.Source import url [as 別名]
def transactionalCreateTree(dataForPointTree, user):
outlineRoot = OutlineRoot()
outlineRoot.put()
# ITERATE THE FIRST TIME AND CREATE ALL POINT ROOTS WITH BACKLINKS
for p in dataForPointTree:
pointRoot = PointRoot(parent=outlineRoot.key)
pointRoot.url = p['url']
pointRoot.numCopies = 0
pointRoot.editorsPick = False
pointRoot.viewCount = 1
if 'parentIndex' in p:
parentPointRoot = dataForPointTree[p['parentIndex']]['pointRoot']
pointRoot.pointsSupportedByMe = [parentPointRoot.key]
pointRoot.put()
p['pointRoot'] = pointRoot
point = Point(parent=pointRoot.key)
point.title = p['title']
point.url = pointRoot.url
point.content = p['furtherInfo']
point.current = True
point.authorName = user.name
point.authorURL = user.url
point.put()
user.addVote(point, voteValue=1, updatePoint=False)
user.recordCreatedPoint(pointRoot.key)
p['point'] = point
p['pointRoot'].current = p['point'].key
pointRoot.put()
point.addToSearchIndexNew()
# ITERATE THE SECOND TIME ADD SUPPORTING POINTS
for p in dataForPointTree:
if 'parentIndex' in p:
linkP = dataForPointTree[p['parentIndex']]['point']
linkP.supportingPointsRoots = linkP.supportingPointsRoots + [p['pointRoot'].key] \
if linkP.supportingPointsRoots else [p['pointRoot'].key]
linkP.supportingPointsLastChange = linkP.supportingPointsLastChange + [p['point'].key] \
if linkP.supportingPointsRoots else [p['point'].key]
# ITERATE THE THIRD TIME AND WRITE POINTS WITH ALL SUPPORTING POINTS AND SOURCE KEYS
for p in dataForPointTree:
if p['sources']:
sourceKeys = []
for s in p['sources']:
source = Source(parent=p['point'].key)
source.url = s['sourceURL']
source.name = s['sourceTitle']
source.put()
sourceKeys = sourceKeys + [source.key]
p['point'].sources = sourceKeys
p['point'].put()
return dataForPointTree[0]['point'], dataForPointTree[0]['pointRoot']