Commit efd8db8d by benjaoming

WARNING! May break your config: Clean up settings variale names in images and…

WARNING! May break your config: Clean up settings variale names in images and attachments plugins and use unified defaults. Issue #91.
parent 6b9f346c
...@@ -67,6 +67,10 @@ ANONYMOUS_WRITE = getattr( django_settings, 'WIKI_ANONYMOUS_WRITE', False ) ...@@ -67,6 +67,10 @@ ANONYMOUS_WRITE = getattr( django_settings, 'WIKI_ANONYMOUS_WRITE', False )
# Defaults to ANONYMOUS_WRITE. # Defaults to ANONYMOUS_WRITE.
ANONYMOUS_CREATE = getattr( django_settings, 'WIKI_ANONYMOUS_CREATE', ANONYMOUS_WRITE ) ANONYMOUS_CREATE = getattr( django_settings, 'WIKI_ANONYMOUS_CREATE', ANONYMOUS_WRITE )
# Default setting to allow anonymous users upload access (used in
# plugins.attachments and plugins.images).
ANONYMOUS_UPLOAD = getattr( django_settings, 'WIKI_ANONYMOUS_UPLOAD', False )
# Sign up, login and logout views should be accessible # Sign up, login and logout views should be accessible
ACCOUNT_HANDLING = getattr( django_settings, 'WIKI_ACCOUNT_HANDLING', True ) ACCOUNT_HANDLING = getattr( django_settings, 'WIKI_ACCOUNT_HANDLING', True )
...@@ -115,6 +119,13 @@ REVISIONS_PER_MINUTES_ANONYMOUS = getattr( django_settings, 'WIKI_REVISIONS_PER_ ...@@ -115,6 +119,13 @@ REVISIONS_PER_MINUTES_ANONYMOUS = getattr( django_settings, 'WIKI_REVISIONS_PER_
# Number of minutes for looking up REVISIONS_PER_MINUTES and REVISIONS_PER_MINUTES_ANONYMOUS # Number of minutes for looking up REVISIONS_PER_MINUTES and REVISIONS_PER_MINUTES_ANONYMOUS
REVISIONS_MINUTES_LOOKBACK = getattr( django_settings, 'WIKI_REVISIONS_MINUTES_LOOKBACK', 2 ) REVISIONS_MINUTES_LOOKBACK = getattr( django_settings, 'WIKI_REVISIONS_MINUTES_LOOKBACK', 2 )
###########
# STORAGE #
###########
from django.core.files.storage import default_storage
STORAGE_BACKEND = getattr(django_settings, 'WIKI_STORAGE_BACKEND', default_storage)
#################### ####################
# PLANNED SETTINGS # # PLANNED SETTINGS #
#################### ####################
......
from django.conf import settings as django_settings from django.conf import settings as django_settings
from wiki.conf import settings as wiki_settings
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
APP_LABEL = 'wiki' APP_LABEL = 'wiki'
SLUG = "attachments" SLUG = "attachments"
# Allow anonymous users to upload (not nice on an open network) # Allow anonymous users upload access (not nice on an open network)
ANONYMOUS = getattr(django_settings, 'WIKI_ATTACHMENTS_ANONYMOUS', False) # WIKI_ATTACHMENTS_ANONYMOUS can override this, otherwise the default
# in wiki.conf.settings is used.
ANONYMOUS = getattr( django_settings, 'WIKI_ATTACHMENTS_ANONYMOUS', wiki_settings.ANONYMOUS_UPLOAD )
# Maximum file sizes: Please using something like LimitRequestBody on # Maximum file sizes: Please using something like LimitRequestBody on
# your web server. # your web server.
...@@ -15,12 +18,12 @@ ANONYMOUS = getattr(django_settings, 'WIKI_ATTACHMENTS_ANONYMOUS', False) ...@@ -15,12 +18,12 @@ ANONYMOUS = getattr(django_settings, 'WIKI_ATTACHMENTS_ANONYMOUS', False)
# You should NEVER enable directory indexing in MEDIA_ROOT/UPLOAD_PATH ! # You should NEVER enable directory indexing in MEDIA_ROOT/UPLOAD_PATH !
# Actually, you can completely disable serving it, if you want. Files are # Actually, you can completely disable serving it, if you want. Files are
# sent to the user through a Django view that reads and streams a file. # sent to the user through a Django view that reads and streams a file.
UPLOAD_PATH = getattr(django_settings, 'WIKI_UPLOAD_PATH', 'wiki/uploads/%aid/') UPLOAD_PATH = getattr(django_settings, 'WIKI_ATTACHMENTS_PATH', 'wiki/attachments/%aid/')
# Should the upload path be obscurified? If so, a random hash will be added to the path # Should the upload path be obscurified? If so, a random hash will be added to the path
# such that someone can not guess the location of files (if you have # such that someone can not guess the location of files (if you have
# restricted permissions and the files are still located within the web server's # restricted permissions and the files are still located within the web server's
UPLOAD_PATH_OBSCURIFY = getattr(django_settings, 'WIKI_UPLOAD_PATH_OBSCURIFY', True) UPLOAD_PATH_OBSCURIFY = getattr(django_settings, 'WIKI_ATTACHMENTS_PATH_OBSCURIFY', True)
# Allowed extensions. Empty to disallow uploads completely. # Allowed extensions. Empty to disallow uploads completely.
# No files are saved without appending ".upload" to the file to ensure that # No files are saved without appending ".upload" to the file to ensure that
...@@ -28,10 +31,12 @@ UPLOAD_PATH_OBSCURIFY = getattr(django_settings, 'WIKI_UPLOAD_PATH_OBSCURIFY', T ...@@ -28,10 +31,12 @@ UPLOAD_PATH_OBSCURIFY = getattr(django_settings, 'WIKI_UPLOAD_PATH_OBSCURIFY', T
# Case insensitive. # Case insensitive.
# You are asked to explicitly enter all file extensions that you want # You are asked to explicitly enter all file extensions that you want
# to allow. For your own safety. # to allow. For your own safety.
FILE_EXTENSIONS = getattr(django_settings, 'WIKI_FILE_EXTENSIONS', ['pdf', 'doc', 'odt', 'docx', 'txt']) FILE_EXTENSIONS = getattr(django_settings, 'WIKI_ATTACHMENTS_EXTENSIONS', ['pdf', 'doc', 'odt', 'docx', 'txt'])
from django.core.files.storage import default_storage # Storage backend to use, default is to use the same as the rest of the
STORAGE_BACKEND = getattr(django_settings, 'WIKI_STORAGE_BACKEND', default_storage) # wiki, which is set in WIKI_STORAGE_BACKEND, but you can override it
# with WIKI_ATTACHMENTS_STORAGE_BACKEND
STORAGE_BACKEND = getattr(django_settings, 'WIKI_ATTACHMENTS_STORAGE_BACKEND', wiki_settings.STORAGE_BACKEND)
# SAFETY FIRST! Only store files with an appended .upload extension to be sure # SAFETY FIRST! Only store files with an appended .upload extension to be sure
# that something nasty does not get executed on the server. # that something nasty does not get executed on the server.
......
from django.conf import settings as django_settings from django.conf import settings as django_settings
from wiki.conf import settings as wiki_settings
SLUG = 'images'
APP_LABEL = 'wiki'
# Where to store images # Where to store images
IMAGE_PATH = getattr(django_settings, 'WIKI_IMAGE_PATH', "wiki/images/%aid/") IMAGE_PATH = getattr(django_settings, 'WIKI_IMAGES_PATH', "wiki/images/%aid/")
from django.core.files.storage import default_storage # Storage backend to use, default is to use the same as the rest of the
STORAGE_BACKEND = getattr(django_settings, 'WIKI_STORAGE_BACKEND', default_storage) # wiki, which is set in WIKI_STORAGE_BACKEND, but you can override it
# with WIKI_IMAGES_STORAGE_BACKEND
STORAGE_BACKEND = getattr(django_settings, 'WIKI_IMAGES_STORAGE_BACKEND', wiki_settings.STORAGE_BACKEND)
# Should the upload path be obscurified? If so, a random hash will be added to the path # Should the upload path be obscurified? If so, a random hash will be added to the path
# such that someone can not guess the location of files (if you have # such that someone can not guess the location of files (if you have
# restricted permissions and the files are still located within the web server's # restricted permissions and the files are still located within the web server's
IMAGE_PATH_OBSCURIFY = getattr(django_settings, 'WIKI_IMAGE_PATH_OBSCURIFY', True) IMAGE_PATH_OBSCURIFY = getattr(django_settings, 'WIKI_IMAGES_PATH_OBSCURIFY', True)
# Allow anonymous users to upload (not nice on an open network)
ANONYMOUS = getattr(django_settings, 'WIKI_ATTACHMENTS_ANONYMOUS', False)
SLUG = 'images'
APP_LABEL = 'wiki' # Allow anonymous users upload access (not nice on an open network)
\ No newline at end of file # WIKI_IMAGES_ANONYMOUS can override this, otherwise the default
# in wiki.conf.settings is used.
ANONYMOUS = getattr( django_settings, 'WIKI_IMAGES_ANONYMOUS', wiki_settings.ANONYMOUS_UPLOAD )
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment