cubicweb/web/data/cubicweb.compat.js
author Philippe Pepiot <ph@itsalwaysdns.eu>
Tue, 31 Mar 2020 19:15:03 +0200
changeset 12957 0c973204033a
parent 12503 b01dd0ef43aa
permissions -rw-r--r--
[server] prevent returning closed cursor to the database pool In since c8c6ad8 init_repository use repo.internal_cnx() instead of repo.system_source.get_connection() so it use the pool and we should not close cursors from the pool before returning it back. Otherwise we may have "connection already closed" error. This bug only trigger when connection-pool-size = 1. Since we are moving to use a dynamic pooler we need to get this fixed. This does not occur with sqlite since the connection wrapper instantiate new cursor everytime, but this occur with other databases.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5658
7b9553a9db65 [ajax] refactor/cleanup low-level ajax functions
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 5186
diff changeset
     1
/**
7b9553a9db65 [ajax] refactor/cleanup low-level ajax functions
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 5186
diff changeset
     2
 * .. function:: cw.utils.deprecatedFunction(msg, function)
7b9553a9db65 [ajax] refactor/cleanup low-level ajax functions
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 5186
diff changeset
     3
 *
6880
4be32427b2b9 [book] fixes some references and other doc construction pbs
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6545
diff changeset
     4
 * jQUery flattens arrays returned by the mapping function: ::
4be32427b2b9 [book] fixes some references and other doc construction pbs
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6545
diff changeset
     5
 *
4be32427b2b9 [book] fixes some references and other doc construction pbs
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6545
diff changeset
     6
 *   >>> y = ['a:b:c', 'd:e']
4be32427b2b9 [book] fixes some references and other doc construction pbs
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6545
diff changeset
     7
 *   >>> jQuery.map(y, function(y) { return y.split(':');})
4be32427b2b9 [book] fixes some references and other doc construction pbs
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6545
diff changeset
     8
 *   ["a", "b", "c", "d", "e"]
4be32427b2b9 [book] fixes some references and other doc construction pbs
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6545
diff changeset
     9
 *   // where one would expect:
4be32427b2b9 [book] fixes some references and other doc construction pbs
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6545
diff changeset
    10
 *   [ ["a", "b", "c"], ["d", "e"] ]
5658
7b9553a9db65 [ajax] refactor/cleanup low-level ajax functions
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 5186
diff changeset
    11
 */
6880
4be32427b2b9 [book] fixes some references and other doc construction pbs
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6545
diff changeset
    12
 // XXX why not the same argument order as $.map and forEach ?
5658
7b9553a9db65 [ajax] refactor/cleanup low-level ajax functions
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 5186
diff changeset
    13
9259
68cde7431c2c [js] remove 3.9 bw compat (where apparently unused)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 7258
diff changeset
    14
function map(func, array) {
68cde7431c2c [js] remove 3.9 bw compat (where apparently unused)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 7258
diff changeset
    15
    var result = [];
68cde7431c2c [js] remove 3.9 bw compat (where apparently unused)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 7258
diff changeset
    16
    for (var i = 0, length = array.length; i < length; i++) {
68cde7431c2c [js] remove 3.9 bw compat (where apparently unused)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 7258
diff changeset
    17
        result.push(func(array[i]));
5658
7b9553a9db65 [ajax] refactor/cleanup low-level ajax functions
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 5186
diff changeset
    18
    }
9259
68cde7431c2c [js] remove 3.9 bw compat (where apparently unused)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 7258
diff changeset
    19
    return result;
68cde7431c2c [js] remove 3.9 bw compat (where apparently unused)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 7258
diff changeset
    20
}