mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
Reorganize python sources into 'plinth' package
This commit is contained in:
parent
eaacd3864b
commit
65fa648d9f
10
plinth.py → plinth/__main__.py
Executable file → Normal file
10
plinth.py → plinth/__main__.py
Executable file → Normal file
@ -13,9 +13,9 @@ import cherrypy
|
|||||||
from cherrypy import _cpserver
|
from cherrypy import _cpserver
|
||||||
from cherrypy.process.plugins import Daemonizer
|
from cherrypy.process.plugins import Daemonizer
|
||||||
|
|
||||||
import cfg
|
from plinth import cfg
|
||||||
import module_loader
|
from plinth import module_loader
|
||||||
import service
|
from plinth import service
|
||||||
|
|
||||||
__version__ = "0.2.14"
|
__version__ = "0.2.14"
|
||||||
__author__ = "James Vasile"
|
__author__ = "James Vasile"
|
||||||
@ -141,7 +141,7 @@ def configure_django():
|
|||||||
'django.core.context_processors.static',
|
'django.core.context_processors.static',
|
||||||
'django.core.context_processors.tz',
|
'django.core.context_processors.tz',
|
||||||
'django.contrib.messages.context_processors.messages',
|
'django.contrib.messages.context_processors.messages',
|
||||||
'context_processors.common']
|
'plinth.context_processors.common']
|
||||||
|
|
||||||
logging_configuration = {
|
logging_configuration = {
|
||||||
'version': 1,
|
'version': 1,
|
||||||
@ -198,7 +198,7 @@ def configure_django():
|
|||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
'modules.first_boot.middleware.FirstBootMiddleware',
|
'modules.first_boot.middleware.FirstBootMiddleware',
|
||||||
),
|
),
|
||||||
ROOT_URLCONF='urls',
|
ROOT_URLCONF='plinth.urls',
|
||||||
SESSION_ENGINE='django.contrib.sessions.backends.file',
|
SESSION_ENGINE='django.contrib.sessions.backends.file',
|
||||||
SESSION_FILE_PATH=sessions_directory,
|
SESSION_FILE_PATH=sessions_directory,
|
||||||
STATIC_URL=cfg.server_dir + '/static/',
|
STATIC_URL=cfg.server_dir + '/static/',
|
||||||
@ -28,6 +28,7 @@ main_menu = Menu()
|
|||||||
def read():
|
def read():
|
||||||
"""Read configuration"""
|
"""Read configuration"""
|
||||||
directory = os.path.dirname(os.path.realpath(__file__))
|
directory = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
directory = os.path.join(directory, '..')
|
||||||
parser = SafeConfigParser(
|
parser = SafeConfigParser(
|
||||||
defaults={
|
defaults={
|
||||||
'root': directory,
|
'root': directory,
|
||||||
@ -24,8 +24,8 @@ import importlib
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import urls
|
from plinth import cfg
|
||||||
import cfg
|
from plinth import urls
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__name__)
|
LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -39,8 +39,9 @@ def load_modules():
|
|||||||
"""
|
"""
|
||||||
module_names = []
|
module_names = []
|
||||||
modules = {}
|
modules = {}
|
||||||
for name in os.listdir('modules/enabled'):
|
directory = os.path.dirname(os.path.abspath(__file__))
|
||||||
full_name = 'modules.{module}'.format(module=name)
|
for name in os.listdir(os.path.join(directory, 'modules', 'enabled')):
|
||||||
|
full_name = 'plinth.modules.{module}'.format(module=name)
|
||||||
|
|
||||||
LOGGER.info('Importing %s', full_name)
|
LOGGER.info('Importing %s', full_name)
|
||||||
try:
|
try:
|
||||||
@ -139,7 +140,7 @@ def get_template_directories():
|
|||||||
core_directory = os.path.join(directory, 'templates')
|
core_directory = os.path.join(directory, 'templates')
|
||||||
|
|
||||||
directories = set((core_directory,))
|
directories = set((core_directory,))
|
||||||
for name in os.listdir('modules/enabled'):
|
for name in os.listdir(os.path.join(directory, 'modules', 'enabled')):
|
||||||
directories.add(os.path.join(directory, 'modules', name, 'templates'))
|
directories.add(os.path.join(directory, 'modules', name, 'templates'))
|
||||||
|
|
||||||
return directories
|
return directories
|
||||||
0
plinth/modules/__init__.py
Normal file
0
plinth/modules/__init__.py
Normal file
@ -1,7 +1,7 @@
|
|||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
import cfg
|
from plinth import cfg
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
@ -23,6 +23,6 @@ from django.conf.urls import patterns, url
|
|||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns( # pylint: disable-msg=C0103
|
urlpatterns = patterns( # pylint: disable-msg=C0103
|
||||||
'modules.apps.apps',
|
'plinth.modules.apps.apps',
|
||||||
url(r'^apps/$', 'index', name='index')
|
url(r'^apps/$', 'index', name='index')
|
||||||
)
|
)
|
||||||
@ -29,9 +29,9 @@ import logging
|
|||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
import actions
|
from plinth import actions
|
||||||
import cfg
|
from plinth import cfg
|
||||||
import util
|
from plinth import util
|
||||||
|
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__name__)
|
LOGGER = logging.getLogger(__name__)
|
||||||
@ -23,6 +23,6 @@ from django.conf.urls import patterns, url
|
|||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns( # pylint: disable-msg=C0103
|
urlpatterns = patterns( # pylint: disable-msg=C0103
|
||||||
'modules.config.config',
|
'plinth.modules.config.config',
|
||||||
url(r'^sys/config/$', 'index', name='index'),
|
url(r'^sys/config/$', 'index', name='index'),
|
||||||
)
|
)
|
||||||
@ -23,9 +23,9 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
import actions
|
from plinth import actions
|
||||||
import cfg
|
from plinth import cfg
|
||||||
from errors import ActionError
|
from plinth.errors import ActionError
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
@ -23,7 +23,7 @@ from django.conf.urls import patterns, url
|
|||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns( # pylint: disable-msg=C0103
|
urlpatterns = patterns( # pylint: disable-msg=C0103
|
||||||
'modules.diagnostics.diagnostics',
|
'plinth.modules.diagnostics.diagnostics',
|
||||||
url(r'^sys/diagnostics/$', 'index', name='index'),
|
url(r'^sys/diagnostics/$', 'index', name='index'),
|
||||||
url(r'^sys/diagnostics/test/$', 'test', name='test'),
|
url(r'^sys/diagnostics/test/$', 'test', name='test'),
|
||||||
)
|
)
|
||||||
@ -4,8 +4,8 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
import cfg
|
from plinth import cfg
|
||||||
from ..lib.auth import get_group
|
from plinth.modules.lib.auth import get_group
|
||||||
|
|
||||||
|
|
||||||
class ExpertsForm(forms.Form): # pylint: disable-msg=W0232
|
class ExpertsForm(forms.Form): # pylint: disable-msg=W0232
|
||||||
@ -23,6 +23,6 @@ from django.conf.urls import patterns, url
|
|||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns( # pylint: disable-msg=C0103
|
urlpatterns = patterns( # pylint: disable-msg=C0103
|
||||||
'modules.expert_mode.expert_mode',
|
'plinth.modules.expert_mode.expert_mode',
|
||||||
url(r'^sys/expert/$', 'index', name='index'),
|
url(r'^sys/expert/$', 'index', name='index'),
|
||||||
)
|
)
|
||||||
@ -24,9 +24,9 @@ from django.template.response import TemplateResponse
|
|||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import actions
|
from plinth import actions
|
||||||
import cfg
|
from plinth import cfg
|
||||||
import service as service_module
|
import plinth.service as service_module
|
||||||
|
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__name__)
|
LOGGER = logging.getLogger(__name__)
|
||||||
@ -23,6 +23,6 @@ from django.conf.urls import patterns, url
|
|||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns( # pylint: disable-msg=C0103
|
urlpatterns = patterns( # pylint: disable-msg=C0103
|
||||||
'modules.firewall.firewall',
|
'plinth.modules.firewall.firewall',
|
||||||
url(r'^sys/firewall/$', 'index', name='index')
|
url(r'^sys/firewall/$', 'index', name='index')
|
||||||
)
|
)
|
||||||
@ -26,10 +26,10 @@ from django.http.response import HttpResponseRedirect
|
|||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
from ..lib.auth import add_user
|
from plinth import cfg
|
||||||
from ..config import config
|
from plinth.modules.config import config
|
||||||
|
from plinth.modules.lib.auth import add_user
|
||||||
from withsqlite.withsqlite import sqlite_db
|
from withsqlite.withsqlite import sqlite_db
|
||||||
import cfg
|
|
||||||
|
|
||||||
|
|
||||||
## TODO: flesh out these tests values
|
## TODO: flesh out these tests values
|
||||||
@ -23,7 +23,7 @@ from django.conf.urls import patterns, url
|
|||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns( # pylint: disable-msg=C0103
|
urlpatterns = patterns( # pylint: disable-msg=C0103
|
||||||
'modules.first_boot.first_boot',
|
'plinth.modules.first_boot.first_boot',
|
||||||
url(r'^firstboot/$', 'index', name='index'),
|
url(r'^firstboot/$', 'index', name='index'),
|
||||||
url(r'^firstboot/state0/$', 'state0', name='state0'),
|
url(r'^firstboot/state0/$', 'state0', name='state0'),
|
||||||
url(r'^firstboot/state1/$', 'state1', name='state1')
|
url(r'^firstboot/state1/$', 'state1', name='state1')
|
||||||
@ -3,7 +3,7 @@ from gettext import gettext as _
|
|||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
|
|
||||||
import cfg
|
from plinth import cfg
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
@ -23,7 +23,7 @@ from django.conf.urls import patterns, url
|
|||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns( # pylint: disable-msg=C0103
|
urlpatterns = patterns( # pylint: disable-msg=C0103
|
||||||
'modules.help.help',
|
'plinth.modules.help.help',
|
||||||
# having two urls for one page is a hack to help the current url/menu
|
# having two urls for one page is a hack to help the current url/menu
|
||||||
# system highlight the correct menu item. Every submenu-item with the same
|
# system highlight the correct menu item. Every submenu-item with the same
|
||||||
# url prefix as the main-menu is highlighted automatically.
|
# url prefix as the main-menu is highlighted automatically.
|
||||||
@ -4,9 +4,9 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
import actions
|
from plinth import actions
|
||||||
import cfg
|
from plinth import cfg
|
||||||
import service
|
from plinth import service
|
||||||
|
|
||||||
|
|
||||||
SERVICE = None
|
SERVICE = None
|
||||||
@ -23,6 +23,6 @@ from django.conf.urls import patterns, url
|
|||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns( # pylint: disable-msg=C0103
|
urlpatterns = patterns( # pylint: disable-msg=C0103
|
||||||
'modules.owncloud.owncloud',
|
'plinth.modules.owncloud.owncloud',
|
||||||
url(r'^apps/owncloud/$', 'index', name='index'),
|
url(r'^apps/owncloud/$', 'index', name='index'),
|
||||||
)
|
)
|
||||||
@ -4,8 +4,8 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
import actions
|
from plinth import actions
|
||||||
import cfg
|
from plinth import cfg
|
||||||
|
|
||||||
|
|
||||||
def get_modules_available():
|
def get_modules_available():
|
||||||
@ -23,6 +23,6 @@ from django.conf.urls import patterns, url
|
|||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns( # pylint: disable-msg=C0103
|
urlpatterns = patterns( # pylint: disable-msg=C0103
|
||||||
'modules.packages.packages',
|
'plinth.modules.packages.packages',
|
||||||
url(r'^sys/packages/$', 'index', name='index'),
|
url(r'^sys/packages/$', 'index', name='index')
|
||||||
)
|
)
|
||||||
@ -30,8 +30,8 @@ from django.template.response import TemplateResponse
|
|||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import actions
|
from plinth import actions
|
||||||
import cfg
|
from plinth import cfg
|
||||||
|
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__name__)
|
LOGGER = logging.getLogger(__name__)
|
||||||
@ -23,7 +23,7 @@ from django.conf.urls import patterns, url
|
|||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns( # pylint: disable-msg=C0103
|
urlpatterns = patterns( # pylint: disable-msg=C0103
|
||||||
'modules.pagekite.pagekite',
|
'plinth.modules.pagekite.pagekite',
|
||||||
url(r'^apps/pagekite/$', 'index', name='index'),
|
url(r'^apps/pagekite/$', 'index', name='index'),
|
||||||
url(r'^apps/pagekite/configure/$', 'configure', name='configure'),
|
url(r'^apps/pagekite/configure/$', 'configure', name='configure'),
|
||||||
)
|
)
|
||||||
@ -1,7 +1,7 @@
|
|||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
|
|
||||||
import cfg
|
from plinth import cfg
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
@ -23,6 +23,6 @@ from django.conf.urls import patterns, url
|
|||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns( # pylint: disable-msg=C0103
|
urlpatterns = patterns( # pylint: disable-msg=C0103
|
||||||
'modules.system.system',
|
'plinth.modules.system.system',
|
||||||
url(r'^sys/$', 'index', name='index'),
|
url(r'^sys/$', 'index', name='index'),
|
||||||
)
|
)
|
||||||
@ -23,8 +23,8 @@ from django.contrib.auth.decorators import login_required
|
|||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
import actions
|
from plinth import actions
|
||||||
import cfg
|
from plinth import cfg
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
@ -23,6 +23,6 @@ from django.conf.urls import patterns, url
|
|||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns( # pylint: disable-msg=C0103
|
urlpatterns = patterns( # pylint: disable-msg=C0103
|
||||||
'modules.tor.tor',
|
'plinth.modules.tor.tor',
|
||||||
url(r'^apps/tor/$', 'index', name='index')
|
url(r'^apps/tor/$', 'index', name='index')
|
||||||
)
|
)
|
||||||
@ -23,8 +23,8 @@ from django.conf.urls import patterns, url
|
|||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns( # pylint: disable-msg=C0103
|
urlpatterns = patterns( # pylint: disable-msg=C0103
|
||||||
'modules.users.users',
|
'plinth.modules.users.users',
|
||||||
url(r'^sys/users/$', 'index', name='index'),
|
url(r'^sys/users/$', 'index', name='index'),
|
||||||
url(r'^sys/users/add/$', 'add', name='add'),
|
url(r'^sys/users/add/$', 'add', name='add'),
|
||||||
url(r'^sys/users/edit/$', 'edit', name='edit')
|
url(r'^sys/users/edit/$', 'edit', name='edit')
|
||||||
)
|
)
|
||||||
@ -10,8 +10,8 @@ from django.template.response import TemplateResponse
|
|||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import cfg
|
from plinth import cfg
|
||||||
from ..lib.auth import add_user
|
from plinth.modules.lib.auth import add_user
|
||||||
|
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__name__)
|
LOGGER = logging.getLogger(__name__)
|
||||||
@ -23,8 +23,8 @@ from django.conf.urls import patterns, url
|
|||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns( # pylint: disable-msg=C0103
|
urlpatterns = patterns( # pylint: disable-msg=C0103
|
||||||
'modules.xmpp.xmpp',
|
'plinth.modules.xmpp.xmpp',
|
||||||
url(r'^apps/xmpp/$', 'index', name='index'),
|
url(r'^apps/xmpp/$', 'index', name='index'),
|
||||||
url(r'^apps/xmpp/configure/$', 'configure', name='configure'),
|
url(r'^apps/xmpp/configure/$', 'configure', name='configure'),
|
||||||
url(r'^apps/xmpp/register/$', 'register', name='register')
|
url(r'^apps/xmpp/register/$', 'register', name='register')
|
||||||
)
|
)
|
||||||
@ -8,9 +8,9 @@ from django.template.response import TemplateResponse
|
|||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import actions
|
from plinth import actions
|
||||||
import cfg
|
from plinth import cfg
|
||||||
import service
|
from plinth import service
|
||||||
|
|
||||||
|
|
||||||
LOGGER = logging.getLogger(__name__)
|
LOGGER = logging.getLogger(__name__)
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user