From 43e996d83d5aa5a3691fe24c6344e8f7ba5ae48a Mon Sep 17 00:00:00 2001 From: volpino Date: Fri, 8 Jun 2012 14:24:17 +0200 Subject: [PATCH] euscanwww: Fixed the upstream task that was completely broken Signed-off-by: volpino --- .../management/commands/scan_upstream.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/euscanwww/djeuscan/management/commands/scan_upstream.py b/euscanwww/djeuscan/management/commands/scan_upstream.py index 131ff1a..5cbdcb9 100644 --- a/euscanwww/djeuscan/management/commands/scan_upstream.py +++ b/euscanwww/djeuscan/management/commands/scan_upstream.py @@ -21,19 +21,27 @@ class ScanUpstream(object): def scan(self, package): CONFIG["format"] = "dict" output.set_query(package) - scan_upstream(package) + + ret = scan_upstream(package) + if ret is not None: + if len(ret) > 0: + for cp, url, version, handler, confidence in ret: + output.result(cp, version, url, handler, confidence) + out = output.get_formatted_output() out_json = output.get_formatted_output("json") try: - cp = out["metadata"]["cp"] + cpv = out[package]["metadata"]["cpv"] except KeyError: return {} - for out in out["result"]: - self.store_version(cp, out["version"], " ".join(out["urls"])) + obj = self.store_package(cpv) - self.store_result(cp, out_json) + for res in out[package]["result"]: + self.store_version(obj, res["version"], " ".join(res["urls"])) + + self.store_result(obj, out_json) return out