def getListTasksData(self, request, params, tasks_filter): """Returns the list data for all tasks list for program host and all public tasks for others. Args: request: HTTPRequest object params: params of the task entity for the list tasks_filter: dictionary that must be passed to obtain the tasks data """ idx = lists.getListIndex(request) # default list settings visibility = 'public' if idx == 0: all_d = gci_task_model.TaskDifficultyTag.all().fetch(100) all_t = gci_task_model.TaskTypeTag.all().fetch(100) args = [all_d, all_t] contents = lists.getListData(request, params, tasks_filter, visibility=visibility, args=args) else: return lists.getErrorResponse(request, "idx not valid") return lists.getResponse(request, contents)
def getListData(self): idx = lists.getListIndex(self.request) if idx != 0: return None org = self.data.organization program = self.data.program # Hold all the accepted projects for orgs where this user is a member of accepted = [] # Hold all duplicates for either the entire program or the orgs of the user. duplicates = [] dupQ = GSoCProposalDuplicate.all() dupQ.filter('is_duplicate', True) dupQ.filter('org', org) dupQ.filter('program', program) accepted.extend([p.key() for p in getProposalsToBeAcceptedForOrg(org)]) duplicate_entities = dupQ.fetch(1000) for dup in duplicate_entities: duplicates.extend(dup.duplicates) q = GSoCProposal.all() q.filter('org', org) q.filter('program', program) starter = lists.keyStarter prefetcher = lists.modelPrefetcher(GSoCProposal, ['org'], parent=True) response_builder = lists.RawQueryContentResponseBuilder( self.request, self._list_config, q, starter, prefetcher=prefetcher) return response_builder.build(accepted, duplicates)
def getRolesListData(self, request, lists_params): """Returns the list data for roles. """ user = user_logic.getCurrentUser() # only select the roles for the current user # pylint: disable=E1103 fields = { 'link_id': user.link_id, 'status': ['active', 'inactive'] } idx = lists.getListIndex(request) if not 0 <= idx < len(lists_params): return lists.getErrorResponse(request, 'idx not valid') list_params = lists_params[idx] if list_params is None: return lists.getErrorResponse( request, 'idx not valid (list not in roles overview)') contents = helper.lists.getListData(request, list_params, fields) return lists.getResponse(request, contents)
def getRequestsListData(self, request, uh_params, ar_params): """Returns the list data for getRequestsList. """ idx = lists.getListIndex(request) # get the current user user_entity = user_logic.getCurrentUser() # only select the Invites for this user that haven't been handled yet # pylint: disable=E1103 filter = {'user': user_entity} if idx == 0: filter['status'] = 'group_accepted' params = uh_params elif idx == 1: filter['status'] = 'new' params = ar_params else: return lists.getErrorResponse(request, "idx not valid") contents = helper.lists.getListData(request, params, filter, visibility='public') return lists.getResponse(request, contents)
def getListData(self): """Returns the list data as requested by the current request. If the lists as requested is not supported by this component None is returned. """ if lists.getListIndex(self.request) != 0: return None q = OrgAppRecord.all() q.filter("survey", self.survey) q.filter("main_admin", self.data.user) records = q.fetch(1000) q = OrgAppRecord.all() q.filter("survey", self.survey) q.filter("backup_admin", self.data.user) records.extend(q.fetch(1000)) response = lists.ListContentResponse(self.request, self._list_config) for record in records: response.addRow(record) response.next = "done" return response
def getListData(self): """Returns the list data as requested by the current request. If the lists as requested is not supported by this component None is returned. """ if lists.getListIndex(self.data.request) != 1: return None q = GCITask.all() q.filter('program', self.data.program) q.filter( 'org IN', map(lambda org_key: org_key.to_old_key(), self.data.ndb_profile.mentor_for)) starter = lists.keyStarter # TODO(daniel): enable prefetching #prefetcher = lists.ListModelPrefetcher( # GCITask, ['org', 'student', 'created_by', 'modified_by'], ['mentors']) response_builder = lists.RawQueryContentResponseBuilder( self.data.request, self._list_config, q, starter, prefetcher=None) return response_builder.build()
def getManageStatisticsData(self, request, params_collection, program): """Returns the list data for manageStats. Args: request: HTTPRequest object params_collection: List of list Params indexed with the idx of the list program: program entity for which the lists are generated """ idx = lists.getListIndex(request) args = order = [] visibility = 'public' if idx == self.DEF_EACH_GSOC_LIST_IDX: fields = { 'access_for_other_programs': ['visible', 'collectable'] } elif idx == self.DEF_ONE_GSOC_LIST_IDX: fields = { 'scope': program, 'access_for_other_programs' : 'invisible' } else: return lists.getErrorResponse(request, "idx not valid") params = params_collection[idx] contents = helper.lists.getListData(request, params, fields) return lists.getResponse(request, contents)
def getListMyTasksData(self, request, task_params, subscription_params, program, user): """Returns the list data for the starred tasks of the current user. Args: request: HTTPRequest object task_params: params of the task entity for the list subscription_params: params for the task subscription entity for the list program: the GCIProgram to show the tasks for user: The user entity to show the tasks for """ idx = lists.getListIndex(request) all_d = gci_task_model.TaskDifficultyTag.all().fetch(100) all_t = gci_task_model.TaskTypeTag.all().fetch(100) args = [all_d, all_t] if idx == 0: filter = { 'program': program, 'user': user, 'status': ['ClaimRequested', 'Claimed', 'ActionNeeded', 'Closed', 'AwaitingRegistration', 'NeedsWork', 'NeedsReview'] } contents = lists.getListData(request, task_params, filter, args=args) elif idx == 1: filter = {'subscribers': user} contents = lists.getListData(request, subscription_params, filter, args=args) else: return lists.getErrorResponse(request, 'idx not valid') return lists.getResponse(request, contents)
def getListData(self): """Returns the list data as requested by the current request. If the lists as requested is not supported by this component None is returned. """ idx = lists.getListIndex(self.data.request) if idx == 0: list_query = project_logic.getProjectsQuery( program=self.data.program) starter = lists.keyStarter # TODO(daniel): support prefetching of NDB organizations #prefetcher = lists.ModelPrefetcher( # project_model.GSoCProject, ['org'], parent=True) prefetcher = None response_builder = lists.RawQueryContentResponseBuilder( self.data.request, self._list_config, list_query, starter, prefetcher=prefetcher) return response_builder.build() else: return None
def _getManageData(self, request, gps_params, ps_params, entity): """Returns the JSONResponse for the Manage page. Args: request: HTTPRequest object gps_params: GradingProjectSurvey list params ps_params: ProjectSurvey list params entity: StudentProject entity """ idx = lists.getListIndex(request) if idx == 0: params = gps_params elif idx == 1: params = ps_params else: return lists.getErrorResponse(request, "idx not valid") fields = {'project': entity} record_logic = params['logic'].getRecordLogic() record_entities = record_logic.getForFields(fields) record_dict = dict( (i.survey.key(), i) for i in record_entities if i.survey) record_getter = lambda entity: record_dict.get(entity.key()) args = [record_getter] fields = {'scope': entity.program, 'prefix': 'gsoc_program'} contents = lists.getListData(request, params, fields, args=args) return lists.getResponse(request, contents)
def getListData(self): idx = lists.getListIndex(self.request) if idx != self.idx: return None q = GCIScore.all() q.filter('program', self.data.program) starter = lists.keyStarter def prefetcher(entities): keys = [] for entity in entities: key = entity.parent_key() if key: keys.append(key) entities = db.get(keys) sp = dict((i.key(), i) for i in entities if i) return ([sp], {}) response_builder = lists.RawQueryContentResponseBuilder( self.request, self._list_config, q, starter, prefetcher=prefetcher) return response_builder.build()
def getAcceptedOrgsData(self, request, aa_params, ap_params, org_app_logic, program_entity): """Get acceptedOrgs data. """ idx = lists.getListIndex(request) if idx == 0: params = ap_params fields = { 'scope': program_entity, 'status': ['new', 'active', 'inactive'] } elif idx == 1: params = aa_params org_app = org_app_logic.getForProgram(program_entity) fields = { 'survey': org_app, 'status': 'accepted', } else: return lists.getErrorResponse(request, "idx not valid") contents = lists.getListData(request, params, fields) return lists.getResponse(request, contents)
def getListParticipantsData(self, request, params, program_entity): """Returns the list data. """ from django.utils import simplejson from soc.views.models.role import ROLE_VIEWS idx = lists.getListIndex(request) participants_logic = params['participants_logic'] if idx == -1 or idx > len(participants_logic): return lists.getErrorResponse(request, "idx not valid") # get role params that belong to the given index (role_logic, query_field) = participants_logic[idx] role_view = ROLE_VIEWS[role_logic.role_name] role_params = role_view.getParams().copy() # construct the query for the specific list fields = {query_field: program_entity} # return getListData contents = lists.getListData(request, role_params, fields, visibility='admin') return lists.getResponse(request, contents)
def post(self): """Processes the form post data by checking what buttons were pressed.""" idx = lists.getListIndex(self.data.request) if idx != self.IDX: return None data = self.data.POST.get('data') if not data: raise exception.BadRequest(message='Missing data') parsed = json.loads(data) button_id = self.data.POST.get('button_id') if not button_id: raise exception.BadRequest(message='Missing button_id') if button_id == self.PUBLISH_BUTTON_ID: return self.postPublish(parsed, True) if button_id == self.UNPUBLISH_BUTTON_ID: return self.postPublish(parsed, False) raise exception.BadRequest(message="Unknown button_id")
def getListData(self): """Returns the list data as requested by the current request. If the lists as requested is not supported by this component None is returned. """ if lists.getListIndex(self.data.request) != 0: return None q = OrgAppRecord.all() q.filter('survey', self.survey) q.filter('main_admin', self.data.ndb_user.key.to_old_key()) records = q.fetch(1000) q = OrgAppRecord.all() q.filter('survey', self.survey) q.filter('backup_admin', self.data.ndb_user.key.to_old_key()) records.extend(q.fetch(1000)) response = lists.ListContentResponse(self.data.request, self._list_config) for record in records: response.addRow(record) response.next = 'done' return response
def post(self): """POST handler for the list actions. Returns: True if the data is successfully modified; False otherwise. """ idx = lists.getListIndex(self.data.request) if idx != 0: return False data = self.data.POST.get('data') if not data: raise exception.BadRequest(message="Missing data") parsed = json.loads(data) for key_id, properties in parsed.iteritems(): note = properties.get('note') slot_allocation = properties.get('slot_allocation') is_veteran = properties.get('is_veteran') if ('note' not in properties and 'slot_allocation' not in properties and 'is_veteran' not in properties): logging.warning( 'Neither note nor slots nor is_veteran present in "%s"', properties) continue if 'slot_allocation' in properties: if not slot_allocation.isdigit(): logging.warning('Non-int value for slots: "%s', slot_allocation) properties.pop('slot_allocation') else: slot_allocation = int(slot_allocation) if is_veteran: if not is_veteran in ['New', 'Veteran']: logging.warning('Invalid value for new_org: "%s"', is_veteran) properties.pop('is_veteran') else: is_veteran = True if is_veteran == 'Veteran' else False def update_org_txn(): org = soc_org_model.SOCOrganization.get_by_id(key_id) if not org: logging.warning('Invalid org_key "%s"', key_id) elif 'note' in properties: pass # TODO(daniel): add note to organization model #org.note = note elif 'slot_allocation' in properties: org.slot_allocation = slot_allocation if 'is_veteran' in properties: org.is_veteran = is_veteran org.put() db.run_in_transaction(update_org_txn) return True
def getListData(self): """Returns the list data as requested by the current request. If the lists as requested is not supported by this component None is returned. """ idx = lists.getListIndex(self.data.request) if idx == 0: list_query = project_logic.getAcceptedProjectsQuery( program=self.data.program, org=self.data.organization) starter = lists.keyStarter prefetcher = lists.ListModelPrefetcher(GSoCProject, ['org'], ['mentors'], parent=True) response_builder = lists.RawQueryContentResponseBuilder( self.data.request, self._list_config, list_query, starter, prefetcher=prefetcher) return response_builder.build() else: return None
def getListData(self): """Returns the list data as requested by the current request. If the lists as requested is not supported by this component None is returned. """ idx = lists.getListIndex(self.data.request) if idx == 0: list_query = proposal_logic.getProposalsQuery(program=self.data.program) starter = lists.keyStarter # TODO(daniel): support prefetching of NDB organizations #prefetcher = lists.ModelPrefetcher( # proposal_model.GSoCProposal, ['org'], parent=True) # Since ModelPrefetcher doesn't work with NDB, pass an empty list # for the field parameter to prevent __init__() exception. prefetcher = lists.ModelPrefetcher( proposal_model.GSoCProposal, [], parent=True) response_builder = lists.RawQueryContentResponseBuilder( self.data.request, self._list_config, list_query, starter, prefetcher=prefetcher) return response_builder.build() else: return None
def getManageStatisticsData(self, request, params_collection, program): """Returns the list data for manageStats. Args: request: HTTPRequest object params_collection: List of list Params indexed with the idx of the list program: program entity for which the lists are generated """ idx = lists.getListIndex(request) args = order = [] visibility = 'public' if idx == self.DEF_EACH_GSOC_LIST_IDX: fields = {'access_for_other_programs': ['visible', 'collectable']} elif idx == self.DEF_ONE_GSOC_LIST_IDX: fields = { 'scope': program, 'access_for_other_programs': 'invisible' } else: return lists.getErrorResponse(request, "idx not valid") params = params_collection[idx] contents = helper.lists.getListData(request, params, fields) return lists.getResponse(request, contents)
def getListData(self): idx = lists.getListIndex(self.data.request) if idx != 0: return None program = self.data.program # Hold all the accepted projects for orgs where this user is a member of accepted = [] # Hold all duplicates for either the entire program or the orgs of the user. duplicates = [] dupQ = GSoCProposalDuplicate.all() dupQ.filter('is_duplicate', True) dupQ.filter('org', self.data.url_ndb_org.key.to_old_key()) dupQ.filter('program', program) accepted.extend( p.key() for p in getProposalsToBeAcceptedForOrg(self.data.url_ndb_org)) duplicate_entities = dupQ.fetch(1000) for dup in duplicate_entities: duplicates.extend(dup.duplicates) q = GSoCProposal.all() q.filter('org', self.data.url_ndb_org.key.to_old_key()) q.filter('program', program) starter = lists.keyStarter # TODO(daniel): enable prefetching from ndb models ('org', 'parent') # prefetcher = lists.ModelPrefetcher(GSoCProposal, [], parent=True) response_builder = lists.RawQueryContentResponseBuilder( self.data.request, self._list_config, q, starter, prefetcher=None) return response_builder.build(accepted, duplicates)
def getListMentorTasksData(self, request, params, filter): """Returns the list data for Organization Tasks list. Args: request: HTTPRequest object params: params of the task entity for the list filter: properties on which the tasks must be listed """ idx = lists.getListIndex(request) # default list settings visibility = 'public' if idx == 0: all_d = gci_task_model.TaskDifficultyTag.all().fetch(100) all_t = gci_task_model.TaskTypeTag.all().fetch(100) args = [all_d, all_t] contents = lists.getListData(request, params, filter, visibility=visibility, args=args) else: return lists.getErrorResponse(request, "idx not valid") return lists.getResponse(request, contents)
def _getManageData(self, request, gps_params, ps_params, entity): """Returns the JSONResponse for the Manage page. Args: request: HTTPRequest object gps_params: GradingProjectSurvey list params ps_params: ProjectSurvey list params entity: StudentProject entity """ idx = lists.getListIndex(request) if idx == 0: params = gps_params elif idx == 1: params = ps_params else: return lists.getErrorResponse(request, "idx not valid") fields = {'project': entity} record_logic = params['logic'].getRecordLogic() record_entities = record_logic.getForFields(fields) record_dict = dict((i.survey.key(), i) for i in record_entities if i.survey) record_getter = lambda entity: record_dict.get(entity.key()) args = [record_getter] fields = {'scope': entity.program, 'prefix': 'gsoc_program'} contents = lists.getListData(request, params, fields, args=args) return lists.getResponse(request, contents)
def getListData(self): """Returns the list data as requested by the current request. If the lists as requested is not supported by this component None is returned. """ idx = lists.getListIndex(self.data.request) if idx == 0: list_query = proposal_logic.getProposalsQuery( program=self.data.program) starter = lists.keyStarter # TODO(daniel): support prefetching of NDB organizations #prefetcher = lists.ModelPrefetcher( # proposal_model.GSoCProposal, ['org'], parent=True) # Since ModelPrefetcher doesn't work with NDB, pass an empty list # for the field parameter to prevent __init__() exception. prefetcher = lists.ModelPrefetcher(proposal_model.GSoCProposal, [], parent=True) response_builder = lists.RawQueryContentResponseBuilder( self.data.request, self._list_config, list_query, starter, prefetcher=prefetcher) return response_builder.build() else: return None
def jsonContext(self, data, check, mutator): """See base.GSoCRequestHandler.jsonContext for specification.""" idx = lists.getListIndex(data.request) if idx == 0: list_data = OrgApplicationList(data, data.org_app).getListData() return list_data.content() else: raise exception.BadRequest(message="Invalid ID has been specified.")
def jsonContext(self): """Handler for JSON requests. """ idx = lists.getListIndex(self.request) if idx == 0: return GradingRecordsList(self.request, self.data).listContent().content() else: super(GradingRecordsOverview, self).jsonContext()
def jsonContext(self, data, check, mutator): """Handler for JSON requests.""" idx = lists.getListIndex(data.request) if idx == 0: return GradingRecordsList(data).listContent().content() else: # TODO(nathaniel): Should this be a return statement? super(GradingRecordsOverview, self).jsonContext(data, check, mutator)
def jsonContext(self, data, check, mutator): """See base.GSoCRequestHandler.jsonContext for specification.""" idx = lists.getListIndex(data.request) if idx == 0: list_data = OrgApplicationList(data, data.org_app).getListData() return list_data.content() else: raise exception.BadRequest(message='Invalid ID has been specified.')
def jsonContext(self, data, check, mutator): """Handler for JSON requests.""" idx = lists.getListIndex(data.request) if idx == 0: record_list = self._createOrgAppsList(data) return record_list.listContentResponse(data.request).content() else: # TODO(nathaniel): This needs to be a return statement, right? super(OrgAppRecordsList, self).jsonContext(data, check, mutator)
def jsonContext(self): """Handler for JSON requests. """ idx = lists.getListIndex(self.request) if idx == 0: record_list = self._createOrgAppsList() return record_list.listContentResponse(self.request).content() else: super(OrgAppRecordsList, self).jsonContext()
def jsonContext(self): """Handler for JSON requests. """ idx = lists.getListIndex(self.request) if idx == 0: record_list = self._createSurveyRecordList() return record_list.listContentResponse( self.request, prefetch=['project', 'org']).content() else: super(GSoCMentorEvaluationRecordsList, self).jsonContext()
def getListData(self): if lists.getListIndex(self.request) != self.idx: return None q = GCIRequest.all() q.filter("type", "Request") q.filter("org IN", [e.key() for e in self.data.org_admin_for]) response_builder = lists.RawQueryContentResponseBuilder(self.request, self._list_config, q, lists.keyStarter) return response_builder.build()
def getListData(self): if lists.getListIndex(self.request) != self.idx: return None q = GCIOrganization.all() q.filter("scope", self.data.program) q.filter("status IN", ["new", "active"]) response_builder = lists.RawQueryContentResponseBuilder(self.request, self._list_config, q, lists.keyStarter) return response_builder.build()
def jsonContext(self, data, check, mutator): """Handler for JSON requests.""" idx = lists.getListIndex(data.request) if idx == 0: record_list = self._createSurveyRecordList(data) return record_list.listContentResponse( data.request, prefetch=['project', 'org']).content() else: # TODO(nathaniel): missing return statement? super(GSoCMentorEvaluationRecordsList, self).jsonContext( data, check, mutator)
def getListData(self): if lists.getListIndex(self.data.request) != 1: return None q = GCITask.all() q.filter('org', self.data.organization) q.filter('status', 'Closed') starter = lists.keyStarter response_builder = lists.RawQueryContentResponseBuilder( self.data.request, self.list_config, q, starter) return response_builder.build()
def getListData(self): if lists.getListIndex(self.request) != self.idx: return None query = scores_logic.allScoresForProgramQuery(self.data.program) response_builder = lists.RawQueryContentResponseBuilder( self.request, self._list_config, query, lists.keyStarter ) return response_builder.build()
def jsonContext(self, data, check, mutator): """Handler for JSON requests.""" idx = lists.getListIndex(data.request) if idx == 0: record_list = self._createSurveyRecordList(data) return record_list.listContentResponse( data.request, prefetch=['org', 'project']).content() else: # TODO(nathaniel): This smells like it is missing a return statement. super(GSoCStudentEvaluationRecordsList, self).jsonContext( data, check, mutator)
def getListData(self): if lists.getListIndex(self.request) != 0: return None q = GCITask.all() q.filter('org', self.data.organization) q.filter('status IN', CLAIMABLE) starter = lists.keyStarter response_builder = lists.RawQueryContentResponseBuilder( self.request, self.list_config, q, starter) return response_builder.build()
def getListData(self): idx = lists.getListIndex(self.request) if idx != 0: return None q = ShipmentInfo.all().ancestor(self.data.program) starter = lists.keyStarter response_builder = lists.RawQueryContentResponseBuilder( self.request, self._list_config, q, starter) return response_builder.build()
def getListData(self): idx = lists.getListIndex(self.data.request) if idx != self.IDX: return None visibilities = gsoc_document_logic.getVisibilities(self.data) q = document_logic.getDocumentQueryForRoles(self.data, visibilities) response_builder = lists.RawQueryContentResponseBuilder( self.data.request, self._list_config, q, lists.keyStarter) return response_builder.build()
def getListData(self): idx = lists.getListIndex(self.request) if idx == 0: q = soc.models.document.Document.all() q.filter('scope', self.data.program) response_builder = lists.RawQueryContentResponseBuilder( self.request, self._list_config, q, lists.keyStarter) return response_builder.build() else: return None
def getListData(self): idx = lists.getListIndex(self.request) if idx != 0: return None q = shipment_tracking.ShipmentInfo.query( ancestor=ndb.Key.from_old_key(self.data.program.key())) starter = lists.keyStarter response_builder = lists.RawQueryContentResponseBuilder( self.request, self._list_config, q, starter) return response_builder.build()
def getListData(self): idx = lists.getListIndex(self.data.request) if idx == 0: q = document_model.Document.all() q.filter('scope', self.data.program) response_builder = lists.RawQueryContentResponseBuilder( self.data.request, self._list_config, q, lists.keyStarter) return response_builder.build() else: return None
def getListData(self): idx = lists.getListIndex(self.data.request) if idx == 0: q = GCITask.all() q.filter('program', self.data.program) q.filter('status', 'Closed') response_builder = lists.RawQueryContentResponseBuilder( self.data.request, self._list_config, q, lists.keyStarter) return response_builder.build() else: return None
def jsonContext(self, data, check, mutator): idx = lists.getListIndex(data.request) list_content = None if idx == 0: list_content = OpenTasksList(data).getListData() elif idx == 1: list_content = CompletedTasksList(data).getListData() if list_content: return list_content.content() else: raise exception.Forbidden( message='You do not have access to this data')
def getListData(self): # TODO(daniel): add missing doc string idx = lists.getListIndex(self.data.request) if idx != 0: return None query = self._getQuery() prefetcher = self._getPrefetcher() response_builder = lists.RawQueryContentResponseBuilder( self.data.request, self._list_config, query, lists.keyStarter, prefetcher=prefetcher) return response_builder.buildNDB()
def getListData(self): idx = lists.getListIndex(self.data.request) if idx != self.idx: return None query = profile_logic.queryAllStudentsForProgram(self.data.program.key()) starter = lists.keyStarter response_builder = lists.RawQueryContentResponseBuilder( self.data.request, self._list_config, query, starter) return response_builder.buildNDB()
def getManageOverviewData(self, request, mo_params, org_entity): """Returns the manageOverview data. """ args = [] fields = {} idx = lists.getListIndex(request) if idx == 0: from soc.modules.gsoc.logic.models.survey import grading_logic as \ grading_survey_logic from soc.modules.gsoc.logic.models.survey import project_logic as \ project_survey_logic from soc.modules.gsoc.logic.models.survey_record import grading_logic from soc.modules.gsoc.logic.models.survey_record import project_logic program_entity = org_entity.scope fields = {'scope_path': program_entity.key().id_or_name()} # count the number of have been active ProjectSurveys project_surveys = project_survey_logic.getForFields(fields) project_survey_count = len(project_surveys) for project_survey in project_surveys: if not project_survey_logic.hasRecord(project_survey): project_survey_count = project_survey_count - 1 # count the number of have been active GradingProjectSurveys grading_surveys = grading_survey_logic.getForFields(fields) grading_survey_count = len(grading_surveys) for grading_survey in grading_surveys: if not grading_survey_logic.hasRecord(grading_survey): grading_survey_count = grading_survey_count - 1 fields = {'scope': org_entity} params = mo_params args = [ project_surveys, project_survey_count, grading_surveys, grading_survey_count ] else: return lists.getErrorResponse(request, 'idx not valid') contents = lists.getListData(request, params, fields, args=args) return lists.getResponse(request, contents)
def getListData(self): if lists.getListIndex(self.data.request) != self.idx: return None q = GCIOrganization.all() q.filter( '__key__ IN', map(lambda org_key: org_key.to_old_key(), self.data.ndb_profile.admin_for)) q.filter('status IN', ['new', 'active']) response_builder = lists.RawQueryContentResponseBuilder( self.data.request, self._list_config, q, lists.keyStarter) return response_builder.build()
def getListData(self): idx = lists.getListIndex(self.data.request) if idx != 0: return None q = GSoCSlotTransfer.all().filter('program', self.data.program) starter = lists.keyStarter # TODO(daniel): enable prefetching ['parent'] # prefetcher = lists.ModelPrefetcher(GSoCSlotTransfer, [], parent=True) response_builder = lists.RawQueryContentResponseBuilder( self.data.request, self._list_config, q, starter, prefetcher=None) return response_builder.build()
def getListData(self, request, params, visibility, filter): """Returns the list data. """ idx = lists.getListIndex(request) if idx != 0: return lists.getErrorResponse(request, "idx not valid") contents = lists.getListData(request, params, filter, visibility=visibility) return lists.getResponse(request, contents)
def getHomeData(self, request, ap_params, entity): """Returns the home data. """ idx = lists.getListIndex(request) if idx == 0: params = ap_params # only show projects that have not failed fields = {'scope': entity, 'status': ['accepted', 'completed']} else: return lists.getErrorResponse(request, "idx not valid") contents = lists.getListData(request, params, fields, 'org_home') return lists.getResponse(request, contents)
def getListRolesData(self, request, list_params, group_entity): """Returns the list data for listRoles. """ idx = lists.getListIndex(request) if not 0 <= idx < len(list_params): return lists.getErrorResponse(request, "idx not valid") # create the filter fields = {'scope': group_entity, 'status': 'active'} params = list_params[idx] contents = lists.getListData(request, params, fields) return lists.getResponse(request, contents)