[odrs-web] Break a circular dependency when reparenting components
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [odrs-web] Break a circular dependency when reparenting components
- Date: Fri, 5 Jul 2019 15:35:56 +0000 (UTC)
commit a2be1e54d6b073f237c6501ef734855e0931a71e
Author: Richard Hughes <richard hughsie com>
Date: Fri Jul 5 16:35:50 2019 +0100
Break a circular dependency when reparenting components
app_data/cron.py | 2 +-
app_data/odrs/models.py | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/app_data/cron.py b/app_data/cron.py
index d1b35ef..c69e1f2 100755
--- a/app_data/cron.py
+++ b/app_data/cron.py
@@ -91,9 +91,9 @@ def _appstream_import(fn):
continue
parent = app_ids[app_id]
for child in children:
- parent.adopt(child)
print('adding AppStream parent for {} -> {}'.format(child.app_id,
parent.app_id))
+ parent.adopt(child)
db.session.commit()
def _taboo_import(fn):
diff --git a/app_data/odrs/models.py b/app_data/odrs/models.py
index bcac095..de7f994 100644
--- a/app_data/odrs/models.py
+++ b/app_data/odrs/models.py
@@ -162,14 +162,15 @@ class Component(db.Model):
def adopt(self, child):
- # set the child parent
- child.component_id_parent = self.component_id
-
# adopt any of the childs existing children
adopted = 0
for component in child.children:
component.component_id_parent = self.component_id
adopted += 1
+
+ # set the child parent
+ child.component_id_parent = self.component_id
+
return adopted
def __repr__(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]