equal
deleted
inserted
replaced
1 from django.db import models |
1 from django.db import models |
2 from django.conf import settings |
2 from django.conf import settings |
3 from ldt.core.models import Document, Owner |
3 from ldt.core.models import Document, Owner |
4 from django.utils.translation import ugettext_lazy as _ |
4 from django.utils.translation import ugettext_lazy as _ |
5 from utils import create_ldt, copy_ldt, create_empty_iri |
5 from utils import create_ldt, copy_ldt, create_empty_iri, update_iri |
6 import os |
|
7 import os.path |
6 import os.path |
8 import uuid |
7 import uuid |
9 import xml |
8 import xml |
10 |
9 |
11 class Author(models.Model): |
10 class Author(models.Model): |
56 dir = os.path.dirname(iri_file_path) |
55 dir = os.path.dirname(iri_file_path) |
57 if not os.path.exists(dir): |
56 if not os.path.exists(dir): |
58 os.makedirs(dir) |
57 os.makedirs(dir) |
59 file = open(iri_file_path,"w") |
58 file = open(iri_file_path,"w") |
60 create_empty_iri(file, self, "IRI") |
59 create_empty_iri(file, self, "IRI") |
|
60 else: |
|
61 update_iri(iri_file_path, self, "IRI") |
|
62 |
61 except Exception, e: |
63 except Exception, e: |
62 if os.path.exists(iri_file_path): |
64 if os.path.exists(iri_file_path): |
63 os.remove(iri_file_path) |
65 os.remove(iri_file_path) |
64 raise e |
66 raise e |
65 # update it |
67 # update it |