Merged async actions.

This commit is contained in:
Nick Daly committed 2013-11-24 18:46:16 -06:00
commit e23650232b
5 files changed
+70 -57

No files matched your search

+2 -2
View File
@@ -3,6 +3,7 @@ from gettext import gettext as _
from modules.auth import require
from plugin_mount import PagePlugin
from forms import Form
from actions import superuser_run
import cfg
class Apps(PagePlugin):
@@ -16,7 +17,7 @@ class Apps(PagePlugin):
def index(self):
main = """
<p>User Applications are web apps hosted on your %s.</p>
<p>Eventually this box could be your photo sharing site, your
instant messaging site, your social networking site, your news
site. Remember web portals? We can be one of those too.
@@ -35,4 +36,3 @@ investment in the sentimental value of your family snaps? Keep those
photos local, backed up, easily accessed and free from the whims of
some other websites business model.</p>
""")
+4 -4
View File
@@ -4,7 +4,7 @@ from modules.auth import require
from plugin_mount import PagePlugin, FormPlugin
import cfg
from forms import Form
from privilegedactions import privilegedaction_run
from actions import superuser_run
from util import Message
class xmpp(PagePlugin):
@@ -30,7 +30,7 @@ class configure(FormPlugin, PagePlugin):
sidebar_right = _("<strong>Configure XMPP Server</strong>")
def main(self, xmpp_inband_enable=False, message=None, *args, **kwargs):
output, error = privilegedaction_run("xmpp-setup", 'status')
output, error = superuser_run("xmpp-setup", 'status')
if error:
raise Exception("something is wrong: " + error)
if "inband_enable" in output.split():
@@ -40,7 +40,7 @@ class configure(FormPlugin, PagePlugin):
action=cfg.server_dir + "/services/xmpp/configure/index",
name="configure_xmpp_form",
message=message)
form.checkbox(_("Allow In-Band Registration"), name="xmpp_inband_enable",
form.checkbox(_("Allow In-Band Registration"), name="xmpp_inband_enable",
id="xmpp_inband_enable", checked=xmpp_inband_enable)
# hidden field is needed because checkbox doesn't post if not checked
form.hidden(name="submitted", value="True")
@@ -92,7 +92,7 @@ class register(FormPlugin, PagePlugin):
if not password: msg.add = _("Must specify a password!")
if username and password:
output, error = privilegedaction_run("xmpp-register", [username, password])
output, error = superuser_run("xmpp-register", [username, password])
if error:
raise Exception("something is wrong: " + error)
+3 -3
View File
@@ -9,7 +9,7 @@ from gettext import gettext as _
from filedict import FileDict
from modules.auth import require
from plugin_mount import PagePlugin, FormPlugin
from privilegedactions import privilegedaction_run
from actions import superuser_run
import cfg
from forms import Form
from model import User
@@ -55,7 +55,7 @@ def set_hostname(hostname):
cfg.log.info("Changing hostname to '%s'" % hostname)
try:
privilegedaction_run("hostname-change", hostname)
superuser_run("hostname-change", hostname)
# don't persist/cache change unless it was saved successfuly
sys_store = filedict_con(cfg.store_file, 'sys')
sys_store['hostname'] = hostname
@@ -141,7 +141,7 @@ class general(FormPlugin, PagePlugin):
time_zone = time_zone.strip()
if time_zone != sys_store['time_zone']:
cfg.log.info("Setting timezone to %s" % time_zone)
privilegedaction_run("timezone-change", [time_zone])
superuser_run("timezone-change", [time_zone])
sys_store['time_zone'] = time_zone
return message or "Settings updated."