Exemplo n.º 1
0
 def getListData(self):
   idx = lists.getListIndex(self.request)
   if idx == 0:
     fields = {'scope': self.data.program,
               'status': ['new', 'active', 'inactive']}
     response_builder = lists.QueryContentResponseBuilder(
         self.request, self._list_config, org_logic, fields)
     return response_builder.build()
   else:
     return None
Exemplo n.º 2
0
 def getListData(self):
   idx = lists.getListIndex(self.request)
   if idx == self.idx:
     if self.for_admin:
       fields = {'group': self.data.org_admin_for}
     else:
       fields = {'user': self.data.user}
     response_builder = lists.QueryContentResponseBuilder(
         self.request, self._list_config, request_logic, fields, prefetch=['user', 'group'])
     return response_builder.build()
   else:
     return None
Exemplo n.º 3
0
    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.request)
        if idx == 3:
            fields = {'program': self.data.program}
            response_builder = lists.QueryContentResponseBuilder(
                self.request, self._list_config, ps_logic, fields)
            return response_builder.build()
        else:
            return None
Exemplo n.º 4
0
  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.request)
    if idx == 3:
      fields = {'program': self.data.program}
      response_builder = lists.QueryContentResponseBuilder(
          self.request, self._list_config, ps_logic, fields)
      return response_builder.build()
    else:
      return None
Exemplo n.º 5
0
  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.request)
    if idx == 0:
      fields = {'program': self.data.program,
                'status': 'accepted'}
      response_builder = lists.QueryContentResponseBuilder(
          self.request, self._list_config, sp_logic,
          fields, prefetch=['student', 'scope', 'mentor'])
      return response_builder.build()
    else:
      return None
Exemplo n.º 6
0
 def getListData(self):
     idx = lists.getListIndex(self.request)
     if idx == self.idx:
         if self.for_admin:
             fields = {'group': self.data.org_admin_for}
         else:
             fields = {'user': self.data.user}
         response_builder = lists.QueryContentResponseBuilder(
             self.request,
             self._list_config,
             request_logic,
             fields,
             prefetch=['user', 'group'])
         return response_builder.build()
     else:
         return None
Exemplo n.º 7
0
  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.request)
    if idx == 0:
      fields = {'scope': self.data.organization,
                'status': 'accepted'}
      response_builder = lists.QueryContentResponseBuilder(
          self.request, self._list_config, sp_logic,
          fields, prefetch=['student'])
      return response_builder.build()
    else:
      return None
Exemplo n.º 8
0
  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.request)
    if idx == 0:
      fields = {'survey': self.org_app_survey,
                'main_admin': self.data.user}
      response_builder = lists.QueryContentResponseBuilder(
          self.request, self._list_config, org_app_logic.getRecordLogic(),
          fields)
      return response_builder.build()
    else:
      return None
Exemplo n.º 9
0
    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.request)
        if idx == 4:
            q = GSoCProposal.all()
            q.filter('org IN', self.data.mentor_for)

            starter = lists.keyModelStarter(GSoCProposal)

            response_builder = lists.RawQueryContentResponseBuilder(
                self.request, self._list_config, q, starter, prefetch=['org'])
            return response_builder.build()
        else:
            return None
Exemplo n.º 10
0
    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.request)
        if idx == 0:
            fields = {
                'survey': self.org_app_survey,
                'main_admin': self.data.user
            }
            response_builder = lists.QueryContentResponseBuilder(
                self.request, self._list_config,
                org_app_logic.getRecordLogic(), fields)
            return response_builder.build()
        else:
            return None
Exemplo n.º 11
0
  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.request)
    if idx == 4:
      q = GSoCProposal.all()
      q.filter('org IN', self.data.mentor_for)

      starter = lists.keyModelStarter(GSoCProposal)

      response_builder = lists.RawQueryContentResponseBuilder(
          self.request, self._list_config, q, starter, prefetch=['org'])
      return response_builder.build()
    else:
      return None
Exemplo n.º 12
0
  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.request)
    if idx == 6:
      response = lists.ListContentResponse(self.request, self._list_config)

      if response.start != 'done':
        # Add all organizations in one go since we already queried for it.
        for mentor in self.data.mentor_for:
          response.addRow(mentor)
        response.next = 'done'

      return response
    else:
      return None
Exemplo n.º 13
0
    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.request)
        if idx == 6:
            response = lists.ListContentResponse(self.request,
                                                 self._list_config)

            if response.start != 'done':
                # Add all organizations in one go since we already queried for it.
                for mentor in self.data.mentor_for:
                    response.addRow(mentor)
                response.next = 'done'

            return response
        else:
            return None
Exemplo n.º 14
0
    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.request)
        if idx == 2:
            fields = {
                'program': self.data.program,
                'student': self.data.profile
            }
            prefetch = ['scope']
            response_builder = lists.QueryContentResponseBuilder(
                self.request,
                self._list_config,
                project_logic,
                fields,
                prefetch=prefetch)
            return response_builder.build()
        else:
            return None
Exemplo n.º 15
0
    def getListData(self):
        idx = lists.getListIndex(self.request)

        def starter(start_key, q):
            if not start_key:
                q.filter('org_admin_for IN', self.data.org_admin_for)
                return True

            split = start_key.split(':', 1)
            if len(split) != 2:
                return False

            cls, start_key = split

            if cls == 'org_admin':
                q.filter('org_admin_for IN', self.data.org_admin_for)
            elif cls == 'mentor':
                q.filter('mentor_for IN', self.data.org_admin_for)
            else:
                return False

            if not start_key:
                return True

            start_entity = db.get(start_key)

            if not start_entity:
                return False

            q.filter('__key__ >=', start_entity.key())
            return True

        def ender(entity, is_last, start):
            if not start:
                if is_last:
                    return 'mentor:'
                else:
                    return 'org_admin:' + str(entity.key())

            split = start.split(':', 1)
            if len(split) != 2:
                return False

            cls, _ = split

            if is_last:
                return 'done'

            return '%s:%s' % (cls, str(entity.key()))

        def skipper(entity, start):
            if start.startswith('mentor:'):
                return False

            return any(self.data.orgAdminFor(i) for i in entity.mentor_for)

        q = GSoCProfile.all()

        if idx == 9:
            fields = {'mentor_for': self.data.user}
            response_builder = lists.RawQueryContentResponseBuilder(
                self.request,
                self._list_config,
                q,
                starter,
                ender=ender,
                skipper=skipper,
                prefetch=['user'])
            return response_builder.build()
        else:
            return None
Exemplo n.º 16
0
  def getListData(self):
    idx = lists.getListIndex(self.request)

    def starter(start_key, q):
      if not start_key:
        q.filter('org_admin_for IN', self.data.org_admin_for)
        return True

      split = start_key.split(':', 1)
      if len(split) != 2:
        return False

      cls, start_key = split

      if cls == 'org_admin':
        q.filter('org_admin_for IN', self.data.org_admin_for)
      elif cls == 'mentor':
        q.filter('mentor_for IN', self.data.org_admin_for)
      else:
        return False

      if not start_key:
        return True

      start_entity = db.get(start_key)

      if not start_entity:
        return False

      q.filter('__key__ >=', start_entity.key())
      return True

    def ender(entity, is_last, start):
      if not start:
        if is_last:
          return 'mentor:'
        else:
          return 'org_admin:' + str(entity.key())

      split = start.split(':', 1)
      if len(split) != 2:
        return False

      cls, _ = split

      if is_last:
        return 'done'

      return '%s:%s' % (cls, str(entity.key()))

    def skipper(entity, start):
      if start.startswith('mentor:'):
        return False

      return any(self.data.orgAdminFor(i) for i in entity.mentor_for)

    q = GSoCProfile.all()

    if idx == 9:
      fields = {'mentor_for': self.data.user}
      response_builder = lists.RawQueryContentResponseBuilder(
          self.request, self._list_config, q, starter,
          ender=ender, skipper=skipper, prefetch=['user'])
      return response_builder.build()
    else:
      return None