from django.utils.html import strip_tags
from forum.utils.html import sanitize_html
from forum.settings import SUMMARY_LENGTH
-from forum.modules import MODULES_PACKAGE
from utils import PickledObjectField
class NodeContent(models.Model):
import datetime
from base import *
-from forum.modules import MODULES_PACKAGE
-
from django.utils.translation import ugettext as _
-import django.dispatch
class ActiveTagManager(models.Manager):
def get_query_set(self):
-import os
import types
import logging
-MODULES_PACKAGE = 'forum_modules'
-
-MODULE_LIST = []
-
-
-def init_modules_engine(site_src_root, disabled_modules):
- modules_folder = os.path.join(site_src_root, MODULES_PACKAGE)
-
- MODULE_LIST.extend(filter(lambda m: getattr(m, 'CAN_USE', True), [
- __import__('forum_modules.%s' % f, globals(), locals(), ['forum_modules'])
- for f in os.listdir(modules_folder)
- if os.path.isdir(os.path.join(modules_folder, f)) and
- os.path.exists(os.path.join(modules_folder, "%s/__init__.py" % f)) and
- not f in disabled_modules
- ]))
-
- get_modules_folder.value = modules_folder
+from django.conf import settings
def get_modules_folder():
return get_modules_folder.value
def get_modules_script(script_name):
all = []
- for m in MODULE_LIST:
+ for m in settings.MODULE_LIST:
if hasattr(m, script_name):
all.append(getattr(m, script_name))
continue
import os, re
from forum.skins import load_template_source as skins_template_loader, Template, BaseTemplateLoader
-from forum import modules
+from django.conf import settings
MODULES_TEMPLATE_PREFIX = 'modules/'
NO_OVERRIDE_TEMPLATE_PREFIX = 'no_override/'
MODULES_TEMPLATE_OVERRIDES_FOLDER = 'template_overrides'
TEMPLATE_OVERRIDE_LOOKUP_PATHS = [f for f in [
- os.path.join(os.path.dirname(m.__file__), MODULES_TEMPLATE_OVERRIDES_FOLDER) for m in modules.MODULE_LIST
+ os.path.join(os.path.dirname(m.__file__), MODULES_TEMPLATE_OVERRIDES_FOLDER) for m in settings.MODULE_LIST
] if os.path.exists(f)
]
if name.startswith(MODULES_TEMPLATE_PREFIX):
match = self.modules_re.search(name)
- file_name = os.path.join(modules.get_modules_folder(), match.group(1), MODULES_TEMPLATE_FOLDER, match.group(2))
+ file_name = os.path.join(settings.MODULES_FOLDER, match.group(1), MODULES_TEMPLATE_FOLDER, match.group(2))
if os.path.exists(file_name):
template = Template(file_name)
if FORCE_SCRIPT_NAME.endswith('/'):
FORCE_SCRIPT_NAME = FORCE_SCRIPT_NAME[:-1]
-from forum import modules
-modules.init_modules_engine(SITE_SRC_ROOT, DISABLED_MODULES)
+#Module system initialization
+MODULES_PACKAGE = 'forum_modules'
+MODULES_FOLDER = os.path.join(SITE_SRC_ROOT, MODULES_PACKAGE)
+
+MODULE_LIST = filter(lambda m: getattr(m, 'CAN_USE', True), [
+ __import__('forum_modules.%s' % f, globals(), locals(), ['forum_modules'])
+ for f in os.listdir(MODULES_FOLDER)
+ if os.path.isdir(os.path.join(MODULES_FOLDER, f)) and
+ os.path.exists(os.path.join(MODULES_FOLDER, "%s/__init__.py" % f)) and
+ not f in DISABLED_MODULES
+])
[MIDDLEWARE_CLASSES.extend(
["%s.%s" % (m.__name__, mc) for mc in getattr(m, 'MIDDLEWARE_CLASSES', [])]
- ) for m in modules.MODULE_LIST]
+ ) for m in MODULE_LIST]
[TEMPLATE_LOADERS.extend(
["%s.%s" % (m.__name__, tl) for tl in getattr(m, 'TEMPLATE_LOADERS', [])]
- ) for m in modules.MODULE_LIST]
+ ) for m in MODULE_LIST]
INSTALLED_APPS = [