mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[#901] Human readable date
This commit is contained in:
parent
cedaaa9087
commit
b7c8ab541f
2 changed files with 18 additions and 1 deletions
|
@ -469,6 +469,11 @@ app:
|
|||
listlists:
|
||||
action_help: List registered application lists
|
||||
api: GET /appslists
|
||||
arguments:
|
||||
-H:
|
||||
full: --human-readable
|
||||
help: Return the lastUpdate with a human readable date
|
||||
action: store_true
|
||||
|
||||
### app_removelist()
|
||||
removelist:
|
||||
|
|
|
@ -36,6 +36,7 @@ import glob
|
|||
import pwd
|
||||
import grp
|
||||
from collections import OrderedDict
|
||||
import datetime
|
||||
|
||||
from moulinette import msignals, m18n, msettings
|
||||
from moulinette.core import MoulinetteError
|
||||
|
@ -66,10 +67,13 @@ re_app_instance_name = re.compile(
|
|||
)
|
||||
|
||||
|
||||
def app_listlists():
|
||||
def app_listlists(human_readable=False):
|
||||
"""
|
||||
List fetched lists
|
||||
|
||||
Keyword argument:
|
||||
human_readable -- Show human readable dates
|
||||
|
||||
"""
|
||||
|
||||
# Migrate appslist system if needed
|
||||
|
@ -80,6 +84,14 @@ def app_listlists():
|
|||
# Get the list
|
||||
appslist_list = _read_appslist_list()
|
||||
|
||||
# Human readable date
|
||||
if human_readable:
|
||||
for app in appslist_list:
|
||||
now_for_humans = datetime.datetime.fromtimestamp(
|
||||
appslist_list[app].get("lastUpdate"))
|
||||
appslist_list[app]["lastUpdate"] = now_for_humans.strftime(
|
||||
'%Y-%m-%d %H:%M:%S')
|
||||
|
||||
return appslist_list
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue