diff piecrust/data/base.py @ 329:422052d2e978

internal: Try handling URLs in a consistent way. * Now URLs passed to, and returned from, routes will always be absolute URLs, i.e. URLs including the site root. * Validate the site root at config loading time to make sure it starts and ends with a slash. * Get rid of unused stuff. * Add tests.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 31 Mar 2015 23:03:28 -0700
parents da5e6e00fb41
children 4b1019bb2533
line wrap: on
line diff
--- a/piecrust/data/base.py	Tue Mar 31 22:38:56 2015 -0700
+++ b/piecrust/data/base.py	Tue Mar 31 23:03:28 2015 -0700
@@ -1,7 +1,7 @@
 import time
 import logging
 from piecrust.data.assetor import Assetor
-from piecrust.uriutil import get_slug
+from piecrust.uriutil import split_uri
 
 
 logger = logging.getLogger(__name__)
@@ -129,8 +129,9 @@
 
     def _loadCustom(self):
         page_url = self._get_uri()
+        _, slug = split_uri(self.page.app, page_url)
         self._setValue('url', page_url)
-        self._setValue('slug', get_slug(self._page.app, page_url))
+        self._setValue('slug', slug)
         self._setValue(
                 'timestamp',
                 time.mktime(self.page.datetime.timetuple()))