Exemplo n.º 1
0
 def get_project_object(self, sequence=None, org=None):
     try:
         project = Project.get_project_object(sequence=sequence,
                                       is_active=True,
                                       organization=org)
     except ValidationError, error:
         raise HTTPError(404, **{'reason': self.error_message(error)})
Exemplo n.º 2
0
 def get_project_object(self, sequence=None, organization=None):
     try:
         project = Project.get_project_object(sequence=str(sequence),
                                              organization=organization)
         print project
     except ValidationError, error:
         raise HTTPError(404, **{'reason': self.error_message(error)})
Exemplo n.º 3
0
 def get_project_object(self, sequence=None, organization=None):
     try:
         project = Project.get_project_object(sequence=str(sequence),
                                       organization=organization)
         print project
     except ValidationError, error:
         raise HTTPError(404, **{'reason': self.error_message(error)})
Exemplo n.º 4
0
 def get_project_object(self, sequence=None, org=None):
     try:
         project = Project.get_project_object(sequence=sequence,
                                              is_active=True,
                                              organization=org)
     except ValidationError, error:
         raise HTTPError(404, **{'reason': self.error_message(error)})
Exemplo n.º 5
0
 def get(self, *args, **kwargs):
     """
     Get a list of projects by passing in:
     1) projectId - the project sequence number (returns a single project)
     2) owner and project_name - Gets the project in either 
     the user or org context
     3) No params - List all the projects for the current authenticated user
     """
     sequence = self.get_argument('projectId', None)
     owner = self.get_argument('owner', None)
     project_name = self.get_argument('project_name', None)
     response = {}
     # By Sequence number
     if sequence:
         try:
             project = Project.get_project_object(sequence)
             if self.current_user in project.members:
                 response['project'] = project.to_json()
                 response['project'].update({
                     'current_sprint':
                     project.get_current_sprint().to_json()
                 })
             else:
                 raise HTTPError(404, **{'reason': "Project Not found."})
         except ValidationError, error:
             raise HTTPError(404, **{'reason': self.error_message(error)})
Exemplo n.º 6
0
 def get(self, *args, **kwargs):
     """
     Get a list of projects by passing in:
     1) projectId - the project sequence number (returns a single project)
     2) owner and project_name - Gets the project in either 
     the user or org context
     3) No params - List all the projects for the current authenticated user
     """
     sequence = self.get_argument('projectId', None)
     owner = self.get_argument('owner', None)
     project_name = self.get_argument('project_name', None)
     response = {}
     # By Sequence number
     if sequence:
         try:
             project = Project.get_project_object(sequence)
             if self.current_user in project.members:
                 response['project'] = project.to_json()
                 response['project'].update({
                     'current_sprint' : project.get_current_sprint().to_json()
                 })
             else:
                 raise HTTPError(404, **{'reason': "Project Not found."})
         except ValidationError, error:
             raise HTTPError(404, **{'reason': self.error_message(error)})
Exemplo n.º 7
0
 def delete(self, *args, **kwargs):
     sequence = self.get_argument('projectId', None)
     try:
         project = Project.get_project_object(sequence)
         project.update(set__active=False)
         self.write(project.to_json())
     except ValidationError, error:
         raise HTTPError(404, **{'reason': self.error_message(error)})
Exemplo n.º 8
0
 def delete(self, *args, **kwargs):
     sequence = self.get_argument('projectId', None)
     try:
         project = Project.get_project_object(sequence)
         project.update(set__active=False)
         self.write(project.to_json())
     except ValidationError, error:
         raise HTTPError(404, **{'reason': self.error_message(error)})
Exemplo n.º 9
0
 def get_valid_project(self, project_id=None, permalink=None):
     if not project_id and not permalink:
         self.send_error(404)
     if project_id:
         try:
             project = Project.get_project_object(sequence=project_id)
             if self.current_user not in project.members:
                 self.send_error(404)
         except ValidationError, error:
             raise HTTPError(404, **{'reason': self.error_message(error)})
Exemplo n.º 10
0
 def get_valid_project(self, project_id, organization):
     if not project_id:
         self.send_error(404)
     try:
         project = Project.get_project_object(sequence=project_id,
                                              organization=organization)
         if self.current_user != project.admin:
             self.send_error(404)
     except ValidationError, error:
         raise HTTPError(404, **{'reason': self.error_message(error)})
Exemplo n.º 11
0
 def get_valid_project(self, project_id=None, permalink=None):
     if not project_id and not permalink:
         self.send_error(404)
     if project_id:
         try:
             project = Project.get_project_object(sequence=project_id)
             if self.current_user not in project.members:
                 self.send_error(404)
         except ValidationError, error:
             raise HTTPError(404, **{'reason': self.error_message(error)})
Exemplo n.º 12
0
 def get_valid_project(self, project_id, organization):
     if not project_id:
         self.send_error(404)
     try:
         project = Project.get_project_object(sequence=project_id,
                                              organization=organization)
         if self.current_user != project.admin:
             self.send_error(404)
     except ValidationError, error:
         raise HTTPError(404, **{'reason': self.error_message(error)})
Exemplo n.º 13
0
 def get(self, *args, **kwargs):
     organization = kwargs.get('organization', None)
     org = self.validate_request(organization)
     response = None
     project_id = self.get_argument('projectId', None)
     if not project_id:
         projects = Project.objects.filter(organization=org,
                                       is_active=True)
         response = json_dumper(projects)
     elif project_id:
         try:
             project = Project.get_project_object(sequence=project_id,
                                                  organization=org)
             response = project.to_json()
         except ValidationError, error:
             raise HTTPError(404, **{'reason': self.error_message(error)})
Exemplo n.º 14
0
 def get(self, *args, **kwargs):
     organization = kwargs.get('organization', None)
     org = self.validate_request(organization)
     response = None
     sequence = self.get_argument('projectId', None)
     owner = self.get_argument('owner', None)
     project_name = self.get_argument('project_name', None)
     
     # By Sequence number
     if sequence:
         try:
             project = Project.get_project_object(sequence=sequence,
                                                  organization=org)
             if self.current_user in project.members:
                 response['project'] = project.to_json()
                 response['project'].update({
                     'current_sprint' : project.get_current_sprint().to_json()
                 })
             else:
                 raise HTTPError(404, **{'reason': "Project Not found."})
         except ValidationError, error:
             raise HTTPError(404, **{'reason': self.error_message(error)})
Exemplo n.º 15
0
    def get(self, *args, **kwargs):
        organization = kwargs.get('organization', None)
        org = self.validate_request(organization)
        response = None
        sequence = self.get_argument('projectId', None)
        owner = self.get_argument('owner', None)
        project_name = self.get_argument('project_name', None)

        # By Sequence number
        if sequence:
            try:
                project = Project.get_project_object(sequence=sequence,
                                                     organization=org)
                if self.current_user in project.members:
                    response['project'] = project.to_json()
                    response['project'].update({
                        'current_sprint':
                        project.get_current_sprint().to_json()
                    })
                else:
                    raise HTTPError(404, **{'reason': "Project Not found."})
            except ValidationError, error:
                raise HTTPError(404, **{'reason': self.error_message(error)})