#NEWLINE# @ admin_required #NEWLINE# def compat( request ) : #NEWLINE# #INDENT# APP = amo . FIREFOX #NEWLINE# VER = amo . COMPAT [ 0 ] [ 'main' ] #NEWLINE# minimum = 10 #NEWLINE# ratio = 0.8 #NEWLINE# binary = None #NEWLINE# initial = { #NEWLINE# #INDENT# 'appver' : ( '%s-%s' % ( APP . id , VER ) ) , #NEWLINE# 'minimum' : minimum , #NEWLINE# 'ratio' : ratio , #NEWLINE# 'type' : 'all' , #NEWLINE# #UNINDENT# } #NEWLINE# initial . update ( request . GET . items ( ) ) #NEWLINE# form = CompatForm ( initial ) #NEWLINE# if ( request . GET and form . is_valid ( ) ) : #NEWLINE# #INDENT# ( APP , VER ) = form . cleaned_data [ 'appver' ] . split ( '-' ) #NEWLINE# APP = amo . APP_IDS [ int ( APP ) ] #NEWLINE# if ( form . cleaned_data [ 'ratio' ] is not None ) : #NEWLINE# #INDENT# ratio = float ( form . cleaned_data [ 'ratio' ] ) #NEWLINE# #UNINDENT# if ( form . cleaned_data [ 'minimum' ] is not None ) : #NEWLINE# #INDENT# minimum = int ( form . cleaned_data [ 'minimum' ] ) #NEWLINE# #UNINDENT# if ( form . cleaned_data [ 'type' ] == 'binary' ) : #NEWLINE# #INDENT# binary = True #NEWLINE# #UNINDENT# #UNINDENT# ( app , ver ) = ( str ( APP . id ) , VER ) #NEWLINE# ( usage_addons , usage_total ) = compat_stats ( request , app , ver , minimum , APP , binary ) #NEWLINE# return render ( request , 'zadmin/compat.html' , { #NEWLINE# #INDENT# 'app' : APP , #NEWLINE# 'version' : VER , #NEWLINE# 'form' : form , #NEWLINE# 'usage_addons' : usage_addons , #NEWLINE# 'usage_total' : usage_total , #NEWLINE# #UNINDENT# } )