本文整理汇总了Python中pyasm.common.Date.get_display_time方法的典型用法代码示例。如果您正苦于以下问题:Python Date.get_display_time方法的具体用法?Python Date.get_display_time怎么用?Python Date.get_display_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.common.Date
的用法示例。
在下文中一共展示了Date.get_display_time方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_message
# 需要导入模块: from pyasm.common import Date [as 别名]
# 或者: from pyasm.common.Date import get_display_time [as 别名]
def get_message(my):
search_type_obj = my.parent.get_search_type_obj()
title = search_type_obj.get_title()
subject = my.get_subject()
notification_message = my.notification.get_value("message")
message = "%s %s Note Entry" % (title, my.parent.get_name())
if notification_message:
message = "%s (%s)" %(message, notification_message)
submit_desc = ''
from pyasm.prod.biz import Submission
if isinstance(my.parent, Submission):
update_info = ['']
# add more info about the file and bin
snapshot = Snapshot.get_latest_by_sobject(my.parent, "publish")
xpath = "snapshot/file[@type='main']"
xml = snapshot.get_xml_value('snapshot')
file = None
if xml.get_node(xpath) is not None:
file = my._get_file_obj(snapshot)
else:
snapshots = snapshot.get_all_ref_snapshots()
snapshot_file_objects = []
if snapshots:
snapshot = snapshots[0]
file = my._get_file_obj(snapshot, type=None)
if file:
file_name = file.get_file_name()
web_path = file.get_web_path()
from pyasm.web import WebContainer
host = WebContainer.get_web().get_base_url()
update_info.append('Browse: %s %s%s' %( file_name, host.to_string(), web_path))
bins = my.parent.get_bins()
bin_labels = [ bin.get_label() for bin in bins]
update_info.append('Bin: %s' %', '.join(bin_labels))
update_info.append('Artist: %s' %my.parent.get_value('artist'))
update_info.append('Description: %s' %my.parent.get_value('description'))
# get notes
search = Note.get_search_by_sobjects([my.parent])
if search:
search.add_order_by("context")
search.add_order_by("timestamp desc")
notes = search.get_sobjects()
last_context = None
note_list = []
for i, note in enumerate(notes):
context = note.get_value('context')
# explicit compare to None
if last_context == None or context != last_context:
note_list.append( "[ %s ] " % context )
last_context = context
#child_notes = my.notes_dict.get(note.get_id())
# draw note item
date = Date(db=note.get_value('timestamp'))
note_list.append('(%s) %s'%(date.get_display_time(), note.get_value("note")))
update_info.append('Notes: \n %s' % '\n'.join(note_list))
submit_desc = '\n'.join(update_info)
update_desc = my.sobject.get_update_description()
command_desc = my.command.get_description()
message = '%s\n\nReport from transaction:\n%s\n\n%s\n%s' \
% (message, update_desc, command_desc, submit_desc)
return message