is_active=True) if not project: raise HTTPError(404) if not self.current_user in project.members: raise HTTPError(403) response['project'] = project.to_json() response['project'].update( {'current_sprint': project.get_current_sprint().to_json()}) except Project.DoesNotExist: raise HTTPError(404) else: # Check if we are returning a list of projects for # the logged in user projects = Project.objects(members=self.current_user, organization=org).order_by('created_on') response['projects'] = [] for p in projects: response['projects'].append(p.to_json()) response['projects'][-1].update( {'current_sprint': p.get_current_sprint().to_json()}) self.finish(json.dumps(response)) if not self._headers_written: self.write(json.dumps(response)) @authenticated def put(self, *args, **kwargs): organization = kwargs.get('organization', None) org = self.validate_request(organization)
raise HTTPError(404) if not self.current_user in project.members: raise HTTPError(403) response['project'] = project.to_json() response['project'].update( {'current_sprint': project.get_current_sprint().to_json()}) except Project.DoesNotExist: raise HTTPError(404) # All projects for the current else: # Check if we are returning a list of projects for # the logged in user projects = Project.objects( members=self.current_user).order_by('created_on') response['projects'] = [] for p in projects: response['projects'].append(p.to_json()) response['projects'][-1].update( {'current_sprint': p.get_current_sprint().to_json()}) self.finish(json.dumps(response)) 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:
raise HTTPError(404) if not self.current_user in project.members: raise HTTPError(403) response['project'] = project.to_json() response['project'].update({ 'current_sprint' : project.get_current_sprint().to_json() }) except Project.DoesNotExist: raise HTTPError(404) else: # Check if we are returning a list of projects for # the logged in user projects = Project.objects(members=self.current_user, organization=org ).order_by('created_on') response['projects'] = [] for p in projects: response['projects'].append(p.to_json()) response['projects'][-1].update({ 'current_sprint': p.get_current_sprint().to_json() }) self.finish(json.dumps(response)) if not self._headers_written: self.write(json.dumps(response)) @authenticated
if not self.current_user in project.members: raise HTTPError(403) response['project'] = project.to_json() response['project'].update({ 'current_sprint' : project.get_current_sprint().to_json() }) except Project.DoesNotExist: raise HTTPError(404) # All projects for the current else: # Check if we are returning a list of projects for # the logged in user projects = Project.objects(members=self.current_user ).order_by('created_on') response['projects'] = [] for p in projects: response['projects'].append(p.to_json()) response['projects'][-1].update({ 'current_sprint': p.get_current_sprint().to_json() }) self.finish(json.dumps(response)) 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)