Merge pull request #1156 from normanjaeckel/AutoPlugin
Used entry points to detect plugins automaticly.
This commit is contained in:
commit
1ed41f64b6
@ -15,7 +15,7 @@ Files:
|
|||||||
- Enabled update and delete view for uploader refering to his own files.
|
- Enabled update and delete view for uploader refering to his own files.
|
||||||
Other:
|
Other:
|
||||||
- Changed widget api. Used new metaclass.
|
- 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 config api classes.
|
||||||
- Renamed some classes of the poll api.
|
- Renamed some classes of the poll api.
|
||||||
- Inserted api for the personal info widget.
|
- Inserted api for the personal info widget.
|
||||||
|
@ -5,6 +5,7 @@ import os
|
|||||||
from django.utils.translation import ugettext_lazy
|
from django.utils.translation import ugettext_lazy
|
||||||
|
|
||||||
from openslides.utils.main import filesystem2unicode
|
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__))
|
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 updates search index after each save/delete action by apps
|
||||||
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'
|
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 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from django.utils.importlib import import_module
|
from django.utils.importlib import import_module
|
||||||
|
from pkg_resources import iter_entry_points
|
||||||
|
|
||||||
plugins = {}
|
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):
|
def get_plugin(plugin):
|
||||||
"""
|
"""
|
||||||
Returns the imported module. The plugin argument must be a python dotted
|
Returns the imported module. The plugin argument must be a python dotted
|
||||||
|
@ -27,7 +27,7 @@ DATABASES = {
|
|||||||
'PORT': ''}}
|
'PORT': ''}}
|
||||||
|
|
||||||
# Add OpenSlides plugins to this list (see example entry in comment)
|
# Add OpenSlides plugins to this list (see example entry in comment)
|
||||||
INSTALLED_PLUGINS = (
|
INSTALLED_PLUGINS += (
|
||||||
# 'pluginname',
|
# 'pluginname',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ django-mptt>=0.6,<0.7
|
|||||||
jsonfield>=0.9,<0.10
|
jsonfield>=0.9,<0.10
|
||||||
pillow>=2.2,<2.3
|
pillow>=2.2,<2.3
|
||||||
reportlab>=2.7,<2.8
|
reportlab>=2.7,<2.8
|
||||||
|
setuptools>=2.1,<2.2
|
||||||
sockjs-tornado>=1.0,<1.1
|
sockjs-tornado>=1.0,<1.1
|
||||||
tornado>=3.1,<3.2
|
tornado>=3.1,<3.2
|
||||||
whoosh>=2.5,<2.6
|
whoosh>=2.5,<2.6
|
||||||
|
Loading…
Reference in New Issue
Block a user