Anonymous avatar Anonymous committed 574a3ba

fix notfound error.

Comments (0)

Files changed (4)

     page = get_page(local.db, request.site.id, pagename)
     
     if not page:
-        return NotFound
+        raise NotFound
     
     revisions = page.revisions(local.db)
     
 def revision_page(request=None, pagename=None, nb_revision=None):
     if pagename is None:
         pagename ='Home'
+        
     page = get_page(local.db, request.site.id, pagename)
     if not page:
-        return NotFound
+        raise NotFound
         
     if nb_revision is None:
         nb_revision = 0
         try:
             nb_revision = int(nb_revision)
         except ValueError:
-            return NotFound
+            raise NotFound
 
     revision = page.revision(local.db, nb_revision)
     if revision is None:
     if not page:
         if request.is_xhr:
             return send_json({'ok': False, 'reason': 'not found'})
-        return NotFound
+        raise NotFound
     
     diff = ''
     rev1 = rev2 = page
         pagename ='Home'
     page = get_page(local.db, request.site.id, pagename)
     if not page:
-        return NotFound
+        raise NotFound
     all_revisions = [page] + page.revisions(local.db)
     if feedtype == "atom":
         feed = AtomFeed(

static/js/src/page.js

                 document.location.href=this.href;
             }, false);
             
+        this._renamingPage = false;
         if (!Page.created && !Page.home) {
             
             this.page_title = $('page_title');
             this.page_title.setStyle({
                 'cursor': 'pointer'
             });
+            this.page_title.title="Click to rename";
             
             this.createRenameForm();
             //this.createRenameHelp();
 
             this.page_title.observe('click', function(e) {
+                this._renamingPage = true;
                 self.handleRename();
             }, false);
         }
         if (new_container.id == "pedit") {
             this.Sidebar.hide();
             this.Page.setStyle({'width': '99%'});
+            if (this._renamingPage) {
+                this.removeRenameForm();
+            }
         } else {
             this.Page.setStyle({'width': '76%'});
             this.Sidebar.show();
         if (!new_title)
             alert("Page title can't be empty.");
         else if (old_title == new_title) {
-            this._form.remove();
-            this.createRenameForm();
-            //this.createRenameHelp();
-            this.page_title.show();
+            this.removeRenameForm();
         } else {
             new Ajax.Request(this._form.action, {
               method: 'post',
               onSuccess: function(response) {
                   data = response.responseText.evalJSON(true);
                   if (data['ok']) {
+                      this._renamingPage = false;
                       document.location.href = data['redirect_url'];
                   } else {
                       alert (data['error']);
         }, false);
     },
     
+    removeRenameForm: function() {
+        this._form.remove();
+        this.createRenameForm();
+        //self.createRenameHelp();
+        this.page_title.show();
+        this._renamingPage = false;
+    },
     
     handleRename: function() {
         var self = this;
         this._form.select('.cancel').each(function(el) {
             el.observe("click", function(e) {
                 Event.stop(e);
-                self._form.remove();
-                self.createRenameForm();
-                //self.createRenameHelp();
-                self.page_title.show();
+                self.removeRenameForm();
                 return false;
             }, false);
         });

templates/not_found.html

 {% endblock %}
 
 {% block fullpage %}
-    Not found
+<div id="claim_wrapper">
+    
+    <section id="pclaim">
+    <h1>Not found</h1>
+    <p><a href="{{ url_for('show_page',pagename='Home') }}">Back to homepage</a></p>
+    </section>
+</div>
 {% endblock %}

templates/page/show.html

 
 {% if redirect_from %}
 <section id="redirect">
-    <p>This page was redirected from &quot;<strong>{{ redirect_from.replace("_", "") }}</strong>&quot;.</p>
+    <p>This page was redirected from &quot;<strong>{{ redirect_from.replace("_", "") }}</strong>&quot;</p>
 </section>
 {% endif %}
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.