def _sqlChanges(self): from Phoenix.Models import Privilege, Repository, Role Member.createTable(ifNotExists=True) Role.createTable(ifNotExists=True) Repository.createTable(ifNotExists=True) Privilege.createTable(ifNotExists=True) Hook.createTable(ifNotExists=True) Key.createTable(ifNotExists=True)
def removehook(self): logging.info("Defining hook id ...") id = self.args.hook_id logging.info("Checking if hook exists ...") hook = Hook.get(id) if not hook: raise Exception("The hook with the id `%s' does not exist." % id) logging.info("Removing the hook from the database ...") hook.destroySelf() print "Done."
def hook(cls, id): from Phoenix.Models import Hook if Hook.get(id): return True return False
def getHooksByName(self, name): from Phoenix.Models import Hook return Hook.selectBy(repository=self, hook=name)
def addHook(self, hook, command): from Phoenix.Models import Hook hook = Hook(repository=self, hook=hook, command=command) return hook