Commits

ben...@pollen.nymphormation.net  committed 74c1daf

fix pagename and an error in internet explorer that prevent display.

  • Participants
  • Parent commits ae536ec

Comments (0)

Files changed (3)

File couchit/views.py

 
 FORBIDDEN_CNAME = ['mail', 'www', 'blog', 'news', 'media', 'upload', 'files', 'store']
 
-re_page = re.compile(r"^[@&\"'\-\/ \w]+$", re.U)
+re_page = re.compile(r"^[&@()?!.,;:\"'\-\/ \w]+$", re.U)
 re_address = re.compile(r'^[-_\w]+$')
 
 def not_logged(f):
     def decorated(request, **kwargs):
         if 'pagename' in kwargs:
             pagename = kwargs['pagename'] 
-            print pagename
             if not re_page.match(pagename) and pagename is not None:
+                print "bbbb"
                 raise NotFound
             pagename = pagename.replace(" ", "_")
             kwargs['pagename'] = pagename
     return render_response('help.html')
 
 def couchit_find(request):
-    return render_response('find.html')
+    return render_response('find.html')

File static/js/src/application.js

     
     submit: function() { 
         var title = $("title");
-        if (!title.value.match(/^['\-\"\/ \w\u00A1-\uFFFF]+$/i) || FORBIDDEN_PAGES.indexOf(title.value) >= 0) {
+        if (!title.value.match(/^['\-\"\/ !?&.,;:@\(\)\w\u00A1-\uFFFF]+$/i) || FORBIDDEN_PAGES.indexOf(title.value) >= 0) {
             alert("Page title invalid");
             return false;
         }

File static/js/src/page.js

         else if (old_title == new_title) {
             this.removeRenameForm();
         } else {
+             if (!new_title.match(/^['\-\"\/ !?;,:&.@\(\)\w\u00A1-\uFFFF]+$/i) || FORBIDDEN_PAGES.indexOf(new_title) >= 0) {
+                alert("Page title invalid");
+                this.removeRenameForm();
+                return false;
+            }
+
             new Ajax.Request(this._form.action, {
               method: 'post',
               contentType: 'application/json', 
 
               },
               onFailure: function() {
-                  alert("mmm... error while trying rename :(, Please contact administrator")
+                  alert("mmm... error while trying rename :(, Please contact administrator");
               }
              });
         } 
     createRenameHelp: function() {
         var self = this;
         this._help = new Element('div', {
-            'class': 'rename hidden',
+            'class': 'rename hidden'
         }).update('⇤ Click to rename');
         this.page_title.insert(this._help);
         
         
         
     }
-});
+});