[kupu-checkins] r35877 - in kupu/trunk/kupu: . common plone

duncan at codespeak.net duncan at codespeak.net
Tue Dec 19 12:19:58 CET 2006


Author: duncan
Date: Tue Dec 19 12:19:55 2006
New Revision: 35877

Modified:
   kupu/trunk/kupu/common/kupubasetools.js
   kupu/trunk/kupu/common/kupudrawers.js
   kupu/trunk/kupu/jslint.js
   kupu/trunk/kupu/lint.py
   kupu/trunk/kupu/plone/html2captioned.py
Log:
Removed spurious debug from kupubasetools.js.
Added jslint warning: 'for' loop not using 'var'.
Link migration: removed delays when nothing committed. Fixed nav page fragment checking.


Modified: kupu/trunk/kupu/common/kupubasetools.js
==============================================================================
--- kupu/trunk/kupu/common/kupubasetools.js	(original)
+++ kupu/trunk/kupu/common/kupubasetools.js	Tue Dec 19 12:19:55 2006
@@ -1828,10 +1828,9 @@
     };
 
     this._cleanCell = function(el) {
-        dump('_cleanCell('+el.innerHTML+')\n');
         // Remove formatted div or p from a cell
-        var node, nxt, n;
-        for (node = el.firstChild; node;) {
+        var nxt, n;
+        for (var node = el.firstChild; node;) {
             if (/^DIV|P$/i.test(node.nodeName)) {
                 for (var n = node.firstChild; n;) {
                     var nxt = n.nextSibling;
@@ -1884,7 +1883,6 @@
     this._cleanRows = function(rows, container, numcols) {
         // now walk through all rows to clean them up
         for (var i=0; i < rows.length; i++) {
-            dump("row "+i+'\n');
             var row = rows[i];
             var doc = this.editor.getInnerDocument();
             var newrow = doc.createElement('tr');
@@ -1892,7 +1890,6 @@
                 newrow.className = row.className;
             }
             for (var node = row.firstChild; node;) {
-                dump("child\n");
                 var nxt = node.nextSibling;
                 if (/TD|TH/.test(node.nodeName)) {
                     this._cleanCell(node);
@@ -1905,7 +1902,7 @@
             };
         };
         // now make sure all rows have the correct length
-        for (row = container.firstChild; row; row=row.nextSibling) {
+        for (var row = container.firstChild; row; row=row.nextSibling) {
             var cellname = row.lastChild.nodeName;
             while (row.childNodes.length < numcols) {
                 var cell = doc.createElement(cellname);
@@ -1964,7 +1961,6 @@
             };
         };
         /* Extract thead and tfoot from tbody */
-        dump('extract head and foot\n');
         while (brows.length && !this._isBodyRow(brows[0])) {
             hrows.push(brows[0]);
             brows.shift();
@@ -1974,13 +1970,11 @@
             brows.length -= 1;
             frows.unshift(last);
         }
-        dump('count cols\n');
         // now find out how many cells our rows should have
         var numcols = this._countCols(hrows, 0);
         numcols = this._countCols(brows, numcols);
         numcols = this._countCols(frows, numcols);
 
-        dump('clean rows\n');
         // now walk through all rows to clean them up
         this._cleanRows(hrows, thead);
         this._cleanRows(brows, tbody);
@@ -1988,7 +1982,6 @@
 
         // now remove all the old stuff from the table and add the new
         // tbody
-        dump('remove old\n');
         while (table.firstChild) {
             table.removeChild(table.firstChild);
         }
@@ -2001,7 +1994,6 @@
         if (frows.length) {
             table.appendChild(tfoot);
         }
-        dump('finish up\n');
 
         this.editor.focusDocument();
         this.editor.logMessage(_('Table cleaned up'));

Modified: kupu/trunk/kupu/common/kupudrawers.js
==============================================================================
--- kupu/trunk/kupu/common/kupudrawers.js	(original)
+++ kupu/trunk/kupu/common/kupudrawers.js	Tue Dec 19 12:19:55 2006
@@ -165,12 +165,11 @@
 
 proto.anchorText = function(a) {
     // Text inside anchor, or immediate sibling block tag, or parent block. 
-    var node = a;
     var blocktag = /^DIV|P|BODY|TD|H.$/;
     var txt = '';
     var prefix = '#' + a.name;
 findlabel:
-    for (node = a; node && !txt; node=node.parentNode) {
+    for (var node = a; node && !txt; node=node.parentNode) {
         var txt = node.textContent || node.innerText || '';
         if (txt || blocktag.test(node.nodeName)) {
             break;

Modified: kupu/trunk/kupu/jslint.js
==============================================================================
--- kupu/trunk/kupu/jslint.js	(original)
+++ kupu/trunk/kupu/jslint.js	Tue Dec 19 12:19:55 2006
@@ -2419,6 +2419,7 @@
                     advance('var');
                     varstatement();
                 } else {
+                    warning(572,"'for' using existing variable", token);
                     for (;;) {
                         parse(0);
                         if (token.id !== ',') {
@@ -3058,10 +3059,8 @@
     }
     /* Set up default error message handling */
     parserange("100-163", function(i) { JSLINT.errorlevels[i]='error'; });
-    parserange("501-571,1001-1006", function(i) { JSLINT.errorlevels[i]='warning'; });
+    parserange("501-572,1001-1006", function(i) { JSLINT.errorlevels[i]='warning'; });
     parserange("1001,1002,1004,1005", function(i) { JSLINT.errorlevels[i]='ignore'; });
-//     parserange("501,510,531,535,544,546,554,557,1001,1002,1004,1005",
-//         function(i) { JSLINT.errorlevels[i]='ignore'; });
 
     var options = {
         browser: { help: "true if the standard browser globals should be predefined" },

Modified: kupu/trunk/kupu/lint.py
==============================================================================
--- kupu/trunk/kupu/lint.py	(original)
+++ kupu/trunk/kupu/lint.py	Tue Dec 19 12:19:55 2006
@@ -11,10 +11,10 @@
 import os, sys, glob, time
 import cPickle
 
-COMPILE_COMMAND = "java org.mozilla.javascript.tools.shell.Main %(lint)s --options jslint.opts %(file)s"
+COMPILE_COMMAND = "java org.mozilla.javascript.tools.shell.Main %(lint)s --options %(options)s %(file)s"
 
 def lint(name):
-    cmd = COMPILE_COMMAND % dict(lint=LINT, file=name)
+    cmd = COMPILE_COMMAND % dict(lint=LINT, file=name, options=OPTIONS)
     ret = os.system(cmd)
     if ret != 0:
         sys.exit(ret)
@@ -25,6 +25,7 @@
     return os.path.join(base, relative)
 
 LINT = scriptrelative('jslint.js')
+OPTIONS = scriptrelative('jslint.opts')
 STATUSFILE = scriptrelative('lint.record')
 
 def filelist(*patterns):

Modified: kupu/trunk/kupu/plone/html2captioned.py
==============================================================================
--- kupu/trunk/kupu/plone/html2captioned.py	(original)
+++ kupu/trunk/kupu/plone/html2captioned.py	Tue Dec 19 12:19:55 2006
@@ -279,7 +279,7 @@
         info = {}
         if self._continue:
             info['nexturi'] = self.tool.absolute_url_path()+'/kupu_migration.xml?button=continue'
-            if self.commit_changes:
+            if self.commit_changes and self._objects and self.position < getattr(self, '_total', -1):
                 info['delay'] = 5 # Avoid killing everyone else with conflict errors.
         else:
             info['nexturi'] = None
@@ -332,11 +332,11 @@
         if not uids:
             self._continue = False
             return False # Done
-            
+
         self._objects = res = []
         for uid in uids:
             obj = self.reference_tool.lookupObject(uid)
-            if self.portal_type==FRAGMENT_TYPE:
+            if self.portal_type==FRAGMENT_TYPE and obj.portal_type!=FRAGMENT_TYPE:
                 try:
                     fldr = obj.cp_container.titles
                 except:


More information about the kupu-checkins mailing list