本文整理汇总了Python中nxdrive.wui.translator.Translator.format_datetime方法的典型用法代码示例。如果您正苦于以下问题:Python Translator.format_datetime方法的具体用法?Python Translator.format_datetime怎么用?Python Translator.format_datetime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nxdrive.wui.translator.Translator
的用法示例。
在下文中一共展示了Translator.format_datetime方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _export_state
# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import format_datetime [as 别名]
def _export_state(self, state):
if state is None:
return None
result = super(WebConflictsApi, self)._export_state(state)
result["last_contributor"] = self._engine.get_user_full_name(state.last_remote_modifier)
date_time = self.get_date_from_sqlite(state.last_remote_updated)
result["last_remote_update"] = "" if date_time == 0 else Translator.format_datetime(date_time)
date_time = self.get_date_from_sqlite(state.last_local_updated)
result["last_local_update"] = "" if date_time == 0 else Translator.format_datetime(date_time)
return result
示例2: _export_state
# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import format_datetime [as 别名]
def _export_state(self, state):
if state is None:
return None
result = super(WebConflictsApi, self)._export_state(state)
result["last_contributor"] = " " if state.last_remote_modifier is None \
else self._engine.get_user_full_name(state.last_remote_modifier, cache_only=not self.retrieve_name)
date_time = self.get_date_from_sqlite(state.last_remote_updated)
result["last_remote_update"] = "" if date_time == 0 else Translator.format_datetime(date_time)
date_time = self.get_date_from_sqlite(state.last_local_updated)
result["last_local_update"] = "" if date_time == 0 else Translator.format_datetime(date_time)
result["remote_can_update"] = state.remote_can_update
result['remote_can_rename'] = state.remote_can_rename
result['duplication_enabled'] = (self._engine.get_local_client()
.duplication_enabled())
return result
示例3: _export_state
# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import format_datetime [as 别名]
def _export_state(self, state):
if state is None:
return None
result = super(WebConflictsApi, self)._export_state(state)
result["last_contributor"] = ""
user_info = self._engine._dao.get_user_info(state.last_remote_modifier)
if user_info:
result["last_contributor"] = ("%s %s" % (user_info.first_name, user_info.last_name)).strip("(").strip(")")
else:
log.warn("User name failed to resolve for user_id : %r" % state.last_remote_modifier)
date_time = self.get_date_from_sqlite(state.last_remote_updated)
result["last_remote_update"] = "" if date_time == 0 else Translator.format_datetime(date_time)
date_time = self.get_date_from_sqlite(state.last_local_updated)
result["last_local_update"] = "" if date_time == 0 else Translator.format_datetime(date_time)
result["remote_can_update"] = state.remote_can_update
return result
示例4: _export_state
# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import format_datetime [as 别名]
def _export_state(self, state):
if state is None:
return None
result = dict()
# Direction
result["state"] = state.pair_state
# Last sync in sec
try:
current_time = int(time.time())
date_time = self.get_date_from_sqlite(state.last_sync_date)
sync_time = self.get_timestamp_from_date(date_time)
if state.last_local_updated > state.last_remote_updated:
result["last_sync_direction"] = "download"
else:
result["last_sync_direction"] = "upload"
result["last_sync"] = current_time - sync_time
if date_time == 0:
result["last_sync_date"] = ""
else:
# As date_time is in UTC
result["last_sync_date"] = Translator.format_datetime(date_time + tzlocal._dst_offset)
except Exception as e:
log.exception(e)
result["name"] = state.local_name
if state.local_name is None:
result["name"] = state.remote_name
result["remote_name"] = state.remote_name
result["last_error"] = state.last_error
result["local_path"] = state.local_path
result["local_parent_path"] = state.local_parent_path
result["remote_ref"] = state.remote_ref
result["folderish"] = state.folderish
result["last_transfer"] = state.last_transfer
result["id"] = state.id
return result
示例5: _export_state
# 需要导入模块: from nxdrive.wui.translator import Translator [as 别名]
# 或者: from nxdrive.wui.translator.Translator import format_datetime [as 别名]
def _export_state(self, state):
if state is None:
return None
result = dict(state=state.pair_state,
last_sync_date='',
last_sync_direction='upload')
# Last sync in sec
current_time = int(time.time())
date_time = self.get_date_from_sqlite(state.last_sync_date)
sync_time = self.get_timestamp_from_date(date_time)
if state.last_local_updated > state.last_remote_updated:
result['last_sync_direction'] = 'download'
result['last_sync'] = current_time - sync_time
if date_time != 0:
# As date_time is in UTC
result['last_sync_date'] = Translator.format_datetime(date_time + tzlocal()._dst_offset)
result["name"] = state.local_name
if state.local_name is None:
result["name"] = state.remote_name
result["remote_name"] = state.remote_name
result["last_error"] = state.last_error
result["local_path"] = state.local_path
result["local_parent_path"] = state.local_parent_path
result["remote_ref"] = state.remote_ref
result["folderish"] = state.folderish
result["last_transfer"] = state.last_transfer
if result["last_transfer"] is None:
result["last_transfer"] = result["last_sync_direction"]
result["id"] = state.id
return result