projects
/
osm
/
NBI.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix(model): adaptations to allow new configuration containers
[osm/NBI.git]
/
osm_nbi
/
base_topic.py
diff --git
a/osm_nbi/base_topic.py
b/osm_nbi/base_topic.py
index
c67ec76
..
f597d17
100644
(file)
--- a/
osm_nbi/base_topic.py
+++ b/
osm_nbi/base_topic.py
@@
-231,10
+231,10
@@
class BaseTopic:
:param final_content: data once modified. This method may change it.
:param edit_content: incremental data that contains the modifications to apply
:param _id: internal _id
:param final_content: data once modified. This method may change it.
:param edit_content: incremental data that contains the modifications to apply
:param _id: internal _id
- :return:
None
or raises EngineException
+ :return:
final_content
or raises EngineException
"""
if not self.multiproject:
"""
if not self.multiproject:
- return
+ return
final_content
# Change public status
if session["public"] is not None:
if session["public"] and "ANY" not in final_content["_admin"]["projects_read"]:
# Change public status
if session["public"] is not None:
if session["public"] and "ANY" not in final_content["_admin"]["projects_read"]:
@@
-249,6
+249,8
@@
class BaseTopic:
if p not in final_content["_admin"]["projects_read"]:
final_content["_admin"]["projects_read"].append(p)
if p not in final_content["_admin"]["projects_read"]:
final_content["_admin"]["projects_read"].append(p)
+ return final_content
+
def check_unique_name(self, session, name, _id=None):
"""
Check that the name is unique for this project
def check_unique_name(self, session, name, _id=None):
"""
Check that the name is unique for this project
@@
-308,6
+310,7
@@
class BaseTopic:
def _send_msg(self, action, content, not_send_msg=None):
if self.topic_msg and not_send_msg is not False:
def _send_msg(self, action, content, not_send_msg=None):
if self.topic_msg and not_send_msg is not False:
+ content = content.copy()
content.pop("_admin", None)
if isinstance(not_send_msg, list):
not_send_msg.append((self.topic_msg, action, content))
content.pop("_admin", None)
if isinstance(not_send_msg, list):
not_send_msg.append((self.topic_msg, action, content))
@@
-577,19
+580,16
@@
class BaseTopic:
if indata and session.get("set_project"):
raise EngineException("Cannot edit content and set to project (query string SET_PROJECT) at same time",
HTTPStatus.UNPROCESSABLE_ENTITY)
if indata and session.get("set_project"):
raise EngineException("Cannot edit content and set to project (query string SET_PROJECT) at same time",
HTTPStatus.UNPROCESSABLE_ENTITY)
-
# TODO self._check_edition(session, indata, _id, force)
if not content:
content = self.show(session, _id)
# TODO self._check_edition(session, indata, _id, force)
if not content:
content = self.show(session, _id)
-
indata = self._validate_input_edit(indata, content, force=session["force"])
indata = self._validate_input_edit(indata, content, force=session["force"])
-
deep_update_rfc7396(content, indata)
# To allow project addressing by name AS WELL AS _id. Get the _id, just in case the provided one is a name
_id = content.get("_id") or _id
deep_update_rfc7396(content, indata)
# To allow project addressing by name AS WELL AS _id. Get the _id, just in case the provided one is a name
_id = content.get("_id") or _id
- self.check_conflict_on_edit(session, content, indata, _id=_id)
+
content =
self.check_conflict_on_edit(session, content, indata, _id=_id)
op_id = self.format_on_edit(content, indata)
self.db.replace(self.topic, _id, content)
op_id = self.format_on_edit(content, indata)
self.db.replace(self.topic, _id, content)