- Revision
- 16083
- Author
- morgen
- Date
- 2007-12-07 12:44:18 -0800 (Fri, 07 Dec 2007)
Log Message
Fix for bug 11606 (gracefully handle invalid triage codes from server) r=Grant
Modified Paths
Diff
Modified: trunk/chandler/parcels/osaf/sharing/Translator.txt (16082 => 16083)
--- trunk/chandler/parcels/osaf/sharing/Translator.txt 2007-12-07 20:12:42 UTC (rev 16082) +++ trunk/chandler/parcels/osaf/sharing/Translator.txt 2007-12-07 20:44:18 UTC (rev 16083) @@ -799,4 +799,32 @@ 'PT0S' + + + + +Verify that invalid triage codes are converted to "NOW":: + + >>> t.startImport() + + >>> item_rec = sharing.model.ItemRecord( + ... uuid='a9b019a4-d995-11db-f269-0016cbca6aea', + ... title='Bogus triage', + ... triage='-1 0 1', + ... createdOn=Decimal("1164803131"), + ... hasBeenSent=0, + ... needsReply=0, + ... read=0, + ... ) + >>> rs = sharing.Diff([item_rec]) + >>> t.importRecords(rs) + >>> t.finishImport() + >>> item = rv.findUUID('a9b019a4-d995-11db-f269-0016cbca6aea') + >>> item.triageStatus + TriageEnum.now + + + + + BackupOnQuitPrefsRecord type tests are in TestDumpReload.py
Modified: trunk/chandler/parcels/osaf/sharing/translator.py (16082 => 16083)
--- trunk/chandler/parcels/osaf/sharing/translator.py 2007-12-07 20:12:42 UTC (rev 16082) +++ trunk/chandler/parcels/osaf/sharing/translator.py 2007-12-07 20:44:18 UTC (rev 16083) @@ -581,7 +581,13 @@ if record.triage != "" and record.triage not in emptyValues: code, timestamp, auto = record.triage.split(" ") - item._triageStatus = code_to_triagestatus[code] + + try: + item._triageStatus = code_to_triagestatus[code] + except KeyError: + # assume NOW if illegal code (bug 11606) + item._triageStatus = code_to_triagestatus["100"] + item._triageStatusChanged = float(timestamp) if getattr(item, 'inheritFrom', False): # When import_event happens after import_item on recurring
_______________________________________________ Commits mailing list [email protected] http://lists.osafoundation.org/mailman/listinfo/commits
