Example #1
0
    def render_content(self, ctx, data):
        """ Function is deffered to make less blocking on system calls"""

        if not self.avatarId.isAdmin:
            return ctx.tag[""]

        # Fetch running profile
        thisProfile = Utils.currentProfile()

        runningProfile = Utils.runningProfile()[0]

        if thisProfile[0] != runningProfile:
            thisProfile = [
                thisProfile[0], " [",
                tags.a(href=url.root.child("Profiles").child("switch").child(
                    thisProfile[1]))["Activate"]
            ], "]"
        else:
            thisProfile = thisProfile[0]

        return ctx.tag[tags.table(
            width="100%",
            cellspacing="10")[tags.tr[tags.td(colspan=2)[tags.div(
                id="ProfileBlock")[tags.div(_class="roundedBlock")[
                    tags.h1["Profile"],
                    tags.div(id="123")["Current profile: ", thisProfile,
                                       tags.br, "Running profile: ",
                                       runningProfile, tags.br,
                                       tags.directive('form selectProfile'),
                                       tags.a(href=url.root.child("Profiles")
                                              )["Manage Profiles"]]], ], ]],
                              tags.tr[tags.invisible(
                                  render=tags.directive('thisFragment'))]]]
Example #2
0
        def ret(_):
                if Utils.runningProfile()[1] == source:
                    run = open(Settings.BaseDir + '/runningProfile', 'wt')
                    run.write(dest)
                    run.close()
                if Utils.currentProfile()[1] == source:
                    cur = open(Settings.BaseDir + '/currentProfile', 'wt')
                    cur.write(dest)
                    cur.close()

                return url.root.child('Profiles')
Example #3
0
    def data_profiles(self, ctx, data):
        # Fetch running profile
        thisProfile = Utils.currentProfile()

        runningProfile = Utils.runningProfile()[0]

        if thisProfile[0] != runningProfile:
            thisProfile = [
                thisProfile[0], " [",
                tags.a(href=url.root.child("Profiles").child("switch").child(
                    thisProfile[1]))["Activate"]
            ], "]"
        else:
            thisProfile = thisProfile[0]

        print thisProfile

        return {
            'current': thisProfile,
            'running': runningProfile,
        }