def handle(self, *app_labels, **options):
        compile_output = options.get('compile', 'yes')
        data = {'dajaxice_js_functions': DajaxiceRequest.get_js_functions(),
            'DAJAXICE_URL_PREFIX': DajaxiceRequest.get_media_prefix(),
            'DAJAXICE_XMLHTTPREQUEST_JS_IMPORT': DajaxiceRequest.get_xmlhttprequest_js_import(),
            'DAJAXICE_JSON2_JS_IMPORT': DajaxiceRequest.get_json2_js_import(),
            'DAJAXICE_EXCEPTION': DajaxiceRequest.get_exception_message()}

        js = render_to_string('dajaxice/dajaxice.core.js', data)
        if compile_output.lower() == "closure":
            print self.complie_js_with_closure(js)
        else:
            print js
Exemple #2
0
def js_core(request):
    """
    Return the dajax JS code according settings.DAJAXICE_FUNCTIONS
    registered functions.
    """
    data = {
        "dajaxice_js_functions": DajaxiceRequest.get_js_functions(),
        "DAJAXICE_URL_PREFIX": DajaxiceRequest.get_media_prefix(),
        "DAJAXICE_XMLHTTPREQUEST_JS_IMPORT": DajaxiceRequest.get_xmlhttprequest_js_import(),
        "DAJAXICE_JSON2_JS_IMPORT": DajaxiceRequest.get_json2_js_import(),
        "DAJAXICE_EXCEPTION": DajaxiceRequest.get_exception_message(),
        "DAJAXICE_JS_DOCSTRINGS": DajaxiceRequest.get_js_docstrings(),
    }

    return render_to_response("dajaxice/dajaxice.core.js", data, mimetype="text/javascript")