Load multiple media types based on the media_types section of the config file

This commit is contained in:
Christopher Allan Webber 2011-11-25 11:41:24 -06:00
parent 99d2ac1d83
commit cfa96da734
3 changed files with 9 additions and 13 deletions

View File

@ -11,6 +11,9 @@ email_debug_mode = true
# Set to false to disable registrations # Set to false to disable registrations
allow_registration = true allow_registration = true
## Uncomment this to turn on video or enable other media types
# media_types = mediagoblin.media_types.image, mediagoblin.media_types.video
## Uncomment this to put some user-overriding templates here ## Uncomment this to put some user-overriding templates here
#local_templates = %(here)s/user_dev/templates/ #local_templates = %(here)s/user_dev/templates/

View File

@ -2,16 +2,17 @@
# HTML title of the pages # HTML title of the pages
html_title = string(default="GNU MediaGoblin") html_title = string(default="GNU MediaGoblin")
# Enabled media types
media_types = string_list(default=list("mediagoblin.media_types.image"))
# database stuff # database stuff
db_host = string() db_host = string()
db_name = string(default="mediagoblin") db_name = string(default="mediagoblin")
db_port = integer() db_port = integer()
# Where temporary files used in processing and etc are kept # Where temporary files used in processing and etc are kept
workbench_path = string(default="%(here)s/user_dev/media/workbench") workbench_path = string(default="%(here)s/user_dev/media/workbench")
# Where mediagoblin-builtin static assets are kept # Where mediagoblin-builtin static assets are kept
direct_remote_path = string(default="/mgoblin_static/") direct_remote_path = string(default="/mgoblin_static/")

View File

@ -27,20 +27,12 @@ class FileTypeNotSupported(Exception):
class InvalidFileType(Exception): class InvalidFileType(Exception):
pass pass
# This should be more dynamic in the future. Perhaps put it in the .ini?
# -- Joar
MEDIA_TYPES = [
'mediagoblin.media_types.image']
if mg_globals.app_config['enable_video']:
MEDIA_TYPES.append('mediagoblin.media_types.video')
def get_media_types(): def get_media_types():
''' """
Generator that returns the available media types Generator that returns the available media types
''' """
for media_type in MEDIA_TYPES: for media_type in mg_globals.app_config['media_types']:
yield media_type yield media_type