diff -r 50ad1c57838e -r 8dbd741e3da6 web/ldt/ldt_utils/models.py --- a/web/ldt/ldt_utils/models.py Tue Jun 15 01:01:28 2010 +0200 +++ b/web/ldt/ldt_utils/models.py Tue Jun 15 01:32:34 2010 +0200 @@ -50,21 +50,25 @@ #TODO: better manage the change in .iri name and error scenario (save in temp file + rename def save(self): # create iri file if needed + created = False try: iri_file_path = self.iri_file_path() if not os.path.exists(iri_file_path): dir = os.path.dirname(iri_file_path) if not os.path.exists(dir): os.makedirs(dir) + created = True file = open(iri_file_path,"w") create_empty_iri(file, self, "IRI") else: + created = False update_iri(iri_file_path, self, "IRI") except Exception, e: - if os.path.exists(iri_file_path): - os.remove(iri_file_path) - raise e + if created: + if os.path.exists(iri_file_path): + os.remove(iri_file_path) + raise e # update it super(Content, self).save()