Beispiel #1
0
def pluginRegistered(plugname,username):
    w = sh.wrap('config')
    e =  w.exists("""
select * from plugin, user 
where user.name = :username 
and plugin.name = :plugname
and plugin.user = user.id;""",
                  params = {'plugname':plugname, 'username':username})
    w.close()
    return e
Beispiel #2
0
def register(plugname,username):
    if pluginRegistered(plugname,username):
        raise Exception("Plugin, "+plugname+" already registered for "+username)
    else:
        w = sh.wrap('config')
        uid = sh.userID(username)
        w.query("""
INSERT INTO plugin(name, user)
values(:plugname,:uid);
""",
                params = {'plugname':plugname,'uid':uid})
        w.commit()
        w.close()
Beispiel #3
0
def unregister(plugname, username):
    if not pluginRegistered(plugname,username):
        raise Exception("Plugin, "+plugname+" not registered for "+username)
    else:
        w = sh.wrap('config')
        uid = sh.userID(username)
        w.query("""
DELETE FROM plugin
WHERE name = :plugname
AND user = :uid;
""",
                params = {'plugname':plugname,'uid':uid})
        w.commit()
        w.close()
Beispiel #4
0
    def index(self):
        # Return a rendered template
        # return render('/plug.mako')
        # or, return a responsels t

        w = sh.wrap("config")
        d = w.queryToDict(
            "select plugin.name  as name, user.name as uname from plugin, user where user.id = plugin.user;"
        )

        print d

        c.pluglist = map(lambda x: str(x["name"]), d)
        c.plugnames = map(lambda x: str(x["uname"]), d)
        c.cname = "plug"
        c.cdesc = "Plugin html interface"
        c.methods = [{"n": "blank", "d": "none yet"}]
        jsfiles = ["jquery"]
        rendered0 = sh.sourced_js(jsfiles, True)
        rendered = rendered0 + render("/plug_list.mako")
        rendered = rendered + render("/describe_controller.mako")

        return rendered