def put_profile(self, request_dict):
        #Get the profile, or if not already created, create one
        p,created = ActivityProfile.objects.get_or_create(profile_id=request_dict['params']['profileId'],activity_id=request_dict['params']['activityId'])
        
        # Profile being PUT is not json
        if "application/json" not in request_dict['headers']['CONTENT_TYPE']:
            try:
                profile = ContentFile(request_dict['profile'].read())
            except:
                try:
                    profile = ContentFile(request_dict['profile'])
                except:
                    profile = ContentFile(str(request_dict['profile']))

            # If a profile already existed with the profileId and activityId
            if not created:
                #If it already exists delete it
                etag.check_preconditions(request_dict,p, required=True)
                if p.profile:
                    try:
                        p.profile.delete()
                    except __HOLE__:
                        # probably was json before
                        p.json_profile = {}
            
            self.save_non_json_profile(p, created, profile, request_dict)
        # Profile being PUT is json
        else:
            # If a profile already existed with the profileId and activityId (overwrite existing profile data)
            if not created:
                etag.check_preconditions(request_dict, p, required=True)
            the_profile = request_dict['profile']
            p.json_profile = the_profile
            p.content_type = request_dict['headers']['CONTENT_TYPE']
            p.etag = etag.create_tag(the_profile)
            
            #Set updated
            if 'updated' in request_dict['headers'] and request_dict['headers']['updated']:
                p.updated = request_dict['headers']['updated']
            else:
                p.updated = datetime.datetime.utcnow().replace(tzinfo=utc)
            p.save()
dataset/ETHPy150Open adlnet/ADL_LRS/lrs/managers/ActivityProfileManager.py/ActivityProfileManager.put_profile