[KSS-checkins] r51324 - kukit/kukit.js/trunk/kukit

jvloothuis at codespeak.net jvloothuis at codespeak.net
Thu Feb 7 21:30:55 CET 2008


Author: jvloothuis
Date: Thu Feb  7 21:30:52 2008
New Revision: 51324

Modified:
   kukit/kukit.js/trunk/kukit/serveraction.js
Log:

Made sure that only one slash is used when concatinating the server
action and the url. Also append a slash after each url. This helps
with frameworks like Django (and does not seem to break others like
Grok or Zope).


Modified: kukit/kukit.js/trunk/kukit/serveraction.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/serveraction.js	(original)
+++ kukit/kukit.js/trunk/kukit/serveraction.js	Thu Feb  7 21:30:52 2008
@@ -44,10 +44,19 @@
         //
         if (url.match(RegExp('/^https?:\/\//'))) {
             return url;
-        } else {
-            var result = kukit.engine.baseUrl + '/' + url;
-            return result;
+        } 
+
+        var result = kukit.engine.baseUrl;
+        if (!result.match(RegExp('\/$'))) {
+            result += '/';
         }
+        result += url;
+        // Append slash to the end of the url, this helps with certain
+        // webframeworks like Django
+        if (!result.match(RegExp('\/$'))) {
+            result += '/';
+        }
+        return result;
     };
     this.url = this.calculateAbsoluteURL(this.url);
     this.notifyServer();


More information about the Kukit-checkins mailing list