]> git.sommitrealweird.co.uk Git - sommitrealweird.git/blobdiff - sommitrealweird/bpcms/content_val.py
add in wsgi script
[sommitrealweird.git] / sommitrealweird / bpcms / content_val.py
index 0e621503cb6988eb7f7df7b963c8ba03e7c33262..3463d18393906b1eec240deb01dcfaaf52c3ebcd 100644 (file)
@@ -1,4 +1,20 @@
 from django.core import validators
 from django.core import validators
+from django.conf import settings
+
+def is_allowed_name(slug, all_data):
+    from bpcms.models import Document, Folder
+    folder = None
+    if all_data.has_key('folder'):
+        folder = all_data['folder']
+    elif all_data.has_key('parent'):
+        folder = all_data['parent']
+    if folder == u'':
+        folder = None
+    if folder == None:
+        # right - we're at the root.
+        if slug in settings.BPCMS_DISALLOWED_ROOT_DOC_NAMES \
+            or slug in ['cms-admin']:
+            raise validators.ValidationError(u'That slug is reserved')
 
 def is_unique_name(slug, all_data):
     from bpcms.models import Document, Folder
 
 def is_unique_name(slug, all_data):
     from bpcms.models import Document, Folder