@task
@write
def save_theme(header, footer, addon, **kw):
 dst_root = os.path.join(user_media_path('addons'), str(addon.id))
 header = os.path.join(settings.TMP_PATH, 'persona_header', header)
 header_dst = os.path.join(dst_root, 'header.png')
 if footer:
  footer = os.path.join(settings.TMP_PATH, 'persona_footer', footer)
  footer_dst = os.path.join(dst_root, 'footer.png')
 try:
  save_persona_image(src=header, full_dst=header_dst)
  if footer:
   save_persona_image(src=footer, full_dst=footer_dst)
  create_persona_preview_images(src=header, full_dst=[os.path.join(dst_root, 'preview.png'), os.path.join(dst_root, 'icon.png')], set_modified_on=[addon])
  theme_checksum(addon.persona)
 except IOError:
  addon.delete()
  raise

@ task @ write def save_theme ( header , footer , addon , ** kw ) : dst_root = os . path . join ( user_media_path ( 'addons' ) , str ( addon . id ) ) header = os . path . join ( settings . TMP_PATH , 'persona_header' , header ) header_dst = os . path . join ( dst_root , 'header.png' ) if footer : footer = os . path . join ( settings . TMP_PATH , 'persona_footer' , footer ) footer_dst = os . path . join ( dst_root , 'footer.png' ) try : save_persona_image ( src = header , full_dst = header_dst ) if footer : save_persona_image ( src = footer , full_dst = footer_dst ) create_persona_preview_images ( src = header , full_dst = [ os . path . join ( dst_root , 'preview.png' ) , os . path . join ( dst_root , 'icon.png' ) ] , set_modified_on = [ addon ] ) theme_checksum ( addon . persona ) except IOError : addon . delete ( ) raise
save theme image and calculates checksum after theme save .