From 2dc20bb56e83c3420cdd9715de6a0f9334f1eab8 Mon Sep 17 00:00:00 2001 From: Andres Moreira Date: Thu, 11 Sep 2008 16:35:50 +0000 Subject: [PATCH] Fixed condition of new option --quiet. --HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40226 --- .../trunk/scrapy/command/commands/replay.py | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/scrapy/trunk/scrapy/command/commands/replay.py b/scrapy/trunk/scrapy/command/commands/replay.py index f40993e80..36dbdcf43 100644 --- a/scrapy/trunk/scrapy/command/commands/replay.py +++ b/scrapy/trunk/scrapy/command/commands/replay.py @@ -118,29 +118,34 @@ class Command(ScrapyCommand): guids_missing = guids_before - guids_now guids_both = guids_now & guids_before - chcount, chreport = self._report_differences(self.before_db, self.now_db, guids_both) + changed_items, chreport = self._report_differences(self.before_db, self.now_db, guids_both) - if chcount == 0 and opts.quiet: + ok_items = len(guids_both) - changed_items + new_items = len(guids_new) + missing_items = len(guids_missing) + + if (new_items - missing_items - changed_items) == 0 and opts.quiet: s = "" else: s = "CRAWLING DIFFERENCES REPORT\n\n" - s += "Total items : %d\n" % (len(guids_both) + len(guids_new) + len(guids_missing)) - s += " Items OK : %d\n" % (len(guids_both) - chcount) - s += " New items : %d\n" % len(guids_new) - s += " Missing items : %d\n" % len(guids_missing) - s += " Changed items : %d\n" % chcount + s += "Total items : %d\n" % (len(guids_both) + new_items + missing_items) + s += " Items OK : %d\n" % ok_items + s += " New items : %d\n" % new_items + s += " Missing items : %d\n" % missing_items + s += " Changed items : %d\n" % changed_items s += "\n" - s += "- NEW ITEMS (%d) -----------------------------------------\n" % len(guids_new) + s += "- NEW ITEMS (%d) -----------------------------------------\n" % new_items s += self._format_items([self.now_db[g] for g in guids_new]) s += "\n" - s += "- MISSING ITEMS (%d) -------------------------------------\n" % len(guids_missing) + s += "- MISSING ITEMS (%d) -------------------------------------\n" % missing_items s += self._format_items([self.before_db[g] for g in guids_missing]) s += "\n" - s += "- CHANGED ITEMS (%d) -------------------------------------\n" % chcount + s += "- CHANGED ITEMS (%d) -------------------------------------\n" % changed_items + s += chreport return s