From 7761922bdf4faca91ed2ecbeacdb3d023205554f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?=
Date: Thu, 21 Apr 2011 13:24:57 +0200
Subject: [PATCH] add support for locked site
---
extra/modules/quota.py | 3 +++
extra/modules/root.ptl | 9 +++++++++
2 files changed, 12 insertions(+)
diff --git a/extra/modules/quota.py b/extra/modules/quota.py
index 600884b..0d2286d 100644
--- a/extra/modules/quota.py
+++ b/extra/modules/quota.py
@@ -89,3 +89,6 @@ def can_logo():
def can_theme():
return get_boolean_quota('x-asec-can-theme')
+
+def is_locked():
+ return get_boolean_quota('x-asec-locked')
diff --git a/extra/modules/root.ptl b/extra/modules/root.ptl
index c2c54b2..860e3ad 100644
--- a/extra/modules/root.ptl
+++ b/extra/modules/root.ptl
@@ -79,6 +79,8 @@ class RootDirectory(wcs.root.RootDirectory):
if not hasattr(response, 'breadcrumb'):
response.breadcrumb = [ ('', _('Home')) ]
response.filter['logo_url'] = boconfig.get_logo_url()
+ if quota.is_locked() and (len(path) == 0 or not path[0] in ['themes', 'robots.txt']):
+ return TextsDirectory.get_html_text('asec-locked-site')
return Directory._q_traverse(self, path)
def _q_index [html] (self):
@@ -139,4 +141,11 @@ Welcome on your new site. It is currently empty, you should go to the
'''))
+TextsDirectory.register('asec-locked-site',
+ N_('Text displayed when the site is locked'),
+ default=N_('''
+This site has been locked.
+
+'''))
+