Code

Ticket #20780: 0001-Fix-collectstatic-link-when-dangling-symlink-exists.patch

File 0001-Fix-collectstatic-link-when-dangling-symlink-exists.patch, 1.1 KB (added by johngian, 11 months ago)
  • django/contrib/staticfiles/management/commands/collectstatic.py

    From cbf2f59004819b1f96c466f3b9f7e94c09a15cbf Mon Sep 17 00:00:00 2001
    From: John Giannelos <johngiannelos@gmail.com>
    Date: Sun, 4 Aug 2013 19:02:49 +0300
    Subject: [PATCH] Fix collectstatic --link when dangling symlink exists
    
    ---
     django/contrib/staticfiles/management/commands/collectstatic.py |    5 ++++-
     1 file changed, 4 insertions(+), 1 deletion(-)
    
    diff --git a/django/contrib/staticfiles/management/commands/collectstatic.py b/django/contrib/staticfiles/management/commands/collectstatic.py
    index c1e9fa8..2072695 100644
    a b Type 'yes' to continue, or 'no' to cancel: """ 
    273273                os.makedirs(os.path.dirname(full_path)) 
    274274            except OSError: 
    275275                pass 
    276             os.symlink(source_path, full_path) 
     276            try: 
     277                os.symlink(source_path, full_path) 
     278            except OSError: 
     279                pass 
    277280        if prefixed_path not in self.symlinked_files: 
    278281            self.symlinked_files.append(prefixed_path) 
    279282