Commit f21603bdcdfa74d140dc29d75367f3e47f4063e5
Exists in
plugin_extra_configs
Merge branch 'fixed_noosfero_data_api' into 'master'
Fixed noosfero data api See merge request !95
Showing
1 changed file
with
6 additions
and
0 deletions
Show diff stats
colab/plugins/noosfero/data_importer.py
| @@ -67,6 +67,9 @@ class NoosferoDataImporter(PluginDataImporter): | @@ -67,6 +67,9 @@ class NoosferoDataImporter(PluginDataImporter): | ||
| 67 | def fetch_communities(self): | 67 | def fetch_communities(self): |
| 68 | json_data = self.get_json_data('/api/v1/communities', 1) | 68 | json_data = self.get_json_data('/api/v1/communities', 1) |
| 69 | 69 | ||
| 70 | + if len(json_data) == 0: | ||
| 71 | + return | ||
| 72 | + | ||
| 70 | json_data = json_data['communities'] | 73 | json_data = json_data['communities'] |
| 71 | for element in json_data: | 74 | for element in json_data: |
| 72 | community = NoosferoCommunity() | 75 | community = NoosferoCommunity() |
| @@ -82,6 +85,9 @@ class NoosferoDataImporter(PluginDataImporter): | @@ -82,6 +85,9 @@ class NoosferoDataImporter(PluginDataImporter): | ||
| 82 | def fetch_articles(self): | 85 | def fetch_articles(self): |
| 83 | json_data = self.get_json_data('/api/v1/articles', 1) | 86 | json_data = self.get_json_data('/api/v1/articles', 1) |
| 84 | 87 | ||
| 88 | + if len(json_data) == 0: | ||
| 89 | + return | ||
| 90 | + | ||
| 85 | json_data = json_data['articles'] | 91 | json_data = json_data['articles'] |
| 86 | 92 | ||
| 87 | for element in json_data: | 93 | for element in json_data: |