loadandadddata remove temp files
authorcavaliet
Tue, 02 Apr 2013 12:27:40 +0200
changeset 1135 d294c6f552dc
parent 1134 e31dd7ea24bb
child 1142 6c61660e51a2
loadandadddata remove temp files
src/ldt/ldt/management/commands/loadandadddata.py
--- a/src/ldt/ldt/management/commands/loadandadddata.py	Tue Mar 26 14:49:29 2013 +0100
+++ b/src/ldt/ldt/management/commands/loadandadddata.py	Tue Apr 02 12:27:40 2013 +0200
@@ -224,6 +224,17 @@
             print("Loading permissions from temporary file %s ..." % path_file2)
             call_command("loaddata", path_file2)
             
+            # Remove temp files
+            print("Removing temporary files...")
+            try:
+                os.remove(path_file1)
+            except:
+                print("Removing temporary files %s failed" % path_file1)
+            try:
+                os.remove(path_file2)
+            except:
+                print("Removing temporary files %s failed" % path_file2)
+            
             # Now that all datas have been imported we can create the new group and assign permissions if asked
             new_group = options.get('new_group', None)
             if new_group and len(usernames)>0: