Ejemplo n.º 1
0
 def mkproject(self, message, project_name):
     user = self.get_user(message)
     try:
         Project.create(user, project_name)
         self.reply(message, "Project %s created for you, %s" % (project_name, user.mention_name))
     except ProjectAlreadyExistsException as e:
         self.reply(message, "Sorry, but that project already exists under your name.")
     except InvalidNameException:
         self.reply(message, "Sorry, just letters and numbers (no spaces).")
Ejemplo n.º 2
0
 def mkproject(self, message, project_name):
     user = self.get_user(message)
     try:
         Project.create(user, project_name)
         self.reply(message, "Project %s created for you, %s" % (project_name, user.mention_name))
     except ProjectAlreadyExistsException as e:
         self.reply(message, "Sorry, but that project already exists under your name.")
     except InvalidNameException:
         self.reply(message, "Sorry, just letters and numbers (no spaces).")
Ejemplo n.º 3
0
def mkprojects(user, num=3):
    # shortcut to make a few projects for a test user
    tmp = []

    for x in range(num):
        tmp.append(Project.create(user, str(uuid.uuid4())))

    return tmp
Ejemplo n.º 4
0
def mkprojects(user, num=3):
    # shortcut to make a few projects for a test user
    tmp = []

    for x in range(num):
        tmp.append(Project.create(user, str(uuid.uuid4())))

    return tmp
Ejemplo n.º 5
0
    def update_status(self, message, project_name, status):
        connect()
        # insert into postgres
        user = self.get_user(message)

        try:
            project = Project.get(user_id=user.user_id, name=project_name)
        except Project.DoesNotExist:
            self.reply(message, "Sorry, project %s not found." % project_name)
            return

        status = StatusUpdate.create(project, status)

        self.reply(message, "Status updated." + str(status))
Ejemplo n.º 6
0
    def update_status(self, message, project_name, status):
        connect()
        # insert into postgres
        user = self.get_user(message)

        try:
            project = Project.get(user_id=user.user_id, name=project_name)
        except Project.DoesNotExist:
            self.reply(message, "Sorry, project %s not found." % project_name)
            return

        status = StatusUpdate.create(project, status)

        self.reply(message, "Status updated." + str(status))
Ejemplo n.º 7
0
    def lsproject(self, message, nick):
        # lists all projects, current user is assumed
        connect()
        if nick:
            nick = nick.strip()
            user = User.get_by_nick(nick)
        else:
            user = self.get_user(message)

        if not user:
            self.reply(message, "Could not find user %s" % nick)
            return

        projects = Project.objects(user_id=user.user_id)

        template = rendered_template("lsproject.html", {"user":user, "projects":projects})
        self.reply(message, template, html=True)
Ejemplo n.º 8
0
    def lsproject(self, message, nick):
        # lists all projects, current user is assumed
        connect()
        if nick:
            nick = nick.strip()
            user = User.get_by_nick(nick)
        else:
            user = self.get_user(message)

        if not user:
            self.reply(message, "Could not find user %s" % nick)
            return

        projects = Project.objects(user_id=user.user_id)

        template = rendered_template("lsproject.html", {"user":user, "projects":projects})
        self.reply(message, template, html=True)
Ejemplo n.º 9
0
 def remove_project(self, message, project_name):
     user = self.get_user(message)
     Project.objects(user_id=user.user_id, name=project_name).delete()
     self.reply(message, "Project %s deleted." % project_name)
Ejemplo n.º 10
0
 def remove_project(self, message, project_name):
     user = self.get_user(message)
     Project.objects(user_id=user.user_id, name=project_name).delete()
     self.reply(message, "Project %s deleted." % project_name)