<s> from news import exceptions <EOL> from news . helpers import * <EOL> class ExceptionHandlerMiddleware : <EOL> def process_exception ( self , request , exptn ) : <EOL> from news import models <EOL> message = None <EOL> if exptn . __class__ == exceptions . PrivateTopicNoAccess : <EOL> message = '<STR_LIT>' <EOL> elif exptn . __class__ == models . CanNotVote : <EOL> message = '<STR_LIT>' <EOL> if not message : <EOL> return <EOL> return render ( request , { '<STR_LIT:message>' : message } , '<STR_LIT>' ) </s>
