changeset 143:b339275b682f

The thumbnail should now get re-generated whenever the header/footer images change, though I haven't actually tested the code yet.
author Atul Varma <varmaa@toolness.com>
date Fri, 04 Apr 2008 07:47:00 -0700
parents 0ed4865bee45
children c718e2f5d0d2
files personasbackend/personas/models.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/personasbackend/personas/models.py	Fri Apr 04 07:41:02 2008 -0700
+++ b/personasbackend/personas/models.py	Fri Apr 04 07:47:00 2008 -0700
@@ -340,6 +340,10 @@
                              os.path.basename(abspath))
                 )
 
+    def __clear_thumbnail( self ):
+        if os.path.exists( self.thumbnail_filename ):
+            os.remove( self.thumbnail_filename )
+
     def __get_thumbnail_filename( self ):
         return os.path.join( settings.MEDIA_ROOT,
                              THUMBNAIL_DIR,
@@ -586,6 +590,10 @@
                  (self.status == "published") ):
                 self.date_published = datetime.datetime.now()
 
+            if ( (original.header_img != self.header_img) or
+                 (original.footer_img != self.footer_img) ):
+                self.__clear_thumbnail()
+
             self.__make_new_revision()
 
         super(Persona, self).save()