File tree 2 files changed +11
-10
lines changed 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -99,12 +99,12 @@ def clean_slug(self):
99
99
return slug
100
100
101
101
def save (self , commit = True ):
102
- obj = super (). save ( commit = commit )
103
-
102
+ # If the slug was changed, and the version was active,
103
+ # we need to delete all the resources, since the old slug is used in several places.
104
104
if "slug" in self .changed_data and self ._was_active and self .instance .active :
105
- obj .recreate ()
106
- return obj
105
+ obj .clean_resources ()
107
106
107
+ obj = super ().save (commit = commit )
108
108
obj .post_save (was_active = self ._was_active )
109
109
return obj
110
110
Original file line number Diff line number Diff line change @@ -414,6 +414,7 @@ def clean_resources(self):
414
414
clean_project_resources (project = self .project , version = self )
415
415
self .built = False
416
416
self .save ()
417
+ self .purge_cdn ()
417
418
418
419
def post_save (self , was_active = False ):
419
420
"""
@@ -435,17 +436,17 @@ def post_save(self, was_active=False):
435
436
# If the version is deactivated, we need to clean up the files.
436
437
if was_active and not self .active :
437
438
self .clean_resources ()
439
+ return
438
440
# If the version is activated, we need to trigger a build.
439
441
if not was_active and self .active :
440
442
trigger_build (project = self .project , version = self )
441
- # Purge the cache from the CDN.
443
+ # Purge the cache from the CDN for any other changes.
444
+ self .purge_cdn ()
445
+
446
+ def purge_cdn (self ):
447
+ """Purge the cache from the CDN."""
442
448
version_changed .send (sender = self .__class__ , version = self )
443
449
444
- def recreate (self ):
445
- self .clean_resources ()
446
- trigger_build (project = self .project , version = self )
447
- version_changed .send (sender = self .__class__ , version = self )
448
-
449
450
@property
450
451
def identifier_friendly (self ):
451
452
"""Return display friendly identifier."""
You can’t perform that action at this time.
0 commit comments