-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplugin_settings.py
55 lines (41 loc) · 1.23 KB
/
plugin_settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import os
from django.conf import settings
from utils import models
PLUGIN_NAME = 'Bepress Import'
DESCRIPTION = 'Plugin for importing bepress content to Janeway.'
AUTHOR = 'Birkbeck Centre for Technology and Publishing'
VERSION = '1.2'
SHORT_NAME = 'bepress'
DISPLAY_NAME = 'bepress'
MANAGER_URL = 'bepress_index'
JANEWAY_VERSION = "1.7.0"
BEPRESS_PATH = os.path.join(settings.BASE_DIR, 'files', 'plugins', 'bepress')
def get_self(install_plugin=False):
defaults = {
'display_name': DISPLAY_NAME,
'version': VERSION,
'press_wide': True,
'enabled': True,
}
self, created = models.Plugin.objects.get_or_create(
name=SHORT_NAME,
defaults=defaults
)
if install_plugin:
return self, created
return self
def install():
plugin, created = get_self(install_plugin=True)
if created:
try:
os.makedirs(BEPRESS_PATH)
except FileExistsError:
pass
print('Plugin {0} installed.'.format(PLUGIN_NAME))
else:
print('Plugin {0} is already installed.'.format(PLUGIN_NAME))
def hook_registry():
# On site load, the load function is run
# for each installed plugin to generate
# a list of hooks.
return {}