Merged in [19949] from rjsparks@nostrum.com:
Use tempfiles while rebuilding group and doc alias files. Fixes #3521.
- Legacy-Id: 19958
Note: SVN reference [19949] has been migrated to Git commit d6298adacb
This commit is contained in:
commit
3fa90e7517
|
@ -10,6 +10,8 @@ import os
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
from tempfile import mkstemp
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
|
@ -102,8 +104,13 @@ class Command(BaseCommand):
|
||||||
date = time.strftime("%Y-%m-%d_%H:%M:%S")
|
date = time.strftime("%Y-%m-%d_%H:%M:%S")
|
||||||
signature = '# Generated by %s at %s\n' % (os.path.abspath(__file__), date)
|
signature = '# Generated by %s at %s\n' % (os.path.abspath(__file__), date)
|
||||||
|
|
||||||
afile = io.open(settings.DRAFT_ALIASES_PATH, "w")
|
ahandle, aname = mkstemp()
|
||||||
vfile = io.open(settings.DRAFT_VIRTUAL_PATH, "w")
|
os.close(ahandle)
|
||||||
|
afile = io.open(aname,"w")
|
||||||
|
|
||||||
|
vhandle, vname = mkstemp()
|
||||||
|
os.close(vhandle)
|
||||||
|
vfile = io.open(vname,"w")
|
||||||
|
|
||||||
afile.write(signature)
|
afile.write(signature)
|
||||||
vfile.write(signature)
|
vfile.write(signature)
|
||||||
|
@ -161,3 +168,7 @@ class Command(BaseCommand):
|
||||||
afile.close()
|
afile.close()
|
||||||
vfile.close()
|
vfile.close()
|
||||||
|
|
||||||
|
os.rename(aname, settings.DRAFT_ALIASES_PATH)
|
||||||
|
os.rename(vname, settings.DRAFT_VIRTUAL_PATH)
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ import io
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
from tempfile import mkstemp
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
|
@ -40,8 +42,13 @@ class Command(BaseCommand):
|
||||||
date = time.strftime("%Y-%m-%d_%H:%M:%S")
|
date = time.strftime("%Y-%m-%d_%H:%M:%S")
|
||||||
signature = '# Generated by %s at %s\n' % (os.path.abspath(__file__), date)
|
signature = '# Generated by %s at %s\n' % (os.path.abspath(__file__), date)
|
||||||
|
|
||||||
afile = io.open(settings.GROUP_ALIASES_PATH, "w")
|
ahandle, aname = mkstemp()
|
||||||
vfile = io.open(settings.GROUP_VIRTUAL_PATH, "w")
|
os.close(ahandle)
|
||||||
|
afile = io.open(aname,"w")
|
||||||
|
|
||||||
|
vhandle, vname = mkstemp()
|
||||||
|
os.close(vhandle)
|
||||||
|
vfile = io.open(vname,"w")
|
||||||
|
|
||||||
afile.write(signature)
|
afile.write(signature)
|
||||||
vfile.write(signature)
|
vfile.write(signature)
|
||||||
|
@ -87,3 +94,6 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
afile.close()
|
afile.close()
|
||||||
vfile.close()
|
vfile.close()
|
||||||
|
|
||||||
|
os.rename(aname, settings.GROUP_ALIASES_PATH)
|
||||||
|
os.rename(vname, settings.GROUP_VIRTUAL_PATH)
|
||||||
|
|
Loading…
Reference in a new issue