[web application] move default path logic inside url publisher
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Mon, 27 Feb 2012 11:51:09 +0100
changeset 8272 18893bb969d2
parent 8271 3bd9b317b1d8
child 8273 6c7cad317e60
[web application] move default path logic inside url publisher Previously, this logic was handle by: * etwist server * wsgi handler * web application
etwist/server.py
web/application.py
web/views/urlpublishing.py
wsgi/handler.py
--- a/etwist/server.py	Mon Feb 27 11:50:04 2012 +0100
+++ b/etwist/server.py	Mon Feb 27 11:51:09 2012 +0100
@@ -352,8 +352,6 @@
             request.uri.replace(origpath, path, 1)
         else:
             path = origpath
-        if not path or path == "/":
-            path = 'view'
         try:
             result = self.appli.publish(path, req)
         except DirectResponse, ex:
--- a/web/application.py	Mon Feb 27 11:50:04 2012 +0100
+++ b/web/application.py	Mon Feb 27 11:51:09 2012 +0100
@@ -347,7 +347,6 @@
         :rtype: str
         :return: the result of the pusblished url
         """
-        path = path or 'view'
         # don't log form values they may contains sensitive information
         self.info('publish "%s" (%s, form params: %s)',
                   path, req.session.sessionid, req.form.keys())
--- a/web/views/urlpublishing.py	Mon Feb 27 11:50:04 2012 +0100
+++ b/web/views/urlpublishing.py	Mon Feb 27 11:51:09 2012 +0100
@@ -106,7 +106,8 @@
         :param req: the request object
 
         :type path: str
-        :param path: the path of the resource to publish
+        :param path: the path of the resource to publish. If empty, None or "/"
+                     "view" is used as the default path.
 
         :rtype: tuple(str, `cubicweb.rset.ResultSet` or None)
         :return: the publishing method identifier and an optional result set
--- a/wsgi/handler.py	Mon Feb 27 11:50:04 2012 +0100
+++ b/wsgi/handler.py	Mon Feb 27 11:51:09 2012 +0100
@@ -126,9 +126,6 @@
             self.appli.connect(req)
         except Redirect, ex:
             return self.redirect(req, ex.location)
-        path = req.path
-        if not path or path == "/":
-            path = 'view'
         try:
             result = self.appli.publish(path, req)
         except DirectResponse, ex: