<s> from django . conf import settings <EOL> class Middleware ( object ) : <EOL> def process_request ( self , request ) : <EOL> if '<STR_LIT>' not in request . COOKIES : <EOL> return <EOL> conn_id = int ( request . COOKIES [ '<STR_LIT>' ] ) <EOL> request . connection = settings . BEANSTALK_SERVERS [ conn_id ] <EOL> def ContextProcessor ( request ) : <EOL> if '<STR_LIT>' not in request . COOKIES : <EOL> conn_id = None <EOL> else : <EOL> conn_id = int ( request . COOKIES [ '<STR_LIT>' ] ) <EOL> return { '<STR_LIT>' : settings . BEANSTALK_SERVERS , '<STR_LIT>' : conn_id } </s>
