<s> """<STR_LIT>""" <EOL> from rest_framework import serializers <EOL> from crash . models import Symbols , Crash <EOL> from crash . utils import parse_debug_meta_info <EOL> __all__ = [ '<STR_LIT>' ] <EOL> class SymbolsSerializer ( serializers . HyperlinkedModelSerializer ) : <EOL> file = serializers . FileField ( required = True ) <EOL> debug_id = serializers . CharField ( default = '<STR_LIT>' , required = False , allow_blank = True ) <EOL> debug_file = serializers . CharField ( default = '<STR_LIT>' , required = False , allow_blank = True ) <EOL> class Meta : <EOL> model = Symbols <EOL> fields = ( '<STR_LIT:id>' , '<STR_LIT:file>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> read_only_fields = ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> validators = [ <EOL> serializers . UniqueTogetherValidator ( <EOL> queryset = Symbols . objects . all ( ) , <EOL> fields = ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> ) <EOL> ] <EOL> def create ( self , validated_data ) : <EOL> if not validated_data . get ( '<STR_LIT>' ) or not validated_data . get ( '<STR_LIT>' ) : <EOL> file = validated_data [ '<STR_LIT:file>' ] <EOL> try : <EOL> head = file . readline ( ) . rstrip ( ) <EOL> meta = parse_debug_meta_info ( head , exception = serializers . ValidationError ) <EOL> validated_data . update ( meta ) <EOL> except : <EOL> raise serializers . ValidationError ( u"<STR_LIT>" ) <EOL> return super ( SymbolsSerializer , self ) . create ( validated_data ) <EOL> class CrashSerializer ( serializers . HyperlinkedModelSerializer ) : <EOL> meta = serializers . DictField ( ) <EOL> class Meta : <EOL> model = Crash <EOL> fields = ( '<STR_LIT:id>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , ) </s>
