Module Expr Str TryExcept body ImportFrom alias handlers ExceptHandler type NameLoad body TryExcept body ImportFrom alias handlers ExceptHandler type NameLoad body FunctionDef arguments args defaults vararg body Raise Call NameLoad Str decorator_list ImportFrom alias ImportFrom alias ImportFrom alias FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Str If NameLoad body For NameStore Call NameLoad Num BinOpSub Call NameLoad NameLoad Num body Assign NameStore Call AttributeLoad Str attr SubscriptLoad NameLoad Slice BinOpAdd NameLoad Num AugAssignAdd NameStore BinOpMod Str TupleLoad NameLoad NameLoad AugAssignAdd NameStore BinOpMod Str Call AttributeLoad Str attr NameLoad AugAssignAdd NameStore BinOpMod Str Dict Str Call AttributeLoad Str attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Str body Expr Str ImportFrom alias Expr Call NameLoad Call NameLoad Str Expr Call AttributeLoad NameLoad attr Assign NameStore ListLoad Assign NameStore ListLoad For NameStore Call AttributeLoad NameLoad attr body Assign NameStore ListComp Dict Str Str NameLoad NameLoad comprehension TupleStore NameStore NameStore AttributeLoad NameLoad attr Assign NameStore Dict For TupleStore NameStore NameStore Call NameLoad AttributeLoad NameLoad attr body Assign NameStore Call NameLoad NameLoad TryExcept body Assign NameStore Call AttributeLoad NameLoad attr NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore BinOpSub Call NameLoad NameLoad Num Assign SubscriptStore NameLoad Index NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Dict Str Str Str Str Str AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr NameLoad NameLoad AttributeLoad NameLoad attr Return Call NameLoad keyword BoolOpOr BoolOpAnd NameLoad Call AttributeLoad NameLoad attr Str ListLoad keyword Call NameLoad NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Str Str body Expr Str Assign NameStore Dict Str Str Str Str Str Str Call NameLoad AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr NameLoad NameLoad Return BinOpMod Str NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str If Call NameLoad NameLoad Str body Assign NameStore Call AttributeLoad NameLoad attr orelse For NameStore Call NameLoad Call NameLoad NameLoad body If CompareIn NameLoad NameLoad body Assign NameStore Call SubscriptLoad NameLoad Index NameLoad NameLoad Break orelse Return Str Return BinOpMod Str NameLoad decorator_list FunctionDef arguments args NameParam defaults body If AttributeLoad NameLoad attr body Return BinOpMod Str AttributeLoad NameLoad attr Return Str decorator_list Assign NameStore Dict NameLoad NameLoad
N/A N/A 
    werkzeug.contrib.jsrouting
    ~~~~~~~~~~~~~~~~~~~~~~~~~~

    Addon module that allows to create a JavaScript function from a map
    that generates rules.

    :copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details.
    :license: BSD, see LICENSE for more details.
 N/A N/A simplejson dumps N/A N/A N/A ImportError N/A N/A N/A json dumps N/A N/A N/A ImportError N/A dumps N/A N/A N/A args N/A N/A N/A RuntimeError simplejson required for jsrouting N/A inspect getmro werkzeug.routing NumberConverter werkzeug._compat iteritems render_template N/A N/A name_parts rules converters N/A N/A N/A result N/A name_parts N/A N/A idx N/A xrange 0 N/A N/A len name_parts 1 N/A N/A name N/A N/A . join N/A name_parts N/A N/A idx 1 N/A result N/A if (typeof %s === 'undefined') %s = {}
 N/A name name N/A result N/A %s =  N/A N/A . join name_parts N/A result N/A (function (server_name, script_name, subdomain, url_scheme) {
    var converters = %(converters)s;
    var rules = $rules;
    function in_array(array, value) {
        if (array.indexOf != undefined) {
            return array.indexOf(value) != -1;
        }
        for (var i = 0; i < array.length; i++) {
            if (array[i] == value) {
                return true;
            }
        }
        return false;
    }
    function array_diff(array1, array2) {
        array1 = array1.slice();
        for (var i = array1.length-1; i >= 0; i--) {
            if (in_array(array2, array1[i])) {
                array1.splice(i, 1);
            }
        }
        return array1;
    }
    function split_obj(obj) {
        var names = [];
        var values = [];
        for (var name in obj) {
            if (typeof(obj[name]) != 'function') {
                names.push(name);
                values.push(obj[name]);
            }
        }
        return {names: names, values: values, original: obj};
    }
    function suitable(rule, args) {
        var default_args = split_obj(rule.defaults || {});
        var diff_arg_names = array_diff(rule.arguments, default_args.names);

        for (var i = 0; i < diff_arg_names.length; i++) {
            if (!in_array(args.names, diff_arg_names[i])) {
                return false;
            }
        }

        if (array_diff(rule.arguments, args.names).length == 0) {
            if (rule.defaults == null) {
                return true;
            }
            for (var i = 0; i < default_args.names.length; i++) {
                var key = default_args.names[i];
                var value = default_args.values[i];
                if (value != args.original[key]) {
                    return false;
                }
            }
        }

        return true;
    }
    function build(rule, args) {
        var tmp = [];
        var processed = rule.arguments.slice();
        for (var i = 0; i < rule.trace.length; i++) {
            var part = rule.trace[i];
            if (part.is_dynamic) {
                var converter = converters[rule.converters[part.data]];
                var data = converter(args.original[part.data]);
                if (data == null) {
                    return null;
                }
                tmp.push(data);
                processed.push(part.name);
            } else {
                tmp.push(part.data);
            }
        }
        tmp = tmp.join('');
        var pipe = tmp.indexOf('|');
        var subdomain = tmp.substring(0, pipe);
        var url = tmp.substring(pipe+1);

        var unprocessed = array_diff(args.names, processed);
        var first_query_var = true;
        for (var i = 0; i < unprocessed.length; i++) {
            if (first_query_var) {
                url += '?';
            } else {
                url += '&';
            }
            first_query_var = false;
            url += encodeURIComponent(unprocessed[i]);
            url += '=';
            url += encodeURIComponent(args.original[unprocessed[i]]);
        }
        return {subdomain: subdomain, path: url};
    }
    function lstrip(s, c) {
        while (s && s.substring(0, 1) == c) {
            s = s.substring(1);
        }
        return s;
    }
    function rstrip(s, c) {
        while (s && s.substring(s.length-1, s.length) == c) {
            s = s.substring(0, s.length-1);
        }
        return s;
    }
    return function(endpoint, args, force_external) {
        args = split_obj(args);
        var rv = null;
        for (var i = 0; i < rules.length; i++) {
            var rule = rules[i];
            if (rule.endpoint != endpoint) continue;
            if (suitable(rule, args)) {
                rv = build(rule, args);
                if (rv != null) {
                    break;
                }
            }
        }
        if (rv == null) {
            return null;
        }
        if (!force_external && rv.subdomain == subdomain) {
            return rstrip(script_name, '/') + '/' + lstrip(rv.path, '/');
        } else {
            return url_scheme + '://'
                   + (rv.subdomain ? rv.subdomain + '.' : '')
                   + server_name + rstrip(script_name, '/')
                   + '/' + lstrip(rv.path, '/');
        }
    };
}) N/A converters N/A N/A ,  join converters N/A result N/A generate_map N/A N/A map name N/A url_map N/A N/A 
    Generates a JavaScript function containing the rules defined in
    this map, to be used with a MapAdapter's generate_javascript
    method.  If you don't pass a name the returned JavaScript code is
    an expression that returns a function.  Otherwise it's a standalone
    script that assigns the function with that name.  Dotted names are
    resolved (so you an use a name like 'obj.url_for')

    In order to use JavaScript generation, simplejson must be installed.

    Note that using this feature will expose the rules
    defined in your map to users. If your rules contain sensitive
    information, don't use JavaScript generation!
     warnings warn N/A N/A warn N/A DeprecationWarning This module is deprecated N/A N/A N/A map update N/A rules N/A N/A converters N/A N/A rule N/A N/A map iter_rules N/A N/A trace N/A N/A is_dynamic data is_dynamic data N/A N/A is_dynamic data N/A rule _trace N/A rule_converters N/A N/A N/A key converter N/A iteritems N/A rule _converters N/A N/A js_func N/A js_to_url_function converter N/A N/A N/A index N/A N/A converters index js_func N/A N/A N/A ValueError N/A N/A N/A N/A converters append js_func N/A index N/A N/A len converters 1 N/A N/A rule_converters N/A key index N/A N/A N/A rules append N/A endpoint arguments converters trace defaults N/A rule endpoint N/A list N/A rule arguments rule_converters trace N/A rule defaults N/A N/A render_template name_parts N/A N/A name N/A N/A name split . N/A rules N/A dumps rules converters converters N/A generate_adapter N/A N/A adapter name map_name N/A url_for url_map N/A N/A Generates the url building function for a map. N/A values N/A server_name script_name subdomain url_scheme name map_name N/A dumps N/A adapter server_name N/A dumps N/A adapter script_name N/A dumps N/A adapter subdomain N/A dumps N/A adapter url_scheme name map_name N/A N/A var %(name)s = %(map_name)s(
    %(server_name)s,
    %(script_name)s,
    %(subdomain)s,
    %(url_scheme)s
); values N/A js_to_url_function N/A N/A converter N/A N/A N/A Get the JavaScript converter function from a rule. N/A N/A hasattr converter js_to_url_function N/A N/A data N/A N/A converter js_to_url_function N/A N/A cls N/A getmro N/A type converter N/A N/A N/A cls js_to_url_functions N/A N/A data N/A N/A js_to_url_functions N/A cls converter N/A N/A N/A encodeURIComponent N/A N/A (function(value) { %s }) data N/A NumberConverter_js_to_url N/A N/A conv N/A N/A N/A N/A conv fixed_digits N/A N/A N/A var result = value.toString();
while (result.length < %s)
    result = '0' + result;
return result; N/A conv fixed_digits N/A return value.toString(); N/A N/A js_to_url_functions N/A NumberConverter NumberConverter_js_to_url