diff piecrust/uriutil.py @ 12:30a42341cfa8

Define page slugs properly, avoid recursions with debug data.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 18 Aug 2014 16:49:54 -0700
parents f5ca5c5bed85
children 62c7a97c8340
line wrap: on
line diff
--- a/piecrust/uriutil.py	Mon Aug 18 16:47:44 2014 -0700
+++ b/piecrust/uriutil.py	Mon Aug 18 16:49:54 2014 -0700
@@ -72,3 +72,9 @@
     pattern = re.compile("|".join(list(reps.keys())))
     return pattern.sub(lambda m: reps[re.escape(m.group(0))], text)
 
+
+def get_slug(app, uri):
+    site_root = app.config.get('site/root')
+    uri = uri[len(site_root):]
+    return uri.lstrip('/')
+