Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
physical
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
钟尚武
physical
Commits
47694517
Commit
47694517
authored
Nov 22, 2018
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
1293ae81
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
tools.py
libs/tools.py
+5
-0
topic_transfer.py
trans2es/utils/topic_transfer.py
+7
-0
No files found.
libs/tools.py
View file @
47694517
...
...
@@ -11,4 +11,8 @@ def tzlc(dt, truncate_to_sec=True):
return
None
if
truncate_to_sec
:
dt
=
dt
.
replace
(
microsecond
=
0
)
if
dt
.
tzinfo
is
None
:
return
timezone
(
settings
.
TIME_ZONE
)
.
localize
(
dt
)
else
:
return
timezone
(
settings
.
TIME_ZONE
)
.
normalize
(
dt
)
\ No newline at end of file
trans2es/utils/topic_transfer.py
View file @
47694517
...
...
@@ -30,17 +30,24 @@ class TopicTransfer(object):
create_time
=
instance
.
create_time
print
(
"id is:
%
d,create_time is:
%
sm,tzinfo:
%
s"
%
(
res
[
"id"
],
str
(
create_time
),
str
(
create_time
.
tzinfo
)))
res
[
"create_time"
]
=
tzlc
(
create_time
)
"""
if create_time.tzinfo is None:
res["create_time"] = tzlc(create_time)
else:
res["create_time"] = create_time.replace(microsecond=0)
"""
update_time
=
instance
.
update_time
res
[
"update_time"
]
=
tzlc
(
update_time
)
"""
if update_time.tzinfo is None:
res["update_time"] = tzlc(update_time)
else:
res["update_time"] = update_time.replace(microsecond=0)
"""
return
res
except
:
...
...
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