<commit_before>var SolBase = function() {
};


SolBase.prototype._getRestRoot = function() {
    return "/"+this._getRestPath()+"/";
};

SolBase.prototype._getData = function(uri) {
    console.trace();
    return;
    var connection = YAHOO.util.Connect;
    connection.syncRequest = Solstice.Remote.syncRequest;

    connection.initHeader("Accept", "application/json", false);
    connection.initHeader("X-XSRF-Token", solstice_xsrf_token, false);

    try {
        var response = connection.syncRequest('GET', uri, {}, '');
        var json = response.conn.responseText;
        return YAHOO.lang.JSON.parse(json);
    }
    catch(e) {
        Solstice.log(e);
        return;
    }
};

SolBase.prototype.GET = function(uri, obj) {
    console.trace();
//    return this._http('GET', uri, obj);
};

SolBase.prototype.POST = function(uri, obj) {
    console.trace();
//    return this._http('POST', uri, obj);
};

SolBase.prototype.PUT = function(uri, obj) {
    console.trace();
//   return this._http('PUT', uri, obj);
};

SolBase.prototype.DELETE = function(uri) {
    console.trace();
//    return this._http('DELETE', uri);
};

SolBase.prototype._http = function(method, uri, obj) {
    console.trace();
    return;
    var connection = YAHOO.util.Connect;
    connection.syncRequest = Solstice.Remote.syncRequest;
    connection._use_default_post_header = false;

    connection.initHeader("Accept", "application/json", true);
    connection.initHeader("Content-type", "application/json", true);
    connection.initHeader("X-XSRF-Token", solstice_xsrf_token, true);
    connection.initHeader("X-CSRFToken", $("input[name=csrfmiddlewaretoken]").val(), true);

    try {
        var response = connection.syncRequest(method, uri, {}, JSON.stringify(obj));
        connection._use_default_post_header = true;
        var response_code  = response.conn.status;
        var json = response.conn.responseText;
        return {
            code    : response_code,
            data    : JSON.parse(json),
            conn    : response.conn
        };
    }
    catch(e) {
        Solstice.log(e);
        return;
    }

};


SolBase.prototype.AsyncGET = function(uri, callback, arg) {
    return this._async_http('GET', uri, null, callback, arg);
};

SolBase.prototype.AsyncPOST = function(uri, obj, callback, arg) {
    return this._async_http('POST', uri, obj, callback, arg);
};

SolBase.prototype.AsyncPUT = function(uri, obj, callback, arg) {
   return this._async_http('PUT', uri, obj, callback, arg);
};

SolBase.prototype.AsyncDELETE = function(uri, callback, arg) {
    return this._async_http('DELETE', uri, null, callback, arg);
};


SolBase.prototype._async_http = function(method, uri, obj, callback, arg) {
    var connection = YAHOO.util.Connect;
    connection.setDefaultPostHeader(false);

    connection.initHeader("Accept", "application/json", false);
    connection.initHeader("Content-type", "application/json", false);
    connection.initHeader("X-XSRF-Token", solstice_xsrf_token, false);
    connection.initHeader("X-CSRFToken", $("input[name=csrfmiddlewaretoken]").val(), true);

    var callback = {
        cache: false,
        success: this._handleSuccess,
        failure: this._handleSuccess,
        argument: [this, callback, arg]
    };

    var request = connection.asyncRequest(method, uri, callback, JSON.stringify(obj));
    connection.setDefaultPostHeader(true);

    return request;

};

SolBase.prototype._handleSuccess = function(o) {
    var self = this.argument[0];
    var callback = this.argument[1];
    var arg = this.argument[2];

    var json;
    var status = o.status;
    if (o.responseText != "") {
        try {
            json = YAHOO.lang.JSON.parse(o.responseText);
        }
        catch (e) {
            status = 500;
            json = { error:"Error parsing response: "+e.message };
        };
    }

    callback.call(self, {
        code    : status,
        data    : json,
        conn    : o
    }, arg);
};


SolBase.prototype._renderTo = function() {
    var content;
    var div = arguments[0];
    if (arguments.length == 3) {
        var template = arguments[1];
        var params = arguments[2];
        try {
            var compiled = Solstice.CompiledTemplates.get(this._getApplication(), template);
            if (!compiled) {
                Solstice.CompiledTemplates.init(this._getApplication(), template);
                compiled = Solstice.CompiledTemplates.get(this._getApplication(), template);
            }

            $(div).html($.tmpl(this._getApplication()+"/"+template, this.params));
           // content = compiled.call(this._getApplication(), template, params);
        }
        catch (e) {
            Solstice.log(e);
            return;
        }
    }
    else if (arguments.length == 2) {
        var view = arguments[1];
        content = view.toString();
    }<commit_msg>Makes it so _renderTo works properly w/ the new templates<commit_after>var SolBase = function() {
};


SolBase.prototype._getRestRoot = function() {
    return "/"+this._getRestPath()+"/";
};

SolBase.prototype._getData = function(uri) {
    console.trace();
    return;
    var connection = YAHOO.util.Connect;
    connection.syncRequest = Solstice.Remote.syncRequest;

    connection.initHeader("Accept", "application/json", false);
    connection.initHeader("X-XSRF-Token", solstice_xsrf_token, false);

    try {
        var response = connection.syncRequest('GET', uri, {}, '');
        var json = response.conn.responseText;
        return YAHOO.lang.JSON.parse(json);
    }
    catch(e) {
        Solstice.log(e);
        return;
    }
};

SolBase.prototype.GET = function(uri, obj) {
    console.trace();
//    return this._http('GET', uri, obj);
};

SolBase.prototype.POST = function(uri, obj) {
    console.trace();
//    return this._http('POST', uri, obj);
};

SolBase.prototype.PUT = function(uri, obj) {
    console.trace();
//   return this._http('PUT', uri, obj);
};

SolBase.prototype.DELETE = function(uri) {
    console.trace();
//    return this._http('DELETE', uri);
};

SolBase.prototype._http = function(method, uri, obj) {
    console.trace();
    return;
    var connection = YAHOO.util.Connect;
    connection.syncRequest = Solstice.Remote.syncRequest;
    connection._use_default_post_header = false;

    connection.initHeader("Accept", "application/json", true);
    connection.initHeader("Content-type", "application/json", true);
    connection.initHeader("X-XSRF-Token", solstice_xsrf_token, true);
    connection.initHeader("X-CSRFToken", $("input[name=csrfmiddlewaretoken]").val(), true);

    try {
        var response = connection.syncRequest(method, uri, {}, JSON.stringify(obj));
        connection._use_default_post_header = true;
        var response_code  = response.conn.status;
        var json = response.conn.responseText;
        return {
            code    : response_code,
            data    : JSON.parse(json),
            conn    : response.conn
        };
    }
    catch(e) {
        Solstice.log(e);
        return;
    }

};


SolBase.prototype.AsyncGET = function(uri, callback, arg) {
    return this._async_http('GET', uri, null, callback, arg);
};

SolBase.prototype.AsyncPOST = function(uri, obj, callback, arg) {
    return this._async_http('POST', uri, obj, callback, arg);
};

SolBase.prototype.AsyncPUT = function(uri, obj, callback, arg) {
   return this._async_http('PUT', uri, obj, callback, arg);
};

SolBase.prototype.AsyncDELETE = function(uri, callback, arg) {
    return this._async_http('DELETE', uri, null, callback, arg);
};


SolBase.prototype._async_http = function(method, uri, obj, callback, arg) {
    var connection = YAHOO.util.Connect;
    connection.setDefaultPostHeader(false);

    connection.initHeader("Accept", "application/json", false);
    connection.initHeader("Content-type", "application/json", false);
    connection.initHeader("X-XSRF-Token", <PASSWORD>stice_xsrf_token, false);
    connection.initHeader("X-CSRFToken", $("input[name=csrfmiddlewaretoken]").val(), true);

    var callback = {
        cache: false,
        success: this._handleSuccess,
        failure: this._handleSuccess,
        argument: [this, callback, arg]
    };

    var request = connection.asyncRequest(method, uri, callback, JSON.stringify(obj));
    connection.setDefaultPostHeader(true);

    return request;

};

SolBase.prototype._handleSuccess = function(o) {
    var self = this.argument[0];
    var callback = this.argument[1];
    var arg = this.argument[2];

    var json;
    var status = o.status;
    if (o.responseText != "") {
        try {
            json = YAHOO.lang.JSON.parse(o.responseText);
        }
        catch (e) {
            status = 500;
            json = { error:"Error parsing response: "+e.message };
        };
    }

    callback.call(self, {
        code    : status,
        data    : json,
        conn    : o
    }, arg);
};


SolBase.prototype._renderTo = function() {
    var content;
    var div = arguments[0];
    if (arguments.length == 3) {
        var template = arguments[1];
        var params = arguments[2];
        try {
            var compiled = Solstice.CompiledTemplates.get(this._getApplication(), template);
            if (!compiled) {
                Solstice.CompiledTemplates.init(this._getApplication(), template);
                compiled = Solstice.CompiledTemplates.get(this._getApplication(), template);
            }

            var content = $("<div />").append($.tmpl(this._getApplication()+"/"+template, params)).html();
            $(div).html(content);
        }
        catch (e) {
            Solstice.log(e);
            return;
        }
    }
    else if (arguments.length == 2) {
        var view = arguments[1];
        content = view.toString();
    }
{'fraction_non_alphanumeric': 0.1451316595223515, 'fraction_numerical': 0.002449479485609308, 'mean_word_length': 2.7848590189262263, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '498526', 'n_tokens_mistral': 3009, 'n_tokens_neox': 2926, 'n_words': 577}