Ejemplo n.º 1
0
    def process_user_herd(self, herd, *args, **kwargs):
        """Process add user herd request."""

        username = accounts.get_logged_username()
        h = Users.select(Users.q.user == username)
        if h[0]:
            h[0].set(herdsUser=h[0].herdsUser + " " + herd)
        else:
            h[0].set(herdsUser=herd)
        utils.set_herd_session()

        content = "<b>Success!</b><br><br>Go <a href='/'>home</a>"
        yield self.plain_page(content)
Ejemplo n.º 2
0
    def process_user_herd(self, herd, *args, **kwargs):
        """Process add user herd request."""
        
        username = accounts.get_logged_username()
        h = Users.select(Users.q.user == username)
        if h[0]:
            h[0].set(herdsUser = h[0].herdsUser + " " + herd)
        else:
            h[0].set(herdsUser = herd)
        utils.set_herd_session()

        content = "<b>Success!</b><br><br>Go <a href='/'>home</a>"
        yield self.plain_page(content)
Ejemplo n.º 3
0
    def del_user_herd(self, herd):
        """Delete user's herd"""
        username = accounts.get_logged_username()
        u = Users.select(Users.q.user == username)
        if herd in u[0].herdsAuto:
            yield self.error_form('''You are a member of that herd,
                                     which means you cannot delete it from your
                                     Meatoo preferences. Sorry.''')
            return
        elif herd in u[0].herdsUser:
            s = u[0].herdsUser.split()
            s.remove(herd)
            if s:
                u[0].set(herdsUser="******".join(s))
            else:
                u[0].set(herdsUser="")
        else:  #weird
            yield self.error_form("Couldn't find that herd in your list.")
            return

        utils.set_herd_session()
        content = "<b>Success!</b><br><br>Go <a href='/'>home</a>"
        yield self.plain_page(content)
Ejemplo n.º 4
0
    def del_user_herd(self, herd):
        """Delete user's herd"""
        username = accounts.get_logged_username()
        u = Users.select(Users.q.user == username)
        if herd in u[0].herdsAuto:
            yield self.error_form('''You are a member of that herd,
                                     which means you cannot delete it from your
                                     Meatoo preferences. Sorry.''')
            return
        elif herd in u[0].herdsUser:
            s = u[0].herdsUser.split()
            s.remove(herd)
            if s:
                u[0].set(herdsUser = "******".join(s))
            else:
                u[0].set(herdsUser = "")
        else: #weird
            yield self.error_form("Couldn't find that herd in your list.")
            return

        utils.set_herd_session()
        content = "<b>Success!</b><br><br>Go <a href='/'>home</a>"
        yield self.plain_page(content)
Ejemplo n.º 5
0
 def login(self, *args, **kwargs):
     """Go to front page if login succeeds."""
     utils.set_herd_session()
     utils.set_troves_session()
     #http.redirect("/")
     raise cherrypy.HTTPRedirect("/")
Ejemplo n.º 6
0
 def login(self, *args, **kwargs):
     """Go to front page if login succeeds."""
     utils.set_herd_session()
     utils.set_troves_session()
     #http.redirect("/")
     raise cherrypy.HTTPRedirect("/")