[snowy] Make the app name configurable



commit 7c36aaa8759a83b89941e497c6ac12b3fadd7a9d
Author: Brad Taylor <brad getcoded net>
Date:   Mon Jul 20 15:22:11 2009 -0400

    Make the app name configurable

 notes/context_processors.py |   21 +++++++++++++++++++++
 settings.py                 |   10 ++++++++++
 templates/base.html         |    2 +-
 templates/index.html        |   23 ++++++++++++-----------
 4 files changed, 44 insertions(+), 12 deletions(-)
---
diff --git a/notes/context_processors.py b/notes/context_processors.py
new file mode 100644
index 0000000..ab73ddf
--- /dev/null
+++ b/notes/context_processors.py
@@ -0,0 +1,21 @@
+#
+# Copyright (c) 2009 Brad Taylor <brad getcoded net>
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+from django.conf import settings
+
+def project_name(context):
+    return { 'PROJECT_NAME': settings.PROJECT_NAME }
diff --git a/settings.py b/settings.py
index 426ca1a..0a54bfe 100644
--- a/settings.py
+++ b/settings.py
@@ -19,6 +19,8 @@ DATABASE_PASSWORD = ''         # Not used with sqlite3.
 DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
 DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
 
+PROJECT_NAME = 'Snowy'
+
 # Local time zone for this installation. Choices can be found here:
 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
 # although not all choices may be available on all operating systems.
@@ -60,6 +62,14 @@ TEMPLATE_LOADERS = (
 #     'django.template.loaders.eggs.load_template_source',
 )
 
+TEMPLATE_CONTEXT_PROCESSORS = (
+    'django.core.context_processors.auth',
+    'django.core.context_processors.debug',
+    'django.core.context_processors.i18n',
+    'django.core.context_processors.media',
+    'snowy.notes.context_processors.project_name',
+)
+
 MIDDLEWARE_CLASSES = (
     'django.middleware.common.CommonMiddleware',
     'django.contrib.csrf.middleware.CsrfViewMiddleware',
diff --git a/templates/base.html b/templates/base.html
index 9521907..78cdfa0 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -5,7 +5,7 @@
 
 <head>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-    <title>{% block title %}home{% endblock %}</title>
+    <title>{% block title %}{{ PROJECT_NAME }}{% endblock %}</title>
     <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/screen.css" media="screen">
 {% if DEBUG %}
     <script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.js" charset="utf-8"></script>
diff --git a/templates/index.html b/templates/index.html
index 75a7ece..52722b4 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -4,20 +4,21 @@
 
 {% block content %}
 {% blocktrans %}
-<h1>Welcome to Snowy!</h1>
-<p>Snowy is Tomboy's best friend on the web.  Snowy is an online service that
-allows you to view, edit and share the notes you create in Tomboy on your
-desktop computer.  Powered by <a
+<h1>Welcome to {{ PROJECT_NAME }}!</h1>
+<p>{{ PROJECT_NAME }} is Tomboy's best friend on the web.  {{ PROJECT_NAME }}
+is an online service that allows you to view, edit and share the notes you
+create in Tomboy on your desktop computer.  Powered by <a
 href="http://www.djangoproject.com";>Django</a>, it features a REST-based API
 for synchronizing notes, an intuitive editor and moxie; lots of moxie.</p>
 
-<p>Thank you for your interest in Snowy.  Snowy is currently under heavy
-development and is <strike>not ready</strike><b>REALLY</b> not ready for
-production use.  Like any good K9 companion, Snowy will file your taxes
-improperly, reconcile with your ex-girlfriends and burn risotto if not watched
-carefully.</p>
+<p>Thank you for your interest in {{ PROJECT_NAME }}.  {{ PROJECT_NAME }} is
+currently under heavy development and is <strike>not
+ready</strike><b>REALLY</b> not ready for production use.  Like any good K9
+companion, {{ PROJECT_NAME }} will file your taxes improperly, reconcile with
+your ex-girlfriends and burn risotto if not watched carefully.</p>
 
-<p>If you want to house-train Snowy and teach him some new tricks, check out
-the TODO and start contributing.  P.S., Have I told you how much you rock?</p>
+<p>If you want to house-train {{ PROJECT_NAME }} and teach him some new tricks,
+check out the TODO and start contributing.  P.S., Have I told you how much you
+rock?</p>
 {% endblocktrans %}
 {% endblock %}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]