本文整理匯總了Python中tags.models.Tag.timestamp方法的典型用法代碼示例。如果您正苦於以下問題:Python Tag.timestamp方法的具體用法?Python Tag.timestamp怎麽用?Python Tag.timestamp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tags.models.Tag
的用法示例。
在下文中一共展示了Tag.timestamp方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: run
# 需要導入模塊: from tags.models import Tag [as 別名]
# 或者: from tags.models.Tag import timestamp [as 別名]
def run():
libraries = connections["old"].cursor()
cursor = connections["old"].cursor()
# Delete existing courses
print "Removing existing libraries..."
Library.objects.all().delete()
print "Creating libraries..."
cached_users = dict([(profile.principal_id, profile.user) for profile in Profile.objects.select_related().all()])
cached_users["zope.manager"] = admin
class_id = 101
cursor.execute("SELECT object_id, id FROM _intids WHERE class_id = %s", [class_id])
intids = dict(cursor.fetchall())
tags_dict = {}
cursor.execute("SELECT * FROM _tags")
for item, principal, name, timestamp in cursor.fetchall():
if item not in tags_dict:
tags_dict[item] = []
if principal in cached_users:
tags_dict[item].append((name, cached_users[principal], timestamp))
rating_dict = {}
cursor.execute("SELECT * FROM _overall_rating WHERE id = 'overall_rating'")
for item, id, principal, value, timestamp in cursor.fetchall():
if item not in rating_dict:
rating_dict[item] = []
if principal in cached_users:
rating_dict[item].append((int(value), cached_users[principal], timestamp))
reviews_dict = {}
cursor.execute("SELECT * FROM _reviews")
for item, principal, text, timestamp in cursor.fetchall():
if item not in reviews_dict:
reviews_dict[item] = []
if principal in cached_users:
reviews_dict[item].append((text, cached_users[principal], timestamp))
saved_items_dict = {}
cursor.execute("SELECT * FROM _bookmarks")
for item, principal, timestamp in cursor.fetchall():
if item not in saved_items_dict:
saved_items_dict[item] = []
if principal in cached_users:
saved_items_dict[item].append((cached_users[principal], timestamp))
creators = {}
cursor.execute("SELECT * FROM _ownership WHERE class_id = %s", [class_id])
for object_id, class_id, principal_id in cursor.fetchall():
if principal_id in cached_users:
creators[object_id] = cached_users[principal_id]
else:
creators[object_id] = admin
created_dict = {}
cursor.execute("SELECT * FROM _dublincore WHERE class_id = %s AND property = %s AND qualified = %s",
[class_id, "Date", "Created"])
for id, object_id, class_id, property, qualified, value in cursor.fetchall():
created_dict[object_id] = parse(value)
modified_dict = {}
cursor.execute("SELECT * FROM _dublincore WHERE class_id = %s AND property = %s AND qualified = %s",
[class_id, "Date", "Modified"])
for id, object_id, class_id, property, qualified, value in cursor.fetchall():
modified_dict[object_id] = parse(value)
workflow_state_dict = {}
cursor.execute("SELECT object_id, state FROM _workflowstates WHERE class_id = %s",
[class_id, ])
for object_id, state in cursor.fetchall():
workflow_state_dict[object_id] = state
libraries.execute("SELECT * FROM libraries")
total_items = libraries.rowcount
cnt = 0
for id, name, title, description, content_creation_date, authors, \
author_emails, author_countries, remote_url, keywords, \
tech_requirements, general_subjects, grade_levels, languages, \
geographic_relevance, institution, collection, material_types, \
media_formats, curriculum_standards, is_homepage, iskme_id, cksum, native_id, \
license_url, license_name, license_image, license_description, \
copyright_holder, in_rss, rss_description, rss_datetime, is_featured, \
publication_time, _searchindex, cou_bucket, tags in libraries.fetchall():
if "audio-lectures" in material_types:
continue
cnt += 1
creator = creators[id]
try:
#.........這裏部分代碼省略.........