From da7de463318cfc4c703e9467acb0c18115b26272 Mon Sep 17 00:00:00 2001
From: "Antoine R. Dumont (@ardumont)" <antoine.romain.dumont@gmail.com>
Date: Wed, 17 Oct 2018 16:19:23 +0200
Subject: [PATCH] from-output-to-csv: Make the adapter a needed-basis

The new indexed data in error won't need this any more.

Related T1246#23691
---
 ardumont/from-output-to-csv.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/ardumont/from-output-to-csv.py b/ardumont/from-output-to-csv.py
index 9f6a75a..244ecb9 100755
--- a/ardumont/from-output-to-csv.py
+++ b/ardumont/from-output-to-csv.py
@@ -62,11 +62,12 @@ def main(task_policy, task_type):
             if 'visit_date' not in kwargs:
                 kwargs['visit_date'] = 'Tue, 3 May 2016 17:16:32 +0200'
         elif task_type == 'pypi':
-            # HACK: Need an adapter because loader.pypi.tasks and
-            # loader.pypi.loader have not the same signature ~> need
-            # some code fix
-            url = kwargs.pop('origin_metadata_url')
-            kwargs['project_metadata_url'] = url
+            # HACK: Need an adapter as long as T1246#23691 is not
+            # solved, we will need this (task and loader are now
+            # aligned but the indexed data is there)
+            if 'origin_metadata_url' in kwargs:
+                url = kwargs.pop('origin_metadata_url')
+                kwargs['project_metadata_url'] = url
 
         _task_kwargs = json.dumps(kwargs)
 
-- 
GitLab