From 39cc4cfabef600c64b19efa868429c5e27e4513c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Thu, 18 Aug 2011 13:21:55 +0200 Subject: [PATCH] Add some utility functions --- tabellio/config/utils.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tabellio/config/utils.py diff --git a/tabellio/config/utils.py b/tabellio/config/utils.py new file mode 100644 index 0000000..6a6d476 --- /dev/null +++ b/tabellio/config/utils.py @@ -0,0 +1,17 @@ +from zope import component +from plone.registry.interfaces import IRegistry +from interfaces import ITabellioSettings + + +def get_dossiers_path(): + return component.getUtility(IRegistry).forInterface(ITabellioSettings, False).dossiersPath + +def get_documents_path(): + return component.getUtility(IRegistry).forInterface(ITabellioSettings, False).documentsPath + + +def get_sessions(): + settings = component.getUtility(IRegistry).forInterface(ITabellioSettings, False) + sessions = settings.sessions + terms = [x.split(':')[1].strip() for x in sessions.splitlines() if x] + return terms