From 65fa648d9f24cc7d3500ad2a3a4c8e2540464f3e Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 8 Jul 2014 13:14:30 +0200 Subject: [PATCH] Reorganize python sources into 'plinth' package --- plinth => bin/plinth | 0 {modules => plinth}/__init__.py | 0 plinth.py => plinth/__main__.py | 10 +++++----- actions.py => plinth/actions.py | 0 cfg.py => plinth/cfg.py | 1 + .../context_processors.py | 0 errors.py => plinth/errors.py | 0 menu.py => plinth/menu.py | 0 module_loader.py => plinth/module_loader.py | 11 ++++++----- plinth/modules/__init__.py | 0 {modules => plinth/modules}/apps/__init__.py | 0 {modules => plinth/modules}/apps/apps.py | 2 +- .../modules}/apps/templates/apps.html | 0 {modules => plinth/modules}/apps/urls.py | 2 +- {modules => plinth/modules}/config/__init__.py | 0 {modules => plinth/modules}/config/config.py | 6 +++--- .../modules}/config/templates/config.html | 0 {modules => plinth/modules}/config/urls.py | 2 +- {modules => plinth/modules}/diagnostics/__init__.py | 0 .../modules}/diagnostics/diagnostics.py | 6 +++--- .../modules}/diagnostics/templates/diagnostics.html | 0 .../diagnostics/templates/diagnostics_test.html | 0 {modules => plinth/modules}/diagnostics/urls.py | 2 +- {modules => plinth/modules}/enabled/apps | 0 {modules => plinth/modules}/enabled/config | 0 {modules => plinth/modules}/enabled/diagnostics | 0 {modules => plinth/modules}/enabled/expert_mode | 0 {modules => plinth/modules}/enabled/firewall | 0 {modules => plinth/modules}/enabled/first_boot | 0 {modules => plinth/modules}/enabled/help | 0 {modules => plinth/modules}/enabled/lib | 0 {modules => plinth/modules}/enabled/owncloud | 0 {modules => plinth/modules}/enabled/packages | 0 {modules => plinth/modules}/enabled/pagekite | 0 {modules => plinth/modules}/enabled/system | 0 {modules => plinth/modules}/enabled/tor | 0 {modules => plinth/modules}/enabled/users | 0 {modules => plinth/modules}/enabled/xmpp | 0 {modules => plinth/modules}/expert_mode/__init__.py | 0 .../modules}/expert_mode/expert_mode.py | 4 ++-- .../modules}/expert_mode/templates/expert_mode.html | 0 {modules => plinth/modules}/expert_mode/urls.py | 2 +- {modules => plinth/modules}/firewall/__init__.py | 0 {modules => plinth/modules}/firewall/firewall.py | 6 +++--- .../modules}/firewall/templates/firewall.html | 0 {modules => plinth/modules}/firewall/urls.py | 2 +- {modules => plinth/modules}/first_boot/__init__.py | 0 .../modules}/first_boot/first_boot.py | 6 +++--- .../modules}/first_boot/middleware.py | 0 .../first_boot/templates/firstboot_sidebar.html | 0 .../first_boot/templates/firstboot_state0.html | 0 .../first_boot/templates/firstboot_state1.html | 0 {modules => plinth/modules}/first_boot/urls.py | 2 +- {modules => plinth/modules}/help/__init__.py | 0 {modules => plinth/modules}/help/help.py | 2 +- .../modules}/help/templates/about.html | 0 .../modules}/help/templates/help.html | 0 {modules => plinth/modules}/help/urls.py | 2 +- {modules => plinth/modules}/lib/__init__.py | 0 {modules => plinth/modules}/lib/auth.py | 0 {modules => plinth/modules}/lib/urls.py | 0 {modules => plinth/modules}/owncloud/__init__.py | 0 {modules => plinth/modules}/owncloud/owncloud.py | 6 +++--- .../modules}/owncloud/templates/owncloud.html | 0 {modules => plinth/modules}/owncloud/urls.py | 2 +- {modules => plinth/modules}/packages/__init__.py | 0 {modules => plinth/modules}/packages/packages.py | 4 ++-- .../modules}/packages/templates/packages.html | 0 {modules => plinth/modules}/packages/urls.py | 6 +++--- {modules => plinth/modules}/pagekite/__init__.py | 0 {modules => plinth/modules}/pagekite/pagekite.py | 4 ++-- .../pagekite/templates/pagekite_configure.html | 0 .../pagekite/templates/pagekite_introduction.html | 0 {modules => plinth/modules}/pagekite/urls.py | 2 +- {modules => plinth/modules}/santiago/__init__.py | 0 {modules => plinth/modules}/santiago/santiago.py | 0 {modules => plinth/modules}/system/__init__.py | 0 {modules => plinth/modules}/system/system.py | 2 +- .../modules}/system/templates/system.html | 0 {modules => plinth/modules}/system/urls.py | 2 +- {modules => plinth/modules}/tor/__init__.py | 0 {modules => plinth/modules}/tor/templates/tor.html | 0 {modules => plinth/modules}/tor/tor.py | 4 ++-- {modules => plinth/modules}/tor/urls.py | 2 +- {modules => plinth/modules}/users/__init__.py | 0 .../modules}/users/templates/users_add.html | 0 .../modules}/users/templates/users_edit.html | 0 {modules => plinth/modules}/users/urls.py | 4 ++-- {modules => plinth/modules}/users/users.py | 4 ++-- {modules => plinth/modules}/xmpp/__init__.py | 0 .../modules}/xmpp/templates/xmpp_configure.html | 0 .../modules}/xmpp/templates/xmpp_register.html | 0 {modules => plinth/modules}/xmpp/urls.py | 4 ++-- {modules => plinth/modules}/xmpp/xmpp.py | 6 +++--- service.py => plinth/service.py | 0 {templates => plinth/templates}/404.html | 0 {templates => plinth/templates}/500.html | 0 {templates => plinth/templates}/base.html | 0 {templates => plinth/templates}/form.html | 0 {templates => plinth/templates}/login.html | 0 {templates => plinth/templates}/menu.html | 0 {templates => plinth/templates}/menu_block.html | 0 {templates => plinth/templates}/messages.html | 0 plinth/tests/__init__.py | 0 {tests => plinth/tests}/actions_test.py | 0 {tests => plinth/tests}/testdata/users.sqlite3 | Bin urls.py => plinth/urls.py | 4 ++-- util.py => plinth/util.py | 0 views.py => plinth/views.py | 0 109 files changed, 63 insertions(+), 61 deletions(-) rename plinth => bin/plinth (100%) rename {modules => plinth}/__init__.py (100%) rename plinth.py => plinth/__main__.py (97%) mode change 100755 => 100644 rename actions.py => plinth/actions.py (100%) rename cfg.py => plinth/cfg.py (97%) rename context_processors.py => plinth/context_processors.py (100%) rename errors.py => plinth/errors.py (100%) rename menu.py => plinth/menu.py (100%) rename module_loader.py => plinth/module_loader.py (92%) create mode 100644 plinth/modules/__init__.py rename {modules => plinth/modules}/apps/__init__.py (100%) rename {modules => plinth/modules}/apps/apps.py (93%) rename {modules => plinth/modules}/apps/templates/apps.html (100%) rename {modules => plinth/modules}/apps/urls.py (96%) rename {modules => plinth/modules}/config/__init__.py (100%) rename {modules => plinth/modules}/config/config.py (98%) rename {modules => plinth/modules}/config/templates/config.html (100%) rename {modules => plinth/modules}/config/urls.py (96%) rename {modules => plinth/modules}/diagnostics/__init__.py (100%) rename {modules => plinth/modules}/diagnostics/diagnostics.py (95%) rename {modules => plinth/modules}/diagnostics/templates/diagnostics.html (100%) rename {modules => plinth/modules}/diagnostics/templates/diagnostics_test.html (100%) rename {modules => plinth/modules}/diagnostics/urls.py (95%) rename {modules => plinth/modules}/enabled/apps (100%) rename {modules => plinth/modules}/enabled/config (100%) rename {modules => plinth/modules}/enabled/diagnostics (100%) rename {modules => plinth/modules}/enabled/expert_mode (100%) rename {modules => plinth/modules}/enabled/firewall (100%) rename {modules => plinth/modules}/enabled/first_boot (100%) rename {modules => plinth/modules}/enabled/help (100%) rename {modules => plinth/modules}/enabled/lib (100%) rename {modules => plinth/modules}/enabled/owncloud (100%) rename {modules => plinth/modules}/enabled/packages (100%) rename {modules => plinth/modules}/enabled/pagekite (100%) rename {modules => plinth/modules}/enabled/system (100%) rename {modules => plinth/modules}/enabled/tor (100%) rename {modules => plinth/modules}/enabled/users (100%) rename {modules => plinth/modules}/enabled/xmpp (100%) rename {modules => plinth/modules}/expert_mode/__init__.py (100%) rename {modules => plinth/modules}/expert_mode/expert_mode.py (96%) rename {modules => plinth/modules}/expert_mode/templates/expert_mode.html (100%) rename {modules => plinth/modules}/expert_mode/urls.py (95%) rename {modules => plinth/modules}/firewall/__init__.py (100%) rename {modules => plinth/modules}/firewall/firewall.py (98%) rename {modules => plinth/modules}/firewall/templates/firewall.html (100%) rename {modules => plinth/modules}/firewall/urls.py (95%) rename {modules => plinth/modules}/first_boot/__init__.py (100%) rename {modules => plinth/modules}/first_boot/first_boot.py (98%) rename {modules => plinth/modules}/first_boot/middleware.py (100%) rename {modules => plinth/modules}/first_boot/templates/firstboot_sidebar.html (100%) rename {modules => plinth/modules}/first_boot/templates/firstboot_state0.html (100%) rename {modules => plinth/modules}/first_boot/templates/firstboot_state1.html (100%) rename {modules => plinth/modules}/first_boot/urls.py (95%) rename {modules => plinth/modules}/help/__init__.py (100%) rename {modules => plinth/modules}/help/help.py (98%) rename {modules => plinth/modules}/help/templates/about.html (100%) rename {modules => plinth/modules}/help/templates/help.html (100%) rename {modules => plinth/modules}/help/urls.py (97%) rename {modules => plinth/modules}/lib/__init__.py (100%) rename {modules => plinth/modules}/lib/auth.py (100%) rename {modules => plinth/modules}/lib/urls.py (100%) rename {modules => plinth/modules}/owncloud/__init__.py (100%) rename {modules => plinth/modules}/owncloud/owncloud.py (96%) rename {modules => plinth/modules}/owncloud/templates/owncloud.html (100%) rename {modules => plinth/modules}/owncloud/urls.py (95%) rename {modules => plinth/modules}/packages/__init__.py (100%) rename {modules => plinth/modules}/packages/packages.py (98%) rename {modules => plinth/modules}/packages/templates/packages.html (100%) rename {modules => plinth/modules}/packages/urls.py (89%) rename {modules => plinth/modules}/pagekite/__init__.py (100%) rename {modules => plinth/modules}/pagekite/pagekite.py (99%) rename {modules => plinth/modules}/pagekite/templates/pagekite_configure.html (100%) rename {modules => plinth/modules}/pagekite/templates/pagekite_introduction.html (100%) rename {modules => plinth/modules}/pagekite/urls.py (95%) rename {modules => plinth/modules}/santiago/__init__.py (100%) rename {modules => plinth/modules}/santiago/santiago.py (100%) rename {modules => plinth/modules}/system/__init__.py (100%) rename {modules => plinth/modules}/system/system.py (94%) rename {modules => plinth/modules}/system/templates/system.html (100%) rename {modules => plinth/modules}/system/urls.py (96%) rename {modules => plinth/modules}/tor/__init__.py (100%) rename {modules => plinth/modules}/tor/templates/tor.html (100%) rename {modules => plinth/modules}/tor/tor.py (96%) rename {modules => plinth/modules}/tor/urls.py (96%) rename {modules => plinth/modules}/users/__init__.py (100%) rename {modules => plinth/modules}/users/templates/users_add.html (100%) rename {modules => plinth/modules}/users/templates/users_edit.html (100%) rename {modules => plinth/modules}/users/urls.py (96%) rename {modules => plinth/modules}/users/users.py (98%) rename {modules => plinth/modules}/xmpp/__init__.py (100%) rename {modules => plinth/modules}/xmpp/templates/xmpp_configure.html (100%) rename {modules => plinth/modules}/xmpp/templates/xmpp_register.html (100%) rename {modules => plinth/modules}/xmpp/urls.py (96%) rename {modules => plinth/modules}/xmpp/xmpp.py (98%) rename service.py => plinth/service.py (100%) rename {templates => plinth/templates}/404.html (100%) rename {templates => plinth/templates}/500.html (100%) rename {templates => plinth/templates}/base.html (100%) rename {templates => plinth/templates}/form.html (100%) rename {templates => plinth/templates}/login.html (100%) rename {templates => plinth/templates}/menu.html (100%) rename {templates => plinth/templates}/menu_block.html (100%) rename {templates => plinth/templates}/messages.html (100%) create mode 100644 plinth/tests/__init__.py rename {tests => plinth/tests}/actions_test.py (100%) rename {tests => plinth/tests}/testdata/users.sqlite3 (100%) rename urls.py => plinth/urls.py (97%) rename util.py => plinth/util.py (100%) rename views.py => plinth/views.py (100%) diff --git a/plinth b/bin/plinth similarity index 100% rename from plinth rename to bin/plinth diff --git a/modules/__init__.py b/plinth/__init__.py similarity index 100% rename from modules/__init__.py rename to plinth/__init__.py diff --git a/plinth.py b/plinth/__main__.py old mode 100755 new mode 100644 similarity index 97% rename from plinth.py rename to plinth/__main__.py index 969e0b9b4..25a67d652 --- a/plinth.py +++ b/plinth/__main__.py @@ -13,9 +13,9 @@ import cherrypy from cherrypy import _cpserver from cherrypy.process.plugins import Daemonizer -import cfg -import module_loader -import service +from plinth import cfg +from plinth import module_loader +from plinth import service __version__ = "0.2.14" __author__ = "James Vasile" @@ -141,7 +141,7 @@ def configure_django(): 'django.core.context_processors.static', 'django.core.context_processors.tz', 'django.contrib.messages.context_processors.messages', - 'context_processors.common'] + 'plinth.context_processors.common'] logging_configuration = { 'version': 1, @@ -198,7 +198,7 @@ def configure_django(): 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'modules.first_boot.middleware.FirstBootMiddleware', ), - ROOT_URLCONF='urls', + ROOT_URLCONF='plinth.urls', SESSION_ENGINE='django.contrib.sessions.backends.file', SESSION_FILE_PATH=sessions_directory, STATIC_URL=cfg.server_dir + '/static/', diff --git a/actions.py b/plinth/actions.py similarity index 100% rename from actions.py rename to plinth/actions.py diff --git a/cfg.py b/plinth/cfg.py similarity index 97% rename from cfg.py rename to plinth/cfg.py index 4844393c4..3f8b687b5 100644 --- a/cfg.py +++ b/plinth/cfg.py @@ -28,6 +28,7 @@ main_menu = Menu() def read(): """Read configuration""" directory = os.path.dirname(os.path.realpath(__file__)) + directory = os.path.join(directory, '..') parser = SafeConfigParser( defaults={ 'root': directory, diff --git a/context_processors.py b/plinth/context_processors.py similarity index 100% rename from context_processors.py rename to plinth/context_processors.py diff --git a/errors.py b/plinth/errors.py similarity index 100% rename from errors.py rename to plinth/errors.py diff --git a/menu.py b/plinth/menu.py similarity index 100% rename from menu.py rename to plinth/menu.py diff --git a/module_loader.py b/plinth/module_loader.py similarity index 92% rename from module_loader.py rename to plinth/module_loader.py index e14dd4551..b552d2260 100644 --- a/module_loader.py +++ b/plinth/module_loader.py @@ -24,8 +24,8 @@ import importlib import logging import os -import urls -import cfg +from plinth import cfg +from plinth import urls LOGGER = logging.getLogger(__name__) @@ -39,8 +39,9 @@ def load_modules(): """ module_names = [] modules = {} - for name in os.listdir('modules/enabled'): - full_name = 'modules.{module}'.format(module=name) + directory = os.path.dirname(os.path.abspath(__file__)) + 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) try: @@ -139,7 +140,7 @@ def get_template_directories(): core_directory = os.path.join(directory, 'templates') 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')) return directories diff --git a/plinth/modules/__init__.py b/plinth/modules/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/modules/apps/__init__.py b/plinth/modules/apps/__init__.py similarity index 100% rename from modules/apps/__init__.py rename to plinth/modules/apps/__init__.py diff --git a/modules/apps/apps.py b/plinth/modules/apps/apps.py similarity index 93% rename from modules/apps/apps.py rename to plinth/modules/apps/apps.py index 206ae5da0..69cc1b90e 100644 --- a/modules/apps/apps.py +++ b/plinth/modules/apps/apps.py @@ -1,7 +1,7 @@ from django.template.response import TemplateResponse from gettext import gettext as _ -import cfg +from plinth import cfg def init(): diff --git a/modules/apps/templates/apps.html b/plinth/modules/apps/templates/apps.html similarity index 100% rename from modules/apps/templates/apps.html rename to plinth/modules/apps/templates/apps.html diff --git a/modules/apps/urls.py b/plinth/modules/apps/urls.py similarity index 96% rename from modules/apps/urls.py rename to plinth/modules/apps/urls.py index b47f44cde..db2b9e547 100644 --- a/modules/apps/urls.py +++ b/plinth/modules/apps/urls.py @@ -23,6 +23,6 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.apps.apps', + 'plinth.modules.apps.apps', url(r'^apps/$', 'index', name='index') ) diff --git a/modules/config/__init__.py b/plinth/modules/config/__init__.py similarity index 100% rename from modules/config/__init__.py rename to plinth/modules/config/__init__.py diff --git a/modules/config/config.py b/plinth/modules/config/config.py similarity index 98% rename from modules/config/config.py rename to plinth/modules/config/config.py index 1d11a9008..5c88424cd 100644 --- a/modules/config/config.py +++ b/plinth/modules/config/config.py @@ -29,9 +29,9 @@ import logging import re import socket -import actions -import cfg -import util +from plinth import actions +from plinth import cfg +from plinth import util LOGGER = logging.getLogger(__name__) diff --git a/modules/config/templates/config.html b/plinth/modules/config/templates/config.html similarity index 100% rename from modules/config/templates/config.html rename to plinth/modules/config/templates/config.html diff --git a/modules/config/urls.py b/plinth/modules/config/urls.py similarity index 96% rename from modules/config/urls.py rename to plinth/modules/config/urls.py index e80f518dc..a66f593d0 100644 --- a/modules/config/urls.py +++ b/plinth/modules/config/urls.py @@ -23,6 +23,6 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.config.config', + 'plinth.modules.config.config', url(r'^sys/config/$', 'index', name='index'), ) diff --git a/modules/diagnostics/__init__.py b/plinth/modules/diagnostics/__init__.py similarity index 100% rename from modules/diagnostics/__init__.py rename to plinth/modules/diagnostics/__init__.py diff --git a/modules/diagnostics/diagnostics.py b/plinth/modules/diagnostics/diagnostics.py similarity index 95% rename from modules/diagnostics/diagnostics.py rename to plinth/modules/diagnostics/diagnostics.py index 32b66310c..295f0efd4 100644 --- a/modules/diagnostics/diagnostics.py +++ b/plinth/modules/diagnostics/diagnostics.py @@ -23,9 +23,9 @@ from django.contrib.auth.decorators import login_required from django.template.response import TemplateResponse from gettext import gettext as _ -import actions -import cfg -from errors import ActionError +from plinth import actions +from plinth import cfg +from plinth.errors import ActionError def init(): diff --git a/modules/diagnostics/templates/diagnostics.html b/plinth/modules/diagnostics/templates/diagnostics.html similarity index 100% rename from modules/diagnostics/templates/diagnostics.html rename to plinth/modules/diagnostics/templates/diagnostics.html diff --git a/modules/diagnostics/templates/diagnostics_test.html b/plinth/modules/diagnostics/templates/diagnostics_test.html similarity index 100% rename from modules/diagnostics/templates/diagnostics_test.html rename to plinth/modules/diagnostics/templates/diagnostics_test.html diff --git a/modules/diagnostics/urls.py b/plinth/modules/diagnostics/urls.py similarity index 95% rename from modules/diagnostics/urls.py rename to plinth/modules/diagnostics/urls.py index 4ed974f9b..c1797c716 100644 --- a/modules/diagnostics/urls.py +++ b/plinth/modules/diagnostics/urls.py @@ -23,7 +23,7 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.diagnostics.diagnostics', + 'plinth.modules.diagnostics.diagnostics', url(r'^sys/diagnostics/$', 'index', name='index'), url(r'^sys/diagnostics/test/$', 'test', name='test'), ) diff --git a/modules/enabled/apps b/plinth/modules/enabled/apps similarity index 100% rename from modules/enabled/apps rename to plinth/modules/enabled/apps diff --git a/modules/enabled/config b/plinth/modules/enabled/config similarity index 100% rename from modules/enabled/config rename to plinth/modules/enabled/config diff --git a/modules/enabled/diagnostics b/plinth/modules/enabled/diagnostics similarity index 100% rename from modules/enabled/diagnostics rename to plinth/modules/enabled/diagnostics diff --git a/modules/enabled/expert_mode b/plinth/modules/enabled/expert_mode similarity index 100% rename from modules/enabled/expert_mode rename to plinth/modules/enabled/expert_mode diff --git a/modules/enabled/firewall b/plinth/modules/enabled/firewall similarity index 100% rename from modules/enabled/firewall rename to plinth/modules/enabled/firewall diff --git a/modules/enabled/first_boot b/plinth/modules/enabled/first_boot similarity index 100% rename from modules/enabled/first_boot rename to plinth/modules/enabled/first_boot diff --git a/modules/enabled/help b/plinth/modules/enabled/help similarity index 100% rename from modules/enabled/help rename to plinth/modules/enabled/help diff --git a/modules/enabled/lib b/plinth/modules/enabled/lib similarity index 100% rename from modules/enabled/lib rename to plinth/modules/enabled/lib diff --git a/modules/enabled/owncloud b/plinth/modules/enabled/owncloud similarity index 100% rename from modules/enabled/owncloud rename to plinth/modules/enabled/owncloud diff --git a/modules/enabled/packages b/plinth/modules/enabled/packages similarity index 100% rename from modules/enabled/packages rename to plinth/modules/enabled/packages diff --git a/modules/enabled/pagekite b/plinth/modules/enabled/pagekite similarity index 100% rename from modules/enabled/pagekite rename to plinth/modules/enabled/pagekite diff --git a/modules/enabled/system b/plinth/modules/enabled/system similarity index 100% rename from modules/enabled/system rename to plinth/modules/enabled/system diff --git a/modules/enabled/tor b/plinth/modules/enabled/tor similarity index 100% rename from modules/enabled/tor rename to plinth/modules/enabled/tor diff --git a/modules/enabled/users b/plinth/modules/enabled/users similarity index 100% rename from modules/enabled/users rename to plinth/modules/enabled/users diff --git a/modules/enabled/xmpp b/plinth/modules/enabled/xmpp similarity index 100% rename from modules/enabled/xmpp rename to plinth/modules/enabled/xmpp diff --git a/modules/expert_mode/__init__.py b/plinth/modules/expert_mode/__init__.py similarity index 100% rename from modules/expert_mode/__init__.py rename to plinth/modules/expert_mode/__init__.py diff --git a/modules/expert_mode/expert_mode.py b/plinth/modules/expert_mode/expert_mode.py similarity index 96% rename from modules/expert_mode/expert_mode.py rename to plinth/modules/expert_mode/expert_mode.py index 3ec98bb76..b55992fa9 100644 --- a/modules/expert_mode/expert_mode.py +++ b/plinth/modules/expert_mode/expert_mode.py @@ -4,8 +4,8 @@ from django.contrib.auth.decorators import login_required from django.template.response import TemplateResponse from gettext import gettext as _ -import cfg -from ..lib.auth import get_group +from plinth import cfg +from plinth.modules.lib.auth import get_group class ExpertsForm(forms.Form): # pylint: disable-msg=W0232 diff --git a/modules/expert_mode/templates/expert_mode.html b/plinth/modules/expert_mode/templates/expert_mode.html similarity index 100% rename from modules/expert_mode/templates/expert_mode.html rename to plinth/modules/expert_mode/templates/expert_mode.html diff --git a/modules/expert_mode/urls.py b/plinth/modules/expert_mode/urls.py similarity index 95% rename from modules/expert_mode/urls.py rename to plinth/modules/expert_mode/urls.py index ffb97da53..038f8fc30 100644 --- a/modules/expert_mode/urls.py +++ b/plinth/modules/expert_mode/urls.py @@ -23,6 +23,6 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.expert_mode.expert_mode', + 'plinth.modules.expert_mode.expert_mode', url(r'^sys/expert/$', 'index', name='index'), ) diff --git a/modules/firewall/__init__.py b/plinth/modules/firewall/__init__.py similarity index 100% rename from modules/firewall/__init__.py rename to plinth/modules/firewall/__init__.py diff --git a/modules/firewall/firewall.py b/plinth/modules/firewall/firewall.py similarity index 98% rename from modules/firewall/firewall.py rename to plinth/modules/firewall/firewall.py index 760e980e6..5062488db 100644 --- a/modules/firewall/firewall.py +++ b/plinth/modules/firewall/firewall.py @@ -24,9 +24,9 @@ from django.template.response import TemplateResponse from gettext import gettext as _ import logging -import actions -import cfg -import service as service_module +from plinth import actions +from plinth import cfg +import plinth.service as service_module LOGGER = logging.getLogger(__name__) diff --git a/modules/firewall/templates/firewall.html b/plinth/modules/firewall/templates/firewall.html similarity index 100% rename from modules/firewall/templates/firewall.html rename to plinth/modules/firewall/templates/firewall.html diff --git a/modules/firewall/urls.py b/plinth/modules/firewall/urls.py similarity index 95% rename from modules/firewall/urls.py rename to plinth/modules/firewall/urls.py index be2f1494a..3d2da27b7 100644 --- a/modules/firewall/urls.py +++ b/plinth/modules/firewall/urls.py @@ -23,6 +23,6 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.firewall.firewall', + 'plinth.modules.firewall.firewall', url(r'^sys/firewall/$', 'index', name='index') ) diff --git a/modules/first_boot/__init__.py b/plinth/modules/first_boot/__init__.py similarity index 100% rename from modules/first_boot/__init__.py rename to plinth/modules/first_boot/__init__.py diff --git a/modules/first_boot/first_boot.py b/plinth/modules/first_boot/first_boot.py similarity index 98% rename from modules/first_boot/first_boot.py rename to plinth/modules/first_boot/first_boot.py index f784c507b..748e7ff4b 100644 --- a/modules/first_boot/first_boot.py +++ b/plinth/modules/first_boot/first_boot.py @@ -26,10 +26,10 @@ from django.http.response import HttpResponseRedirect from django.template.response import TemplateResponse from gettext import gettext as _ -from ..lib.auth import add_user -from ..config import config +from plinth import cfg +from plinth.modules.config import config +from plinth.modules.lib.auth import add_user from withsqlite.withsqlite import sqlite_db -import cfg ## TODO: flesh out these tests values diff --git a/modules/first_boot/middleware.py b/plinth/modules/first_boot/middleware.py similarity index 100% rename from modules/first_boot/middleware.py rename to plinth/modules/first_boot/middleware.py diff --git a/modules/first_boot/templates/firstboot_sidebar.html b/plinth/modules/first_boot/templates/firstboot_sidebar.html similarity index 100% rename from modules/first_boot/templates/firstboot_sidebar.html rename to plinth/modules/first_boot/templates/firstboot_sidebar.html diff --git a/modules/first_boot/templates/firstboot_state0.html b/plinth/modules/first_boot/templates/firstboot_state0.html similarity index 100% rename from modules/first_boot/templates/firstboot_state0.html rename to plinth/modules/first_boot/templates/firstboot_state0.html diff --git a/modules/first_boot/templates/firstboot_state1.html b/plinth/modules/first_boot/templates/firstboot_state1.html similarity index 100% rename from modules/first_boot/templates/firstboot_state1.html rename to plinth/modules/first_boot/templates/firstboot_state1.html diff --git a/modules/first_boot/urls.py b/plinth/modules/first_boot/urls.py similarity index 95% rename from modules/first_boot/urls.py rename to plinth/modules/first_boot/urls.py index 68669e6e9..d16290dba 100644 --- a/modules/first_boot/urls.py +++ b/plinth/modules/first_boot/urls.py @@ -23,7 +23,7 @@ from django.conf.urls import patterns, url 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/state0/$', 'state0', name='state0'), url(r'^firstboot/state1/$', 'state1', name='state1') diff --git a/modules/help/__init__.py b/plinth/modules/help/__init__.py similarity index 100% rename from modules/help/__init__.py rename to plinth/modules/help/__init__.py diff --git a/modules/help/help.py b/plinth/modules/help/help.py similarity index 98% rename from modules/help/help.py rename to plinth/modules/help/help.py index 0d73e6df2..b3245dc89 100644 --- a/modules/help/help.py +++ b/plinth/modules/help/help.py @@ -3,7 +3,7 @@ from gettext import gettext as _ from django.http import Http404 from django.template.response import TemplateResponse -import cfg +from plinth import cfg def init(): diff --git a/modules/help/templates/about.html b/plinth/modules/help/templates/about.html similarity index 100% rename from modules/help/templates/about.html rename to plinth/modules/help/templates/about.html diff --git a/modules/help/templates/help.html b/plinth/modules/help/templates/help.html similarity index 100% rename from modules/help/templates/help.html rename to plinth/modules/help/templates/help.html diff --git a/modules/help/urls.py b/plinth/modules/help/urls.py similarity index 97% rename from modules/help/urls.py rename to plinth/modules/help/urls.py index 38adfc807..c43c6f5f5 100644 --- a/modules/help/urls.py +++ b/plinth/modules/help/urls.py @@ -23,7 +23,7 @@ from django.conf.urls import patterns, url 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 # system highlight the correct menu item. Every submenu-item with the same # url prefix as the main-menu is highlighted automatically. diff --git a/modules/lib/__init__.py b/plinth/modules/lib/__init__.py similarity index 100% rename from modules/lib/__init__.py rename to plinth/modules/lib/__init__.py diff --git a/modules/lib/auth.py b/plinth/modules/lib/auth.py similarity index 100% rename from modules/lib/auth.py rename to plinth/modules/lib/auth.py diff --git a/modules/lib/urls.py b/plinth/modules/lib/urls.py similarity index 100% rename from modules/lib/urls.py rename to plinth/modules/lib/urls.py diff --git a/modules/owncloud/__init__.py b/plinth/modules/owncloud/__init__.py similarity index 100% rename from modules/owncloud/__init__.py rename to plinth/modules/owncloud/__init__.py diff --git a/modules/owncloud/owncloud.py b/plinth/modules/owncloud/owncloud.py similarity index 96% rename from modules/owncloud/owncloud.py rename to plinth/modules/owncloud/owncloud.py index 2949d5f89..217ac3221 100644 --- a/modules/owncloud/owncloud.py +++ b/plinth/modules/owncloud/owncloud.py @@ -4,9 +4,9 @@ from django.contrib.auth.decorators import login_required from django.template.response import TemplateResponse from gettext import gettext as _ -import actions -import cfg -import service +from plinth import actions +from plinth import cfg +from plinth import service SERVICE = None diff --git a/modules/owncloud/templates/owncloud.html b/plinth/modules/owncloud/templates/owncloud.html similarity index 100% rename from modules/owncloud/templates/owncloud.html rename to plinth/modules/owncloud/templates/owncloud.html diff --git a/modules/owncloud/urls.py b/plinth/modules/owncloud/urls.py similarity index 95% rename from modules/owncloud/urls.py rename to plinth/modules/owncloud/urls.py index faa23d43b..8882159ea 100644 --- a/modules/owncloud/urls.py +++ b/plinth/modules/owncloud/urls.py @@ -23,6 +23,6 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.owncloud.owncloud', + 'plinth.modules.owncloud.owncloud', url(r'^apps/owncloud/$', 'index', name='index'), ) diff --git a/modules/packages/__init__.py b/plinth/modules/packages/__init__.py similarity index 100% rename from modules/packages/__init__.py rename to plinth/modules/packages/__init__.py diff --git a/modules/packages/packages.py b/plinth/modules/packages/packages.py similarity index 98% rename from modules/packages/packages.py rename to plinth/modules/packages/packages.py index ee4c52717..8fe4cf6dc 100644 --- a/modules/packages/packages.py +++ b/plinth/modules/packages/packages.py @@ -4,8 +4,8 @@ from django.contrib.auth.decorators import login_required from django.template.response import TemplateResponse from gettext import gettext as _ -import actions -import cfg +from plinth import actions +from plinth import cfg def get_modules_available(): diff --git a/modules/packages/templates/packages.html b/plinth/modules/packages/templates/packages.html similarity index 100% rename from modules/packages/templates/packages.html rename to plinth/modules/packages/templates/packages.html diff --git a/modules/packages/urls.py b/plinth/modules/packages/urls.py similarity index 89% rename from modules/packages/urls.py rename to plinth/modules/packages/urls.py index 60faf35bf..6eaf99b04 100644 --- a/modules/packages/urls.py +++ b/plinth/modules/packages/urls.py @@ -23,6 +23,6 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.packages.packages', - url(r'^sys/packages/$', 'index', name='index'), - ) + 'plinth.modules.packages.packages', + url(r'^sys/packages/$', 'index', name='index') +) diff --git a/modules/pagekite/__init__.py b/plinth/modules/pagekite/__init__.py similarity index 100% rename from modules/pagekite/__init__.py rename to plinth/modules/pagekite/__init__.py diff --git a/modules/pagekite/pagekite.py b/plinth/modules/pagekite/pagekite.py similarity index 99% rename from modules/pagekite/pagekite.py rename to plinth/modules/pagekite/pagekite.py index f6e90ced0..7e49ee029 100644 --- a/modules/pagekite/pagekite.py +++ b/plinth/modules/pagekite/pagekite.py @@ -30,8 +30,8 @@ from django.template.response import TemplateResponse from gettext import gettext as _ import logging -import actions -import cfg +from plinth import actions +from plinth import cfg LOGGER = logging.getLogger(__name__) diff --git a/modules/pagekite/templates/pagekite_configure.html b/plinth/modules/pagekite/templates/pagekite_configure.html similarity index 100% rename from modules/pagekite/templates/pagekite_configure.html rename to plinth/modules/pagekite/templates/pagekite_configure.html diff --git a/modules/pagekite/templates/pagekite_introduction.html b/plinth/modules/pagekite/templates/pagekite_introduction.html similarity index 100% rename from modules/pagekite/templates/pagekite_introduction.html rename to plinth/modules/pagekite/templates/pagekite_introduction.html diff --git a/modules/pagekite/urls.py b/plinth/modules/pagekite/urls.py similarity index 95% rename from modules/pagekite/urls.py rename to plinth/modules/pagekite/urls.py index 3db1d2f98..7fa6c9918 100644 --- a/modules/pagekite/urls.py +++ b/plinth/modules/pagekite/urls.py @@ -23,7 +23,7 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.pagekite.pagekite', + 'plinth.modules.pagekite.pagekite', url(r'^apps/pagekite/$', 'index', name='index'), url(r'^apps/pagekite/configure/$', 'configure', name='configure'), ) diff --git a/modules/santiago/__init__.py b/plinth/modules/santiago/__init__.py similarity index 100% rename from modules/santiago/__init__.py rename to plinth/modules/santiago/__init__.py diff --git a/modules/santiago/santiago.py b/plinth/modules/santiago/santiago.py similarity index 100% rename from modules/santiago/santiago.py rename to plinth/modules/santiago/santiago.py diff --git a/modules/system/__init__.py b/plinth/modules/system/__init__.py similarity index 100% rename from modules/system/__init__.py rename to plinth/modules/system/__init__.py diff --git a/modules/system/system.py b/plinth/modules/system/system.py similarity index 94% rename from modules/system/system.py rename to plinth/modules/system/system.py index 961461983..24cad9fa7 100644 --- a/modules/system/system.py +++ b/plinth/modules/system/system.py @@ -1,7 +1,7 @@ from gettext import gettext as _ from django.template.response import TemplateResponse -import cfg +from plinth import cfg def init(): diff --git a/modules/system/templates/system.html b/plinth/modules/system/templates/system.html similarity index 100% rename from modules/system/templates/system.html rename to plinth/modules/system/templates/system.html diff --git a/modules/system/urls.py b/plinth/modules/system/urls.py similarity index 96% rename from modules/system/urls.py rename to plinth/modules/system/urls.py index 5982ce850..179556675 100644 --- a/modules/system/urls.py +++ b/plinth/modules/system/urls.py @@ -23,6 +23,6 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.system.system', + 'plinth.modules.system.system', url(r'^sys/$', 'index', name='index'), ) diff --git a/modules/tor/__init__.py b/plinth/modules/tor/__init__.py similarity index 100% rename from modules/tor/__init__.py rename to plinth/modules/tor/__init__.py diff --git a/modules/tor/templates/tor.html b/plinth/modules/tor/templates/tor.html similarity index 100% rename from modules/tor/templates/tor.html rename to plinth/modules/tor/templates/tor.html diff --git a/modules/tor/tor.py b/plinth/modules/tor/tor.py similarity index 96% rename from modules/tor/tor.py rename to plinth/modules/tor/tor.py index 335250983..37ffd76cf 100644 --- a/modules/tor/tor.py +++ b/plinth/modules/tor/tor.py @@ -23,8 +23,8 @@ from django.contrib.auth.decorators import login_required from django.template.response import TemplateResponse from gettext import gettext as _ -import actions -import cfg +from plinth import actions +from plinth import cfg def init(): diff --git a/modules/tor/urls.py b/plinth/modules/tor/urls.py similarity index 96% rename from modules/tor/urls.py rename to plinth/modules/tor/urls.py index 4c13cb138..7962614f4 100644 --- a/modules/tor/urls.py +++ b/plinth/modules/tor/urls.py @@ -23,6 +23,6 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.tor.tor', + 'plinth.modules.tor.tor', url(r'^apps/tor/$', 'index', name='index') ) diff --git a/modules/users/__init__.py b/plinth/modules/users/__init__.py similarity index 100% rename from modules/users/__init__.py rename to plinth/modules/users/__init__.py diff --git a/modules/users/templates/users_add.html b/plinth/modules/users/templates/users_add.html similarity index 100% rename from modules/users/templates/users_add.html rename to plinth/modules/users/templates/users_add.html diff --git a/modules/users/templates/users_edit.html b/plinth/modules/users/templates/users_edit.html similarity index 100% rename from modules/users/templates/users_edit.html rename to plinth/modules/users/templates/users_edit.html diff --git a/modules/users/urls.py b/plinth/modules/users/urls.py similarity index 96% rename from modules/users/urls.py rename to plinth/modules/users/urls.py index 0c46aa72e..0308837ec 100644 --- a/modules/users/urls.py +++ b/plinth/modules/users/urls.py @@ -23,8 +23,8 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.users.users', + 'plinth.modules.users.users', url(r'^sys/users/$', 'index', name='index'), url(r'^sys/users/add/$', 'add', name='add'), url(r'^sys/users/edit/$', 'edit', name='edit') - ) +) diff --git a/modules/users/users.py b/plinth/modules/users/users.py similarity index 98% rename from modules/users/users.py rename to plinth/modules/users/users.py index 5197b28ba..aef303970 100644 --- a/modules/users/users.py +++ b/plinth/modules/users/users.py @@ -10,8 +10,8 @@ from django.template.response import TemplateResponse from gettext import gettext as _ import logging -import cfg -from ..lib.auth import add_user +from plinth import cfg +from plinth.modules.lib.auth import add_user LOGGER = logging.getLogger(__name__) diff --git a/modules/xmpp/__init__.py b/plinth/modules/xmpp/__init__.py similarity index 100% rename from modules/xmpp/__init__.py rename to plinth/modules/xmpp/__init__.py diff --git a/modules/xmpp/templates/xmpp_configure.html b/plinth/modules/xmpp/templates/xmpp_configure.html similarity index 100% rename from modules/xmpp/templates/xmpp_configure.html rename to plinth/modules/xmpp/templates/xmpp_configure.html diff --git a/modules/xmpp/templates/xmpp_register.html b/plinth/modules/xmpp/templates/xmpp_register.html similarity index 100% rename from modules/xmpp/templates/xmpp_register.html rename to plinth/modules/xmpp/templates/xmpp_register.html diff --git a/modules/xmpp/urls.py b/plinth/modules/xmpp/urls.py similarity index 96% rename from modules/xmpp/urls.py rename to plinth/modules/xmpp/urls.py index 050026d81..ee7a651dd 100644 --- a/modules/xmpp/urls.py +++ b/plinth/modules/xmpp/urls.py @@ -23,8 +23,8 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'modules.xmpp.xmpp', + 'plinth.modules.xmpp.xmpp', url(r'^apps/xmpp/$', 'index', name='index'), url(r'^apps/xmpp/configure/$', 'configure', name='configure'), url(r'^apps/xmpp/register/$', 'register', name='register') - ) +) diff --git a/modules/xmpp/xmpp.py b/plinth/modules/xmpp/xmpp.py similarity index 98% rename from modules/xmpp/xmpp.py rename to plinth/modules/xmpp/xmpp.py index fb09eef94..ae7ef1afb 100644 --- a/modules/xmpp/xmpp.py +++ b/plinth/modules/xmpp/xmpp.py @@ -8,9 +8,9 @@ from django.template.response import TemplateResponse from gettext import gettext as _ import logging -import actions -import cfg -import service +from plinth import actions +from plinth import cfg +from plinth import service LOGGER = logging.getLogger(__name__) diff --git a/service.py b/plinth/service.py similarity index 100% rename from service.py rename to plinth/service.py diff --git a/templates/404.html b/plinth/templates/404.html similarity index 100% rename from templates/404.html rename to plinth/templates/404.html diff --git a/templates/500.html b/plinth/templates/500.html similarity index 100% rename from templates/500.html rename to plinth/templates/500.html diff --git a/templates/base.html b/plinth/templates/base.html similarity index 100% rename from templates/base.html rename to plinth/templates/base.html diff --git a/templates/form.html b/plinth/templates/form.html similarity index 100% rename from templates/form.html rename to plinth/templates/form.html diff --git a/templates/login.html b/plinth/templates/login.html similarity index 100% rename from templates/login.html rename to plinth/templates/login.html diff --git a/templates/menu.html b/plinth/templates/menu.html similarity index 100% rename from templates/menu.html rename to plinth/templates/menu.html diff --git a/templates/menu_block.html b/plinth/templates/menu_block.html similarity index 100% rename from templates/menu_block.html rename to plinth/templates/menu_block.html diff --git a/templates/messages.html b/plinth/templates/messages.html similarity index 100% rename from templates/messages.html rename to plinth/templates/messages.html diff --git a/plinth/tests/__init__.py b/plinth/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/actions_test.py b/plinth/tests/actions_test.py similarity index 100% rename from tests/actions_test.py rename to plinth/tests/actions_test.py diff --git a/tests/testdata/users.sqlite3 b/plinth/tests/testdata/users.sqlite3 similarity index 100% rename from tests/testdata/users.sqlite3 rename to plinth/tests/testdata/users.sqlite3 diff --git a/urls.py b/plinth/urls.py similarity index 97% rename from urls.py rename to plinth/urls.py index 73837133b..5ab1c866e 100644 --- a/urls.py +++ b/plinth/urls.py @@ -23,6 +23,6 @@ from django.conf.urls import patterns, url urlpatterns = patterns( # pylint: disable-msg=C0103 - 'views', + 'plinth.views', url(r'^$', 'index', name='index') - ) +) diff --git a/util.py b/plinth/util.py similarity index 100% rename from util.py rename to plinth/util.py diff --git a/views.py b/plinth/views.py similarity index 100% rename from views.py rename to plinth/views.py