Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Discuss Data Project
Discuss Data
Commits
8d3ffde3
Commit
8d3ffde3
authored
Mar 30, 2021
by
felix.herrmann
Browse files
fix(mails): add more error logging
parent
55be2b8b
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
discuss_data/dddatasets/models.py
View file @
8d3ffde3
...
...
@@ -510,6 +510,7 @@ class DataSetPublicationRequest(models.Model):
)
def
save
(
self
,
*
args
,
**
kwargs
):
logger
.
error
(
"[DataSetPublicationRequest] start save"
)
# send notification on save
ct
=
ContentType
.
objects
.
get_for_model
(
self
.
dataset
)
text
=
_
(
"Publication request for category {}"
.
format
(
self
.
category
))
...
...
@@ -520,7 +521,9 @@ class DataSetPublicationRequest(models.Model):
text
=
text
,
notification_type
=
Notification
.
PUB_REQUEST
,
)
logger
.
error
(
"[DataSetPublicationRequest] notification save"
)
notification
.
save
()
logger
.
error
(
"[DataSetPublicationRequest] notification saved"
)
self
.
notification
=
notification
# send email to all curators
...
...
@@ -1333,6 +1336,7 @@ class DataSet(models.Model):
return
settings
.
DD_LICENSE_MATRIX
[
self
.
data_access
]
def
request_publication
(
self
,
user
):
logger
.
error
(
"in request publication"
)
pub_request
=
DataSetPublicationRequest
.
objects
.
filter
(
dataset
=
self
,
user
=
user
)
# TODO: add a check for compatibility between access model and chosen license
if
not
self
.
published
:
...
...
@@ -1345,13 +1349,17 @@ class DataSet(models.Model):
self
.
privacy_rights_declaration_text
=
(
self
.
PRIVACY_RIGHTS_DECLARATION_STRING
)
logger
.
error
(
"save ds"
)
self
.
save
()
logger
.
error
(
"saved ds"
)
# trigger publication request
pubreq
=
DataSetPublicationRequest
()
pubreq
.
dataset
=
self
pubreq
.
user
=
user
pubreq
.
category
=
self
.
get_main_category
()
logger
.
error
(
"save pubreq"
)
pubreq
.
save
()
logger
.
error
(
"saved pubreq"
)
return
_
(
"Dataset publication requested"
)
else
:
...
...
discuss_data/dddatasets/views/prep.py
View file @
8d3ffde3
...
...
@@ -1640,6 +1640,7 @@ def edit_publish_request(request, ds_uuid):
ds
=
get_object_or_404
(
DataSet
,
uuid
=
ds_uuid
)
manpage
=
get_man_page
(
"dataset-publish-request"
)
if
not
check_perms
(
"admin_dsmo"
,
request
.
user
,
ds
.
dataset_management_object
):
logger
.
error
(
"access denied"
)
return
HttpResponse
(
_
(
"Access denied"
))
# check_perms_403("admin_dataset", request.user, ds.dataset_management_object)
if
ds
.
is_frozen
():
...
...
@@ -1647,13 +1648,18 @@ def edit_publish_request(request, ds_uuid):
if
request
.
method
==
"POST"
:
# run checks
logger
.
error
(
"POST publish request"
)
check_error
,
check_list
=
ds
.
perform_checks
()
logger
.
error
(
check_error
)
if
check_error
:
error_string
=
_
(
"Errors ocurred, please fix: "
)
+
" "
.
join
(
check_list
)
publish_message
=
error_string
logger
.
error
(
error_string
)
messages
.
error
(
request
,
error_string
)
else
:
logger
.
error
(
"start request_publication"
)
publish_message
=
ds
.
request_publication
(
request
.
user
)
logger
.
error
(
"end request_publication"
)
return
edit_versions
(
request
,
ds_uuid
)
else
:
publish_message
=
None
...
...
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