# HG changeset patch
# User Goffi <goffi@goffi.org>
# Date 1510487516 -3600
# Node ID c8cafe316f6f9d1d4a268dcb4a340cfe848e6dbc
# Parent  d0de2a98e8528837dbab2676b2402d48a7f42313
pages: removed trailing_slash option:

this option is used for relative URLs, but it seems more reasonable to build absolute URL from the server, so templates are not dependants of the way the pages hierarchy is done.

diff -r d0de2a98e852 -r c8cafe316f6f src/pages/tickets/page_meta.py
--- a/src/pages/tickets/page_meta.py	Sat Nov 11 19:02:27 2017 +0100
+++ b/src/pages/tickets/page_meta.py	Sun Nov 12 12:51:56 2017 +0100
@@ -14,7 +14,6 @@
 name = u'tickets_list'
 access = C.PAGES_ACCESS_PUBLIC
 template = u"ticket/overview.html"
-trailing_slash = True
 
 
 def parse_url(self, request):
diff -r d0de2a98e852 -r c8cafe316f6f src/server/server.py
--- a/src/server/server.py	Sat Nov 11 19:02:27 2017 +0100
+++ b/src/server/server.py	Sun Nov 12 12:51:56 2017 +0100
@@ -1305,7 +1305,7 @@
     named_pages = {}
     uri_callbacks = {}
 
-    def __init__(self, host, root_dir, url, name=None, redirect=None, trailing_slash=False, access=None, parse_url=None,
+    def __init__(self, host, root_dir, url, name=None, redirect=None, access=None, parse_url=None,
                  prepare_render=None, render=None, template=None, on_data_post=None):
         """initiate LiberviaPages
 
@@ -1323,8 +1323,6 @@
             using this redirect parameter is called "full redirection"
             using self.pageRedirect is called "partial redirection" (because some rendering method
             can still be used, e.g. parse_url)
-        @param trailing_slash(bool): if True, page will be redirected to (url + '/') if url is not already ended by a '/'.
-            This is specially useful for relative links
         @param access(unicode, None): permission needed to access the page
             None means public access.
             Pages inherit from parent pages: e.g. if a "settings" page is restricted to admins,
@@ -1372,7 +1370,6 @@
             self.redirect = redirect
         else:
             self.redirect = None
-        self.trailing_slash = trailing_slash
         self.parse_url = parse_url
         self.prepare_render = prepare_render
         self.template = template
@@ -1419,7 +1416,6 @@
                     u'/' + u'/'.join(new_path),
                     name=page_data.get('name'),
                     redirect=page_data.get('redirect'),
-                    trailing_slash = page_data.get('trailing_slash'),
                     access=page_data.get('access'),
                     parse_url=page_data.get('parse_url'),
                     prepare_render=page_data.get('prepare_render'),
@@ -1819,8 +1815,6 @@
         """Main method to handle the workflow of a LiberviaPage"""
         # template_data are the variables passed to template
         if not hasattr(request, 'template_data'):
-            if self.trailing_slash and request.path and not request.path[-1] == '/':
-                return web_util.redirectTo(request.path + '/', request)
             session_data = self.host.getSessionData(request, session_iface.ISATSession)
             csrf_token = session_data.csrf_token
             request.template_data = {u'csrf_token': csrf_token}