mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
Use new-style classes everywhere
This commit is contained in:
1 parent
a958798769
commit
ef493ae243
25 files changed
+117
-86
No files matched your search
@@ -6,8 +6,9 @@ import util
|
||||
|
||||
|
||||
class Apps(PagePlugin):
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
def __init__(self):
|
||||
super(Apps, self).__init__()
|
||||
|
||||
self.register_page("apps")
|
||||
self.menu = cfg.main_menu.add_item("Apps", "icon-download-alt", "/apps", 80)
|
||||
self.menu.add_item("Chat", "icon-comment", "/../jwchat", 30)
|
||||
|
||||
@@ -91,9 +91,8 @@ and must not be greater than 63 characters in length.'),
|
||||
|
||||
class Configuration(PagePlugin):
|
||||
"""System configuration page"""
|
||||
def __init__(self, *args, **kwargs):
|
||||
del args # Unused
|
||||
del kwargs # Unused
|
||||
def __init__(self):
|
||||
super(Configuration, self).__init__()
|
||||
|
||||
self.register_page('sys.config')
|
||||
|
||||
|
||||
@@ -28,10 +28,11 @@ import cfg
|
||||
import util
|
||||
|
||||
|
||||
class diagnostics(PagePlugin):
|
||||
class Diagnostics(PagePlugin):
|
||||
order = 30
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
def __init__(self):
|
||||
super(Diagnostics, self).__init__()
|
||||
|
||||
self.register_page("sys.diagnostics")
|
||||
cfg.html_root.sys.menu.add_item("Diagnostics", "icon-screenshot", "/sys/diagnostics", 30)
|
||||
|
||||
@@ -41,10 +42,11 @@ class diagnostics(PagePlugin):
|
||||
return util.render_template(template='diagnostics',
|
||||
title=_('System Diagnostics'))
|
||||
|
||||
class test(PagePlugin):
|
||||
class Test(PagePlugin):
|
||||
order = 31
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
def __init__(self):
|
||||
super(Test, self).__init__()
|
||||
|
||||
self.register_page("sys.diagnostics.test")
|
||||
|
||||
@cherrypy.expose
|
||||
|
||||
@@ -22,8 +22,9 @@ class Experts(PagePlugin):
|
||||
"""Expert forms page"""
|
||||
order = 60
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
def __init__(self):
|
||||
super(Experts, self).__init__()
|
||||
|
||||
self.register_page('sys.expert')
|
||||
|
||||
cfg.html_root.sys.menu.add_item(_('Expert Mode'), 'icon-cog',
|
||||
|
||||
@@ -34,8 +34,8 @@ class Firewall(PagePlugin):
|
||||
"""Firewall menu entry and introduction page"""
|
||||
order = 40
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
def __init__(self):
|
||||
super(Firewall, self).__init__()
|
||||
|
||||
self.register_page('sys.firewall')
|
||||
cfg.html_root.sys.menu.add_item(_('Firewall'), 'icon-flag',
|
||||
|
||||
@@ -69,8 +69,8 @@ FreedomBox!'))
|
||||
class FirstBoot(PagePlugin):
|
||||
"""First boot wizard"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
def __init__(self):
|
||||
super(FirstBoot, self).__init__()
|
||||
|
||||
# this is the url this page will hang off of (/firstboot)
|
||||
self.register_page('firstboot')
|
||||
|
||||
@@ -8,15 +8,17 @@ import util
|
||||
|
||||
class Help(PagePlugin):
|
||||
order = 20 # order of running init in PagePlugins
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
|
||||
def __init__(self):
|
||||
super(Help, self).__init__()
|
||||
|
||||
self.register_page("help")
|
||||
self.menu = cfg.main_menu.add_item(_("Documentation"), "icon-book", "/help", 101)
|
||||
self.menu.add_item(_("Where to Get Help"), "icon-search", "/help/index", 5)
|
||||
self.menu.add_item(_("Developer's Manual"), "icon-info-sign", "/help/view/plinth", 10)
|
||||
self.menu.add_item(_("FAQ"), "icon-question-sign", "/help/view/faq", 20)
|
||||
self.menu.add_item(_("%s Wiki" % cfg.box_name), "icon-pencil", "http://wiki.debian.org/FreedomBox", 30)
|
||||
self.menu.add_item(_("About"), "icon-star", "/help/about", 100)
|
||||
self.menu.add_item(_("About"), "icon-star", "/help/about", 100)
|
||||
|
||||
@cherrypy.expose
|
||||
def index(self):
|
||||
@@ -31,8 +33,9 @@ class Help(PagePlugin):
|
||||
|
||||
|
||||
class View(PagePlugin):
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
def __init__(self):
|
||||
super(View, self).__init__()
|
||||
|
||||
self.register_page("help.view")
|
||||
|
||||
@cherrypy.expose
|
||||
|
||||
@@ -36,8 +36,8 @@ class LoginForm(forms.Form): # pylint: disable-msg=W0232
|
||||
class AuthController(PagePlugin):
|
||||
"""Login and logout pages"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
def __init__(self):
|
||||
super(AuthController, self).__init__()
|
||||
|
||||
self.register_page('auth')
|
||||
|
||||
|
||||
@@ -4,8 +4,11 @@ from model import User
|
||||
from plugin_mount import UserStoreModule
|
||||
from withsqlite.withsqlite import sqlite_db
|
||||
|
||||
|
||||
class UserStore(UserStoreModule, sqlite_db):
|
||||
def __init__(self):
|
||||
super(UserStore, self).__init__()
|
||||
|
||||
self.db_file = cfg.user_db
|
||||
sqlite_db.__init__(self, self.db_file, autocommit=True, check_same_thread=False)
|
||||
self.__enter__()
|
||||
|
||||
@@ -22,8 +22,9 @@ class OwnCloud(PagePlugin):
|
||||
"""ownCloud configuration page"""
|
||||
order = 90
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
def __init__(self):
|
||||
super(OwnCloud, self).__init__()
|
||||
|
||||
self.register_page('apps.owncloud')
|
||||
|
||||
cfg.html_root.apps.menu.add_item('Owncloud', 'icon-picture',
|
||||
|
||||
@@ -48,8 +48,9 @@ class Packages(PagePlugin):
|
||||
"""Package page"""
|
||||
order = 20
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
def __init__(self):
|
||||
super(Packages, self).__init__()
|
||||
|
||||
self.register_page('sys.packages')
|
||||
|
||||
cfg.html_root.sys.menu.add_item('Package Manager', 'icon-gift',
|
||||
|
||||
@@ -35,8 +35,8 @@ class PageKite(PagePlugin):
|
||||
"""PageKite menu entry and introduction page"""
|
||||
order = 60
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
def __init__(self):
|
||||
super(PageKite, self).__init__()
|
||||
|
||||
self.register_page("apps.pagekite")
|
||||
cfg.html_root.apps.menu.add_item(
|
||||
@@ -109,8 +109,8 @@ class Configure(PagePlugin): # pylint: disable-msg=C0103
|
||||
"""Main configuration form"""
|
||||
order = 65
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
def __init__(self):
|
||||
super(Configure, self).__init__()
|
||||
|
||||
self.register_page("apps.pagekite.configure")
|
||||
|
||||
|
||||
@@ -23,14 +23,15 @@ santiago_port = 52854
|
||||
# return True
|
||||
|
||||
class Santiago(PagePlugin):
|
||||
order = 90 # order of running init in PagePlugins
|
||||
def __init__(self, *args, **kwargs):
|
||||
order = 90 # order of running init in PagePlugins
|
||||
def __init__(self):
|
||||
super(Santiago, self).__init__()
|
||||
|
||||
self.register_page("santiago")
|
||||
self.santiago_address = self.get_santiago_address() #TODO: multiple santiago ports
|
||||
#set a listener on the santiago address
|
||||
|
||||
def get_santiago_address(self):
|
||||
def get_santiago_address(self):
|
||||
if 'santiago' in cfg.users['admin'] and 'address' in cfg.users['admin']['santiago']:
|
||||
return cfg.users['admin']['santiago']['address']
|
||||
else:
|
||||
@@ -54,11 +55,11 @@ class Santiago(PagePlugin):
|
||||
print "Need to add these two lines to /etc/torrc:\n%s" % hidden_service_config
|
||||
return ""
|
||||
|
||||
def check_for_hidden_service(self):
|
||||
def check_for_hidden_service(self):
|
||||
pass
|
||||
|
||||
@cherrypy.expose
|
||||
def index(self, *args, **kw):
|
||||
@cherrypy.expose
|
||||
def index(self, *args, **kw):
|
||||
|
||||
"""
|
||||
A request is a dict with some required keys:
|
||||
@@ -111,12 +112,13 @@ class Santiago(PagePlugin):
|
||||
|
||||
## Plinth page to config santiago
|
||||
class santiago(PagePlugin):
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
self.menu = cfg.html_root.privacy.menu.add_item("Santiago", "icon-leaf", "/privacy/santiago", 10)
|
||||
self.register_page("privacy.santiago")
|
||||
def __init__(self):
|
||||
super(Santiago, self).__init__(self)
|
||||
|
||||
@cherrypy.expose
|
||||
@require()
|
||||
def index(self):
|
||||
return "Santiago's config goes here."
|
||||
self.menu = cfg.html_root.privacy.menu.add_item("Santiago", "icon-leaf", "/privacy/santiago", 10)
|
||||
self.register_page("privacy.santiago")
|
||||
|
||||
@cherrypy.expose
|
||||
@require()
|
||||
def index(self):
|
||||
return "Santiago's config goes here."
|
||||
@@ -4,16 +4,16 @@ from plugin_mount import PagePlugin
|
||||
import cfg
|
||||
import util
|
||||
|
||||
sys_dir = "modules/installed/sys"
|
||||
|
||||
|
||||
class Sys(PagePlugin):
|
||||
order = 10
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
|
||||
def __init__(self):
|
||||
super(Sys, self).__init__()
|
||||
|
||||
self.register_page("sys")
|
||||
self.menu = cfg.main_menu.add_item(_("System"), "icon-cog", "/sys", 100)
|
||||
self.menu.add_item(_("Users and Groups"), "icon-user", "/sys/users", 15)
|
||||
self.menu.add_item(_("Users and Groups"), "icon-user", "/sys/users", 15)
|
||||
|
||||
@cherrypy.expose
|
||||
def index(self):
|
||||
|
||||
+5
-3
@@ -28,10 +28,12 @@ import cfg
|
||||
import util
|
||||
|
||||
|
||||
class tor(PagePlugin):
|
||||
class Tor(PagePlugin):
|
||||
order = 60 # order of running init in PagePlugins
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
|
||||
def __init__(self):
|
||||
super(Tor, self).__init__()
|
||||
|
||||
self.register_page("apps.tor")
|
||||
cfg.html_root.apps.menu.add_item("Tor", "icon-eye-close", "/apps/tor",
|
||||
30)
|
||||
|
||||
@@ -11,8 +11,10 @@ import util
|
||||
|
||||
class Users(PagePlugin):
|
||||
order = 20 # order of running init in PagePlugins
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
|
||||
def __init__(self):
|
||||
super(Users, self).__init__()
|
||||
|
||||
self.register_page("sys.users")
|
||||
|
||||
@staticmethod
|
||||
@@ -52,8 +54,8 @@ class UserAdd(PagePlugin):
|
||||
"""Add user page"""
|
||||
order = 30
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
def __init__(self):
|
||||
super(UserAdd, self).__init__()
|
||||
|
||||
self.register_page('sys.users.add')
|
||||
|
||||
@@ -112,8 +114,8 @@ class UserEdit(PagePlugin):
|
||||
"""User edit page"""
|
||||
order = 35
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
def __init__(self):
|
||||
super(UserEdit, self).__init__()
|
||||
|
||||
self.register_page('sys.users.edit')
|
||||
|
||||
|
||||
+11
-8
@@ -20,11 +20,12 @@ class XMPP(PagePlugin):
|
||||
"""XMPP Page"""
|
||||
order = 60
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
def __init__(self):
|
||||
super(XMPP, self).__init__()
|
||||
|
||||
self.register_page('apps.xmpp')
|
||||
cfg.html_root.apps.menu.add_item('XMPP', 'icon-comment',
|
||||
'/apps/xmpp', 40)
|
||||
'/apps/xmpp', 40)
|
||||
|
||||
self.client_service = service.Service(
|
||||
'xmpp-client', _('Chat Server - client connections'),
|
||||
@@ -66,9 +67,10 @@ class Configure(PagePlugin):
|
||||
"""Configuration page"""
|
||||
order = 65
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
self.register_page("apps.xmpp.configure")
|
||||
def __init__(self):
|
||||
super(Configure, self).__init__()
|
||||
|
||||
self.register_page('apps.xmpp.configure')
|
||||
|
||||
@cherrypy.expose
|
||||
@require()
|
||||
@@ -148,8 +150,9 @@ class Register(PagePlugin):
|
||||
"""User registration page"""
|
||||
order = 65
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
PagePlugin.__init__(self, *args, **kwargs)
|
||||
def __init__(self):
|
||||
super(Register, self).__init__()
|
||||
|
||||
self.register_page('apps.xmpp.register')
|
||||
|
||||
@cherrypy.expose
|
||||
|
||||
Reference in new issue
Block a user