-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from oarepo/miroslavsimek/be-232-request-type-f…
…or-edit-published-record edit action
- Loading branch information
Showing
11 changed files
with
57 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,3 +89,6 @@ dist/ | |
|
||
.model_venv/ | ||
.vscode | ||
|
||
tests/thesis | ||
thesis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from invenio_records_resources.services.uow import RecordDeleteOp | ||
|
||
# from .generic import AcceptAction | ||
from invenio_requests.customizations import actions | ||
|
||
from ..utils import get_matching_service_for_record | ||
|
||
|
||
class EditTopicAcceptAction(actions.AcceptAction): | ||
log_event = True | ||
|
||
def execute(self, identity, uow): | ||
topic = self.request.topic.resolve() | ||
topic_service = get_matching_service_for_record(topic) | ||
if not topic_service: | ||
raise KeyError(f"topic {topic} service not found") | ||
topic_service.edit(identity, topic.id, uow=uow) | ||
super().execute(identity, uow) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from invenio_requests.customizations import RequestType | ||
|
||
from oarepo_requests.actions.edit_topic import EditTopicAcceptAction | ||
|
||
from .generic import OARepoRequestType | ||
|
||
from oarepo_runtime.i18n import lazy_gettext as _ | ||
|
||
|
||
class EditRecordRequestType(OARepoRequestType): | ||
available_actions = { | ||
**RequestType.available_actions, | ||
"accept": EditTopicAcceptAction, | ||
} | ||
description = _("Request re-opening of published record") | ||
receiver_can_be_none = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[metadata] | ||
name = oarepo-requests | ||
version = 1.1.2 | ||
version = 1.1.3 | ||
description = | ||
authors = Ronald Krist <[email protected]> | ||
readme = README.md | ||
|
@@ -12,10 +12,13 @@ long_description_content_type = text/markdown | |
python = >=3.9 | ||
install_requires = | ||
invenio-requests | ||
#packages = find: | ||
packages = find: | ||
|
||
[options.package_data] | ||
* = *.json, *.rst, *.md, *.json5, *.jinja2 | ||
* = *.json, *.rst, *.md, *.json5, *.jinja2, *.html, *.jinja | ||
|
||
[options.packages.find] | ||
exclude = thesis | ||
|
||
[options.extras_require] | ||
tests = | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,7 +84,7 @@ def _result(topic_id, request_id): | |
"reference": {"user": "1"}, | ||
"type": "user", | ||
}, | ||
"description": "request publishing of a draft", | ||
"description": "Request publishing of a draft", | ||
"expires_at": None, | ||
"id": request_id, | ||
"is_closed": False, | ||
|
@@ -253,27 +253,6 @@ def users(app, db): | |
db.session.commit() | ||
return [user1, user2] | ||
|
||
""" | ||
from invenio_db import db | ||
user1 = UserFixture( | ||
email="[email protected]", | ||
password="password", | ||
preferences={"visibility": "public"}, | ||
) | ||
user1.create(app, db) | ||
user2 = UserFixture( | ||
email="[email protected]", | ||
password="password", | ||
preferences={"visibility": "public"}, | ||
) | ||
user2.create(app, db) | ||
return [user1, user2] | ||
""" | ||
|
||
|
||
@pytest.fixture() | ||
def client_with_login(client, users): | ||
"""Log in a user to the client.""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters