def origin_db_puts_posts(self, env, req):
        """
        Handles PUTs and POSTs into Origin database
        """
        try:
            vsn, account, container = split_path(req.path, 3, 3)
        except ValueError, e:
            return HTTPBadRequest()
        hsh = self.hash_path(account, container)
        cdn_obj_path = self.get_hsh_obj_path(hsh)
        ttl, cdn_enabled, logs_enabled = self.default_ttl, True, False
        hash_data = self.get_cdn_data(env, cdn_obj_path)
        if hash_data:
            ttl = hash_data.ttl
            cdn_enabled = hash_data.cdn_enabled
            logs_enabled = hash_data.logs_enabled
        else:
            if req.method == 'POST':
                return HTTPNotFound(request=req)
        try:
            ttl = int(req.headers.get('X-TTL', ttl))
        except ValueError:
            return HTTPBadRequest(_('Invalid X-TTL, must be integer'))
        ttl = min(max(ttl, self.min_ttl), self.max_ttl)
        if 'X-Log-Retention' in req.headers:
            logs_enabled = req.headers.get('X-Log-Retention').lower() in \
                TRUE_VALUES
        if 'X-CDN-Enabled' in req.headers:
            cdn_enabled = req.headers.get('X-CDN-Enabled').lower() in \
                TRUE_VALUES
        new_hash_data = HashData(account, container, ttl, cdn_enabled,
                                 logs_enabled)
        if hash_data and hash_data == new_hash_data:
            cdn_url_headers = self.get_cdn_urls(hsh, 'HEAD')
            return HTTPAccepted(request=req,
                                headers=cdn_url_headers)

        self._set_hash_data(env, cdn_obj_path, new_hash_data)

        # PUTs and POSTs have the headers as HEAD
        cdn_url_headers = self.get_cdn_urls(hsh, 'HEAD')
        if req.method == 'POST':
            resp = HTTPAccepted(request=req,
                                headers=cdn_url_headers)
        else:
            resp = HTTPCreated(request=req,
                               headers=cdn_url_headers)
        listing_content_type = new_hash_data.gen_listing_content_type()
        resp.extra_log_data = listing_content_type
        return resp
dataset/ETHPy150Open dpgoetz/sos/sos/origin.py/OriginDbHandler.origin_db_puts_posts/original