def welcome_osf4m(email):
 from website.files.models import OsfStorageFileNode
 if email.user.date_last_login:
  if (email.user.date_last_login > (timezone.now() - settings.WELCOME_OSF4M_WAIT_TIME_GRACE)):
   return False
 upload = OsfStorageFileNode.load(email.data['fid'])
 if upload:
  email.data['downloads'] = upload.get_download_count()
 else:
  email.data['downloads'] = 0
 email.save()
 return True

def welcome_osf4m ( email ) : from website . files . models import OsfStorageFileNode if email . user . date_last_login : if ( email . user . date_last_login > ( timezone . now ( ) - settings . WELCOME_OSF4M_WAIT_TIME_GRACE ) ) : return False upload = OsfStorageFileNode . load ( email . data [ 'fid' ] ) if upload : email . data [ 'downloads' ] = upload . get_download_count ( ) else : email . data [ 'downloads' ] = 0 email . save ( ) return True
presend has two functions .