<s> from girder import events <EOL> from girder . models . model_base import ValidationException <EOL> from . import constants <EOL> from . quota import QuotaPolicy , ValidateSizeQuota <EOL> def validateSettings ( event ) : <EOL> key , val = event . info [ '<STR_LIT:key>' ] , event . info [ '<STR_LIT:value>' ] <EOL> if key in ( constants . PluginSettings . QUOTA_DEFAULT_USER_QUOTA , <EOL> constants . PluginSettings . QUOTA_DEFAULT_COLLECTION_QUOTA ) : <EOL> ( val , err ) = ValidateSizeQuota ( val ) <EOL> if err : <EOL> raise ValidationException ( err , '<STR_LIT:value>' ) <EOL> event . info [ '<STR_LIT:value>' ] = val <EOL> event . preventDefault ( ) . stopPropagation ( ) <EOL> def load ( info ) : <EOL> quota = QuotaPolicy ( ) <EOL> info [ '<STR_LIT>' ] . collection . route ( '<STR_LIT:GET>' , ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> quota . getCollectionQuota ) <EOL> info [ '<STR_LIT>' ] . collection . route ( '<STR_LIT>' , ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> quota . setCollectionQuota ) <EOL> info [ '<STR_LIT>' ] . user . route ( '<STR_LIT:GET>' , ( '<STR_LIT>' , '<STR_LIT>' ) , quota . getUserQuota ) <EOL> info [ '<STR_LIT>' ] . user . route ( '<STR_LIT>' , ( '<STR_LIT>' , '<STR_LIT>' ) , quota . setUserQuota ) <EOL> events . bind ( '<STR_LIT>' , '<STR_LIT>' , validateSettings ) <EOL> events . bind ( '<STR_LIT>' , '<STR_LIT>' , <EOL> quota . getUploadAssetstore ) <EOL> events . bind ( '<STR_LIT>' , '<STR_LIT>' , quota . checkUploadStart ) <EOL> events . bind ( '<STR_LIT>' , '<STR_LIT>' , <EOL> quota . checkUploadFinalize ) </s>
