Used entry points to detect plugins automaticly.
This commit is contained in:
parent
bc9bbb7280
commit
04b0cfb0bc
@ -15,7 +15,7 @@ Files:
|
||||
- Enabled update and delete view for uploader refering to his own files.
|
||||
Other:
|
||||
- Changed widget api. Used new metaclass.
|
||||
- Changed api for plugins.
|
||||
- Changed api for plugins. Used entry points to detect them automaticly.
|
||||
- Renamed config api classes.
|
||||
- Renamed some classes of the poll api.
|
||||
- Inserted api for the personal info widget.
|
||||
|
@ -5,6 +5,7 @@ import os
|
||||
from django.utils.translation import ugettext_lazy
|
||||
|
||||
from openslides.utils.main import filesystem2unicode
|
||||
from openslides.utils.plugins import get_plugins_from_entry_points
|
||||
|
||||
SITE_ROOT = os.path.realpath(os.path.dirname(__file__))
|
||||
|
||||
@ -125,3 +126,6 @@ HAYSTACK_CONNECTIONS = {
|
||||
|
||||
# Haystack updates search index after each save/delete action by apps
|
||||
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'
|
||||
|
||||
# Adds all automaticly collected plugins
|
||||
INSTALLED_PLUGINS = get_plugins_from_entry_points()
|
||||
|
@ -1,10 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from django.utils.importlib import import_module
|
||||
from pkg_resources import iter_entry_points
|
||||
|
||||
plugins = {}
|
||||
|
||||
|
||||
def get_plugins_from_entry_points():
|
||||
"""
|
||||
Collects all entry points in the group openslides_plugins from all
|
||||
distributions in the default working set and returns their module names as
|
||||
tuple.
|
||||
"""
|
||||
return tuple(entry_point.module_name for entry_point in iter_entry_points('openslides_plugins'))
|
||||
|
||||
|
||||
def get_plugin(plugin):
|
||||
"""
|
||||
Returns the imported module. The plugin argument must be a python dotted
|
||||
|
@ -27,7 +27,7 @@ DATABASES = {
|
||||
'PORT': ''}}
|
||||
|
||||
# Add OpenSlides plugins to this list (see example entry in comment)
|
||||
INSTALLED_PLUGINS = (
|
||||
INSTALLED_PLUGINS += (
|
||||
# 'pluginname',
|
||||
)
|
||||
|
||||
|
@ -7,6 +7,7 @@ django-mptt>=0.6,<0.7
|
||||
jsonfield>=0.9,<0.10
|
||||
pillow>=2.2,<2.3
|
||||
reportlab>=2.7,<2.8
|
||||
setuptools>=2.1,<2.2
|
||||
sockjs-tornado>=1.0,<1.1
|
||||
tornado>=3.1,<3.2
|
||||
whoosh>=2.5,<2.6
|
||||
|
Loading…
Reference in New Issue
Block a user