Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
7b444faa
Commit
7b444faa
authored
6 years ago
by
Swen Vermeul
Browse files
Options
Downloads
Patches
Plain Diff
added all date-containing attributes for all entities
parent
e96f37cf
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pybis/src/python/pybis/attribute.py
+20
-6
20 additions, 6 deletions
pybis/src/python/pybis/attribute.py
with
20 additions
and
6 deletions
pybis/src/python/pybis/attribute.py
+
20
−
6
View file @
7b444faa
from
pandas
import
DataFrame
,
Series
from
pandas
import
DataFrame
,
Series
from
tabulate
import
tabulate
from
tabulate
import
tabulate
from
.definitions
import
openbis_definitions
,
fetch_option
from
.definitions
import
openbis_definitions
,
fetch_option
from
.utils
import
parse_jackson
,
check_datatype
,
split_identifier
,
format_timestamp
,
is_identifier
,
is_permid
,
nvl
from
.utils
import
parse_jackson
,
check_datatype
,
split_identifier
,
format_timestamp
,
is_identifier
,
is_permid
,
nvl
,
extract_person
from
.attachment
import
Attachment
from
.attachment
import
Attachment
import
copy
import
copy
...
@@ -87,9 +87,17 @@ class AttrHolder():
...
@@ -87,9 +87,17 @@ class AttrHolder():
elif
attr
in
[
"
tags
"
]:
elif
attr
in
[
"
tags
"
]:
self
.
add_tags
(
data
[
attr
])
self
.
add_tags
(
data
[
attr
])
elif
attr
.
endswith
(
'
Date
'
):
self
.
__dict__
[
'
_
'
+
attr
]
=
format_timestamp
(
data
.
get
(
attr
))
elif
attr
in
[
'
registrator
'
,
'
modifier
'
,
'
dataProducer
'
]:
self
.
__dict__
[
'
_
'
+
attr
]
=
extract_person
(
data
.
get
(
attr
))
else
:
else
:
self
.
__dict__
[
'
_
'
+
attr
]
=
data
.
get
(
attr
,
None
)
self
.
__dict__
[
'
_
'
+
attr
]
=
data
.
get
(
attr
,
None
)
def
_new_attrs
(
self
,
method_name
=
None
):
def
_new_attrs
(
self
,
method_name
=
None
):
"""
Returns the Python-equivalent JSON request when a new object is created.
"""
Returns the Python-equivalent JSON request when a new object is created.
It is used internally by the save() method of a newly created object.
It is used internally by the save() method of a newly created object.
...
@@ -345,11 +353,6 @@ class AttrHolder():
...
@@ -345,11 +353,6 @@ class AttrHolder():
})
})
return
ras
return
ras
elif
int_name
in
[
'
_registrator
'
,
'
_modifier
'
,
'
_dataProducer
'
]:
return
self
.
__dict__
[
int_name
].
get
(
'
userId
'
,
None
)
elif
int_name
in
[
'
_registrationDate
'
,
'
_modificationDate
'
,
'
_accessDate
'
,
'
_dataProductionDate
'
]:
return
format_timestamp
(
self
.
__dict__
[
int_name
])
# if the attribute contains a list,
# if the attribute contains a list,
# return a list of either identifiers, codes or
# return a list of either identifiers, codes or
...
@@ -839,6 +842,17 @@ class AttrHolder():
...
@@ -839,6 +842,17 @@ class AttrHolder():
file_list
.
append
(
filename
)
file_list
.
append
(
filename
)
return
file_list
return
file_list
def
all
(
self
):
"""
Return all attributes of an entity in a dict
"""
attrs
=
{}
for
attr
in
self
.
_allowed_attrs
:
if
attr
==
'
attachments
'
:
continue
attrs
[
attr
]
=
getattr
(
self
,
attr
)
return
attrs
def
_repr_html_
(
self
):
def
_repr_html_
(
self
):
def
nvl
(
val
,
string
=
''
):
def
nvl
(
val
,
string
=
''
):
if
val
is
None
:
if
val
is
None
:
...
...
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