#NEWLINE# def get_slug( request ) : #NEWLINE# #INDENT# 'Convert project name to slug.' #NEWLINE# log . debug ( 'Convert project name to slug.' ) #NEWLINE# if ( not request . user . has_perm ( 'base.can_manage' ) ) : #NEWLINE# #INDENT# log . error ( 'Insufficient privileges.' ) #NEWLINE# return HttpResponse ( 'error' ) #NEWLINE# #UNINDENT# if ( not request . is_ajax ( ) ) : #NEWLINE# #INDENT# log . error ( 'Non-AJAX request' ) #NEWLINE# return HttpResponse ( 'error' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# name = request . GET [ 'name' ] #NEWLINE# #UNINDENT# except MultiValueDictKeyError as e : #NEWLINE# #INDENT# log . error ( str ( e ) ) #NEWLINE# return HttpResponse ( 'error' ) #NEWLINE# #UNINDENT# log . debug ( ( 'Name: ' + name ) ) #NEWLINE# slug = slugify ( name ) #NEWLINE# log . debug ( ( 'Slug: ' + request ) ) #NEWLINE# return HttpResponse ( slug )