changeset 936:78692d47340d

server (pages): added getPageByName
author Goffi <goffi@goffi.org>
date Thu, 27 Apr 2017 01:12:57 +0200
parents c3ae008f7a0f
children 00236973e138
files src/server/server.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/server/server.py	Thu Apr 27 01:11:53 2017 +0200
+++ b/src/server/server.py	Thu Apr 27 01:12:57 2017 +0200
@@ -1566,6 +1566,15 @@
             url = os.path.join(u'/', u'/'.join(callback_data['pre_path']), callback_data['callback'](self, uri_data))
         return url
 
+    def getPageByName(self, name):
+        """retrieve page instance from its name
+
+        @param name(unicode): name of the page
+        @return (LiberviaPage): page instance
+        @raise KeyError: the page doesn't exist
+        """
+        return self.named_pages[name]
+
     def getChildWithDefault(self, path, request):
         # we handle children ourselves
         raise exceptions.InternalError(u"this method should not be used with LiberviaPage")