diff pylons_app/controllers/error.py @ 215:70f645fa97cc

Moved repo creation to admin/repos, as part of crud controller. Now repo creation is based on a form, which can be auto filled with data from 404 page. Fixed the error controller to properly give the repo name.
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 24 May 2010 22:18:15 +0200
parents b68b2246e5a6
children 6ada8c223374
line wrap: on
line diff
--- a/pylons_app/controllers/error.py	Mon May 24 22:16:10 2010 +0200
+++ b/pylons_app/controllers/error.py	Mon May 24 22:18:15 2010 +0200
@@ -8,8 +8,9 @@
 from pylons_app.lib.base import BaseController, render
 from pylons.middleware import  media_path
 from pylons_app.lib.utils import check_repo
+from pylons_app.lib.filters import clean_repo
+log = logging.getLogger(__name__)
 
-log = logging.getLogger(__name__)
 class ErrorController(BaseController):
     """
     Generates error documents as and when they are required.
@@ -20,9 +21,12 @@
     This behaviour can be altered by changing the parameters to the
     ErrorDocuments middleware in your config/middleware.py file.
     """
+#    def __before__(self):
+#        super(ErrorController, self).__before__()
         
     def document(self):
         resp = request.environ.get('pylons.original_response')
+        
         log.debug(resp.status)
 
         e = request.environ
@@ -33,7 +37,10 @@
 
                         
         if resp.status_int == 404:
-            if check_repo(c.repo_name, g.base_path):
+            org_e = request.environ.get('pylons.original_request').environ
+            c.repo_name = repo_name = org_e['PATH_INFO'].split('/')[1]
+            c.repo_name_cleaned = clean_repo(c.repo_name)
+            if check_repo(repo_name, g.base_path):
                 return render('/errors/error_404.html')
                 
         c.error_message = cgi.escape(request.GET.get('code', str(resp.status)))