From a281f2d372142e247e446d7018b169b9a823f0b9 Mon Sep 17 00:00:00 2001 From: gfawcett Date: Thu, 15 Jul 2010 00:53:20 +0000 Subject: [PATCH] read app-title from 'application.title' config record git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@904 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- conifer/syrup/models.py | 8 ++++++++ conifer/templates/master.xhtml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/conifer/syrup/models.py b/conifer/syrup/models.py index 7028328..10dae4c 100644 --- a/conifer/syrup/models.py +++ b/conifer/syrup/models.py @@ -125,6 +125,14 @@ class Config(m.Model): name = m.CharField(max_length=256) value = m.CharField(max_length=8192) + @classmethod + def get(cls, name, default=None, translator=lambda x: x): + try: + c = cls.objects.get(name=name) + return translator(c.value) + except cls.DoesNotExist: + return default + #------------------------------------------------------------ class ReadingList(BaseModel): diff --git a/conifer/templates/master.xhtml b/conifer/templates/master.xhtml index 5d1614e..b35580d 100644 --- a/conifer/templates/master.xhtml +++ b/conifer/templates/master.xhtml @@ -1,5 +1,5 @@ -- 2.11.0