<s> from __future__ import absolute_import <EOL> from django . contrib import messages <EOL> from django . core . urlresolvers import reverse <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> from sentry import app , features <EOL> from sentry . quotas . base import Quota <EOL> from sentry . web . forms . projects import ProjectQuotasForm <EOL> from sentry . web . frontend . base import ProjectView <EOL> ERR_NO_SSO = _ ( '<STR_LIT>' ) <EOL> class ProjectQuotasView ( ProjectView ) : <EOL> required_scope = '<STR_LIT>' <EOL> def handle ( self , request , organization , team , project ) : <EOL> if not features . has ( '<STR_LIT>' , project , actor = request . user ) : <EOL> messages . add_message ( <EOL> request , messages . ERROR , <EOL> ERR_NO_SSO , <EOL> ) <EOL> redirect = reverse ( '<STR_LIT>' , <EOL> args = [ organization . slug , project . slug ] ) <EOL> return self . redirect ( redirect ) <EOL> form = ProjectQuotasForm ( project , request . POST or None ) <EOL> if form and form . is_valid ( ) : <EOL> form . save ( ) <EOL> messages . add_message ( <EOL> request , messages . SUCCESS , <EOL> _ ( '<STR_LIT>' ) ) <EOL> return self . redirect ( reverse ( '<STR_LIT>' , args = [ project . organization . slug , project . slug ] ) ) <EOL> context = { <EOL> '<STR_LIT>' : organization , <EOL> '<STR_LIT>' : project . team , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : type ( app . quotas ) != Quota , <EOL> '<STR_LIT>' : int ( app . quotas . get_organization_quota ( project . organization ) ) , <EOL> '<STR_LIT>' : project , <EOL> '<STR_LIT>' : form , <EOL> } <EOL> return self . respond ( '<STR_LIT>' , context ) </s>
