Ejemplo n.º 1
0
        def get_obj(t):
            from uliweb.utils.timesince import timesince

            status_text = Task.status.get_display_value(t.status)
            d = {'id':t.task_id,
                 'label':t.title,
                 'title':'<br/>'.join([
                     '任务 ID :{}'.format(t.task_id),
                     '开始时间:{}'.format(t.started_time),
                     '结束时间:{}'.format(t.finished_time),
                     '执行状态:{}'.format(status_text),
                     '执行命令:{}'.format(t.command_name),
                     '执行参数:{!r}'.format(t.command_info.get('parameters', ''))
                 ]),
                 'depend_tasks':t.depend_tasks,
                 'parent_task':t._parent_task_,
                 'status':t.status,
                 'children_count':t.children_count,
                 'status_text':status_text,
                 'started_time':t.started_time,
                 'finished_time':t.finished_time,
                 }
            if t.status == 'E':
                d['label'] += u'({}/{})'.format(t.retry_times, timesince(t.startup_time))
            elif t.status == '1': #成功
                d['label'] += u'(用时:{}s)'.format((t.finished_time-t.started_time).seconds)
            return d
Ejemplo n.º 2
0
    def _get_date(self, value, obj=None):
        """
        获得本地时间,加obj可以直接用到convert函数当中
        """
        from uliweb.utils.timesince import timesince

        #return date.to_local(value).strftime('%Y-%m-%d %H:%M:%S %Z')
        return timesince(value)
Ejemplo n.º 3
0
    def _get_date(self, value, obj=None):
        """
        获得本地时间,加obj可以直接用到convert函数当中
        """
        from uliweb.utils.timesince import timesince

        #return date.to_local(value).strftime('%Y-%m-%d %H:%M:%S %Z')
        return timesince(value)
Ejemplo n.º 4
0
 def create_date(value, obj):
     from uliweb.utils.timesince import timesince
     return timesince(value)
Ejemplo n.º 5
0
 def updated(value, obj):
     if obj.floor == 1 and obj.topic.updated_on and not obj.parent:
         return u'<div class="updated">由 %s 于 %s 更新</div>' % (obj.topic.modified_user.username, timesince(obj.topic.updated_on))
Ejemplo n.º 6
0
 def last_reply_on(value, obj):
     return timesince(value)
Ejemplo n.º 7
0
 def create_date(value, obj):
     from uliweb.utils.timesince import timesince
     return timesince(value)
Ejemplo n.º 8
0
 def updated(value, obj):
     if obj.floor == 1 and obj.topic.updated_on and not obj.parent:
         return u'<div class="updated">由 %s 于 %s 更新</div>' % (
             obj.topic.modified_user.username,
             timesince(obj.topic.updated_on))
Ejemplo n.º 9
0
 def last_reply_on(value, obj):
     return timesince(value)