Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
4c05b3db
Commit
4c05b3db
authored
Dec 02, 2017
by
OzzieIsaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Present dates for updater in local date format
parent
319077ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
web.py
cps/web.py
+15
-3
No files found.
cps/web.py
View file @
4c05b3db
...
@@ -56,7 +56,7 @@ from werkzeug.datastructures import Headers
...
@@ -56,7 +56,7 @@ from werkzeug.datastructures import Headers
from
babel
import
Locale
as
LC
from
babel
import
Locale
as
LC
from
babel
import
negotiate_locale
from
babel
import
negotiate_locale
from
babel
import
__version__
as
babelVersion
from
babel
import
__version__
as
babelVersion
from
babel.dates
import
format_date
from
babel.dates
import
format_date
,
format_datetime
from
functools
import
wraps
from
functools
import
wraps
import
base64
import
base64
from
sqlalchemy.sql
import
*
from
sqlalchemy.sql
import
*
...
@@ -429,7 +429,7 @@ def mimetype_filter(val):
...
@@ -429,7 +429,7 @@ def mimetype_filter(val):
@
app
.
template_filter
(
'formatdate'
)
@
app
.
template_filter
(
'formatdate'
)
def
formatdate
(
val
):
def
formatdate
_filter
(
val
):
conformed_timestamp
=
re
.
sub
(
r"[:]|([-](?!((\d{2}[:]\d{2})|(\d{4}))$))"
,
''
,
val
)
conformed_timestamp
=
re
.
sub
(
r"[:]|([-](?!((\d{2}[:]\d{2})|(\d{4}))$))"
,
''
,
val
)
formatdate
=
datetime
.
datetime
.
strptime
(
conformed_timestamp
[:
15
],
"
%
Y
%
m
%
d
%
H
%
M
%
S"
)
formatdate
=
datetime
.
datetime
.
strptime
(
conformed_timestamp
[:
15
],
"
%
Y
%
m
%
d
%
H
%
M
%
S"
)
return
format_date
(
formatdate
,
format
=
'medium'
,
locale
=
get_locale
())
return
format_date
(
formatdate
,
format
=
'medium'
,
locale
=
get_locale
())
...
@@ -996,7 +996,8 @@ def get_update_status():
...
@@ -996,7 +996,8 @@ def get_update_status():
status
[
'status'
]
=
True
status
[
'status'
]
=
True
commitdate
=
requests
.
get
(
'https://api.github.com/repos/janeczku/calibre-web/git/commits/'
+
commit
[
'object'
][
'sha'
])
.
json
()
commitdate
=
requests
.
get
(
'https://api.github.com/repos/janeczku/calibre-web/git/commits/'
+
commit
[
'object'
][
'sha'
])
.
json
()
if
"committer"
in
commitdate
:
if
"committer"
in
commitdate
:
status
[
'commit'
]
=
commitdate
[
'committer'
][
'date'
]
form_date
=
datetime
.
datetime
.
strptime
(
commitdate
[
'committer'
][
'date'
],
"
%
Y-
%
m-
%
dT
%
H:
%
M:
%
SZ"
)
status
[
'commit'
]
=
format_datetime
(
form_date
,
format
=
'short'
,
locale
=
get_locale
())
else
:
else
:
status
[
'commit'
]
=
u'Unknown'
status
[
'commit'
]
=
u'Unknown'
else
:
else
:
...
@@ -2430,6 +2431,17 @@ def profile():
...
@@ -2430,6 +2431,17 @@ def profile():
@
admin_required
@
admin_required
def
admin
():
def
admin
():
commit
=
'$Format:
%
cI$'
commit
=
'$Format:
%
cI$'
if
commit
.
startswith
(
"$"
):
commit
=
_
(
u'Unknown'
)
else
:
form_date
=
datetime
.
datetime
.
strptime
(
commit
[:
19
],
"
%
Y-
%
m-
%
dT
%
H:
%
M:
%
S"
)
if
len
(
commit
)
>
19
:
# check if string has timezone
if
commit
[
19
]
==
'+'
:
form_date
-=
datetime
.
timedelta
(
hours
=
int
(
commit
[
20
:
22
]),
minutes
=
int
(
commit
[
23
:]))
elif
commit
[
19
]
==
'-'
:
form_date
+=
datetime
.
timedelta
(
hours
=
int
(
commit
[
20
:
22
]),
minutes
=
int
(
commit
[
23
:]))
commit
=
format_datetime
(
form_date
,
format
=
'short'
,
locale
=
get_locale
())
content
=
ub
.
session
.
query
(
ub
.
User
)
.
all
()
content
=
ub
.
session
.
query
(
ub
.
User
)
.
all
()
settings
=
ub
.
session
.
query
(
ub
.
Settings
)
.
first
()
settings
=
ub
.
session
.
query
(
ub
.
Settings
)
.
first
()
return
render_title_template
(
"admin.html"
,
content
=
content
,
email
=
settings
,
config
=
config
,
commit
=
commit
,
return
render_title_template
(
"admin.html"
,
content
=
content
,
email
=
settings
,
config
=
config
,
commit
=
commit
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment