launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #05300
[Merge] lp:~rye/python-oops-tools/oopsloader-update-date-when-needed into lp:python-oops-tools
Roman Yepishev has proposed merging lp:~rye/python-oops-tools/oopsloader-update-date-when-needed into lp:python-oops-tools.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #879491 in python-oops-tools: "dboopsloader.py updates entry.date even if it does not change"
https://bugs.launchpad.net/python-oops-tools/+bug/879491
For more details, see:
https://code.launchpad.net/~rye/python-oops-tools/oopsloader-update-date-when-needed/+merge/80079
Update the date only if it differs from the currently stored value.
--
https://code.launchpad.net/~rye/python-oops-tools/oopsloader-update-date-when-needed/+merge/80079
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rye/python-oops-tools/oopsloader-update-date-when-needed into lp:python-oops-tools.
=== modified file 'src/oopstools/oops/dboopsloader.py'
--- src/oopstools/oops/dboopsloader.py 2011-10-13 20:18:51 +0000
+++ src/oopstools/oops/dboopsloader.py 2011-10-21 15:18:26 +0000
@@ -151,10 +151,12 @@
oops = self._load_oops(datedir, filename)
if oops is not None:
yield oops
- # We do this every time because scripts that use
- # it (update_db.py) might stop after any oops.
- entry.last_date = date
- entry.save()
+ # We update the last_date only when oops
+ # has the date different to what we already have
+ # This speeds up the loading process
+ if entry.last_date != date:
+ entry.last_date = date
+ entry.save()
date += datetime.timedelta(days=1)
def _load_oops(self, datedir, filename):