def upload_to_mugshot(instance, filename):
 extension = filename.split('.')[(-1)].lower()
 (salt, hash) = generate_sha1(instance.pk)
 path = (userena_settings.USERENA_MUGSHOT_PATH % {'username': instance.user.username, 'id': instance.user.id, 'date': instance.user.date_joined, 'date_now': get_datetime_now().date()})
 return ('%(path)s%(hash)s.%(extension)s' % {'path': path, 'hash': hash[:10], 'extension': extension})

def upload_to_mugshot ( instance , filename ) : extension = filename . split ( '.' ) [ ( - 1 ) ] . lower ( ) ( salt , hash ) = generate_sha1 ( instance . pk ) path = ( userena_settings . USERENA_MUGSHOT_PATH % { 'username' : instance . user . username , 'id' : instance . user . id , 'date' : instance . user . date_joined , 'date_now' : get_datetime_now ( ) . date ( ) } ) return ( '%(path)s%(hash)s.%(extension)s' % { 'path' : path , 'hash' : hash [ : 10 ] , 'extension' : extension } )
uploads a mugshot for a user to the userena_mugshot_path and saving it under unique hash for the image .