<s> '''<STR_LIT>''' <EOL> from django . utils import simplejson <EOL> from django . http import QueryDict <EOL> class JSONMixin ( object ) : <EOL> '''<STR_LIT>''' <EOL> def process_request ( self , request ) : <EOL> if '<STR_LIT:application/json>' in request . META [ '<STR_LIT>' ] . lower ( ) : <EOL> request . DATA = QueryDict ( '<STR_LIT>' , mutable = True ) <EOL> request . DATA . update ( simplejson . loads ( request . raw_post_data ) ) <EOL> return request <EOL> return super ( JSONMixin , self ) . process_request ( request ) <EOL> def process_response ( self , request , response , data , format ) : <EOL> if format == '<STR_LIT>' : <EOL> response . content = simplejson . dumps ( data ) <EOL> return response <EOL> return super ( JSONMixin , self ) . process_response ( request , response , data , format ) <EOL> class XMLMixin ( object ) : <EOL> '''<STR_LIT>''' <EOL> def process_request ( self , request ) : <EOL> if '<STR_LIT>' in request . META [ '<STR_LIT>' ] . lower ( ) : <EOL> raise NotImplementedError <EOL> return super ( XMLMixin , self ) . process_request ( request ) <EOL> def process_response ( self , request , response , data , format ) : <EOL> if format == '<STR_LIT>' : <EOL> raise NotImplementedError <EOL> return super ( XMLMixin , self ) . process_response ( request , response , data , format ) </s>
