backport stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 20 Oct 2010 15:58:27 +0200
changeset 6565 e89de028d004
parent 6564 ff9f7c566464 (current diff)
parent 6562 34be5986bca0 (diff)
child 6566 8eb58d00a0ce
backport stable
selectors.py
web/data/cubicweb.ajax.js
--- a/cwctl.py	Wed Oct 20 15:57:35 2010 +0200
+++ b/cwctl.py	Wed Oct 20 15:58:27 2010 +0200
@@ -35,6 +35,7 @@
     def getpgid():
         """win32 getpgid implementation"""
 
+
 from os.path import exists, join, isfile, isdir, dirname, abspath
 
 from logilab.common.clcommands import CommandLine
@@ -952,6 +953,9 @@
 
 def run(args):
     """command line tool"""
+    import os
+    sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
+    sys.stderr = os.fdopen(sys.stderr.fileno(), 'w', 0)
     cwcfg.load_cwctl_plugins()
     try:
         CWCTL.run(args)
--- a/selectors.py	Wed Oct 20 15:57:35 2010 +0200
+++ b/selectors.py	Wed Oct 20 15:58:27 2010 +0200
@@ -450,7 +450,8 @@
                 req.vreg[self.registry].select(regid, req, **kwargs)
                 return self.selectable_score
             except NoSelectableObject:
-                return 0
+                continue
+        return 0
 
 
 class adaptable(appobject_selectable):
--- a/web/data/cubicweb.ajax.js	Wed Oct 20 15:57:35 2010 +0200
+++ b/web/data/cubicweb.ajax.js	Wed Oct 20 15:58:27 2010 +0200
@@ -36,12 +36,10 @@
     },
 
     addCallback: function(callback) {
-        if (this._req.readyState == 4) {
-            if (this._result) {
-                var args = [this._result, this._req];
-                jQuery.merge(args, cw.utils.sliceList(arguments, 1));
-                callback.apply(null, args);
-            }
+        if ((this._req.readyState == 4) && this._result) {
+            var args = [this._result, this._req];
+            jQuery.merge(args, cw.utils.sliceList(arguments, 1));
+            callback.apply(null, args);
         }
         else {
             this._onSuccess.push([callback, cw.utils.sliceList(arguments, 1)]);
@@ -50,10 +48,8 @@
     },
 
     addErrback: function(callback) {
-        if (this._req.readyState == 4) {
-            if (this._error) {
-                callback.apply(null, [this._error, this._req]);
-            }
+        if (this._req.readyState == 4 && this._error) {
+            callback.apply(null, [this._error, this._req]);
         }
         else {
             this._onFailure.push([callback, cw.utils.sliceList(arguments, 1)]);