Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chenhao Ma
core
Commits
5d198536
Commit
5d198536
authored
9 years ago
by
Joe Schneider
Committed by
Gunnar Schaefer
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Provide timestamps with timezone in ISO format
parent
9a7099d2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
acquisitions.py
+1
-1
1 addition, 1 deletion
acquisitions.py
containers.py
+16
-2
16 additions, 2 deletions
containers.py
sessions.py
+1
-1
1 addition, 1 deletion
sessions.py
with
18 additions
and
4 deletions
acquisitions.py
+
1
−
1
View file @
5d198536
...
...
@@ -58,7 +58,7 @@ class Acquisitions(containers.ContainerList):
if
not
self
.
app
.
db
.
sessions
.
find_one
({
'
_id
'
:
_id
}):
self
.
abort
(
404
,
'
no such Session
'
)
query
=
{
'
session
'
:
_id
}
projection
=
{
'
label
'
:
1
,
'
description
'
:
1
,
'
types
'
:
1
,
'
notes
'
:
1
}
projection
=
{
'
label
'
:
1
,
'
description
'
:
1
,
'
types
'
:
1
,
'
notes
'
:
1
,
'
timestamp
'
:
1
,
'
timezone
'
:
1
}
acquisitions
=
self
.
_get
(
query
,
projection
,
self
.
request
.
get
(
'
admin
'
).
lower
()
in
(
'
1
'
,
'
true
'
))
if
self
.
debug
:
for
acquisition
in
acquisitions
:
...
...
This diff is collapsed.
Click to expand it.
containers.py
+
16
−
2
View file @
5d198536
...
...
@@ -6,9 +6,9 @@ log = logging.getLogger('scitran.api')
import
os
import
json
import
hashlib
import
datetime
import
jsonschema
import
bson.json_util
import
pytz
import
tempdir
as
tempfile
...
...
@@ -16,7 +16,6 @@ import base
import
util
import
users
import
tempdir
as
tempfile
FILE_SCHEMA
=
{
'
$schema
'
:
'
http://json-schema.org/draft-04/schema#
'
,
...
...
@@ -112,6 +111,19 @@ FILE_DOWNLOAD_SCHEMA = {
}
def
fixup_timestamps
(
item
):
if
'
timestamp
'
in
item
:
if
'
timezone
'
in
item
:
item_timezone
=
pytz
.
timezone
(
item
[
'
timezone
'
])
else
:
item_timezone
=
pytz
.
timezone
(
'
UTC
'
)
timestamp
=
item_timezone
.
localize
(
item
[
'
timestamp
'
])
item
[
'
timestamp
'
]
=
timestamp
.
isoformat
()
item
[
'
timezone
'
]
=
item_timezone
.
zone
class
ContainerList
(
base
.
RequestHandler
):
def
_get
(
self
,
query
,
projection
,
admin_only
=
False
):
...
...
@@ -127,6 +139,7 @@ class ContainerList(base.RequestHandler):
containers
=
list
(
self
.
dbc
.
find
(
query
,
projection
))
for
container
in
containers
:
container
[
'
_id
'
]
=
str
(
container
[
'
_id
'
])
fixup_timestamps
(
container
)
return
containers
...
...
@@ -154,6 +167,7 @@ class Container(base.RequestHandler):
for
file_info
in
container
[
'
files
'
]:
file_info
[
'
path
'
]
=
str
(
_id
)[
-
3
:]
+
'
/
'
+
str
(
_id
)
+
'
/
'
+
file_info
[
'
name
'
]
+
file_info
[
'
ext
'
]
container
[
'
_id
'
]
=
str
(
container
[
'
_id
'
])
fixup_timestamps
(
container
)
return
container
,
user_perm
def
put
(
self
,
_id
):
...
...
This diff is collapsed.
Click to expand it.
sessions.py
+
1
−
1
View file @
5d198536
...
...
@@ -64,7 +64,7 @@ class Sessions(containers.ContainerList):
query
=
{
'
project
'
:
_id
}
else
:
query
=
{}
projection
=
{
'
label
'
:
1
,
'
subject.code
'
:
1
,
'
notes
'
:
1
,
'
project
'
:
1
}
projection
=
{
'
label
'
:
1
,
'
subject.code
'
:
1
,
'
notes
'
:
1
,
'
project
'
:
1
,
'
timestamp
'
:
1
,
'
timezone
'
:
1
}
sessions
=
self
.
_get
(
query
,
projection
,
self
.
request
.
get
(
'
admin
'
).
lower
()
in
(
'
1
'
,
'
true
'
))
for
sess
in
sessions
:
sess
[
'
project
'
]
=
str
(
sess
[
'
project
'
])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment