From 1beba94f20301e5e1503db2d6d255e580ae15fad Mon Sep 17 00:00:00 2001
From: Martin Langhoff <martin@laptop.org>
Date: Sat, 5 Dec 2009 19:20:32 +0000
Subject: [PATCH 4/4] Removable disk: delete preview and metadata dlo#9657
---
src/jarabe/journal/model.py | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
index 00b535e..ecb9ba7 100644
a
|
b
|
def delete(object_id): |
507 | 507 | """ |
508 | 508 | if os.path.exists(object_id): |
509 | 509 | os.unlink(object_id) |
| 510 | dir_path = os.path.dirname(object_id) |
| 511 | fname = os.path.basename(object_id) |
| 512 | old_files = [ os.path.join(dir_path, |
| 513 | '.'+fname+'.metadata'), |
| 514 | os.path.join(dir_path, |
| 515 | '.'+fname+'.preview') ] |
| 516 | for ofile in old_files: |
| 517 | if os.path.exists(ofile): |
| 518 | try: |
| 519 | os.unlink(ofile) |
| 520 | except: |
| 521 | pass |
510 | 522 | else: |
511 | 523 | _get_datastore().delete(object_id) |
512 | 524 | |
513 | | - |