Beispiel #1
0
    def setUp(self):
        """See unittest.TestCase.setUp for specification."""
        program = program_utils.seedProgram()
        self.org_app = program_utils.seedApplicationSurvey(program.key())
        self.org = org_utils.seedOrganization(program.key())

        self.kwargs = {
            'sponsor': org_model.getSponsorId(self.org.key),
            'program': org_model.getProgramId(self.org.key),
            'organization': org_model.getOrgId(self.org.key)
        }
Beispiel #2
0
  def setUp(self):
    """See unittest.TestCase.setUp for specification."""
    program = program_utils.seedProgram()
    self.org_app = program_utils.seedApplicationSurvey(program.key())
    self.org = org_utils.seedOrganization(program.key())

    self.kwargs = {
        'sponsor': org_model.getSponsorId(self.org.key),
        'program': org_model.getProgramId(self.org.key),
        'organization': org_model.getOrgId(self.org.key)
        }
Beispiel #3
0
  def organization(self, org_key, url_name):
    """Returns the URL of an organization's named page.

    Args:
      org_key: Organization key.
      url_name: The name with which a URL was registered with Django.

    Returns:
      The URL of the page matching the given name for the given organization.
    """
    kwargs = {
        'sponsor': org_model.getSponsorId(org_key),
        'program': org_model.getProgramId(org_key),
        'organization': org_model.getOrgId(org_key)
        }
    return urlresolvers.reverse(url_name, kwargs=kwargs)
Beispiel #4
0
    def organization(self, org_key, url_name):
        """Returns the URL of an organization's named page.

    Args:
      org_key: Organization key.
      url_name: The name with which a URL was registered with Django.

    Returns:
      The URL of the page matching the given name for the given organization.
    """
        kwargs = {
            'sponsor': org_model.getSponsorId(org_key),
            'program': org_model.getProgramId(org_key),
            'organization': org_model.getOrgId(org_key)
        }
        return urlresolvers.reverse(url_name, kwargs=kwargs)
Beispiel #5
0
  def connect_org(self, org_key=None):
    """Sets the _url_name for a gsoc_org_connection redirect.

    Intended for use when generating a url for a redirect to
    UserConnectionPage.

    Args:
      org_key: Override the current organization (if any) provided
        by the RequestData object. Intended specifically for the call
        from connect_user.
    """
    if not org_key:
      org_key = self._data.url_ndb_org.key

    # We need to reassign the kwarg to the org's link_id since it's
    # being set to the Organization object
    self.kwargs['sponsor'] = melange_org_model.getSponsorId(org_key)
    self.kwargs['program'] = melange_org_model.getProgramId(org_key)
    self.kwargs['organization'] = melange_org_model.getOrgId(org_key)
    self._url_name = url_names.GSOC_USER_CONNECTION
    return self
Beispiel #6
0
    def connect_org(self, org_key=None):
        """Sets the _url_name for a gsoc_org_connection redirect.

    Intended for use when generating a url for a redirect to
    UserConnectionPage.

    Args:
      org_key: Override the current organization (if any) provided
        by the RequestData object. Intended specifically for the call
        from connect_user.
    """
        if not org_key:
            org_key = self._data.url_ndb_org.key

        # We need to reassign the kwarg to the org's link_id since it's
        # being set to the Organization object
        self.kwargs['sponsor'] = melange_org_model.getSponsorId(org_key)
        self.kwargs['program'] = melange_org_model.getProgramId(org_key)
        self.kwargs['organization'] = melange_org_model.getOrgId(org_key)
        self._url_name = url_names.GSOC_USER_CONNECTION
        return self
Beispiel #7
0
  def userOrg(self, profile_key, org_key, url_name):
    """Returns the URL of a page whose address contains parts associated
    with the specified profile and organization.

    The specified profile and organization must come from the same program.

    Args:
      profile_key: Profile key.
      org: organization entity.
      url_name: the name with which a URL was registered with Django.

    Returns:
      The URL of the page matching the given names for the given profile
      and organization.
    """
    kwargs = {
        'sponsor': profile_model.getSponsorId(profile_key),
        'program': profile_model.getProgramId(profile_key),
        'user': profile_model.getUserId(profile_key),
        'organization': org_model.getOrgId(org_key),
        }
    return urlresolvers.reverse(url_name, kwargs=kwargs)
Beispiel #8
0
    def userOrg(self, profile_key, org_key, url_name):
        """Returns the URL of a page whose address contains parts associated
    with the specified profile and organization.

    The specified profile and organization must come from the same program.

    Args:
      profile_key: Profile key.
      org: organization entity.
      url_name: the name with which a URL was registered with Django.

    Returns:
      The URL of the page matching the given names for the given profile
      and organization.
    """
        kwargs = {
            'sponsor': profile_model.getSponsorId(profile_key),
            'program': profile_model.getProgramId(profile_key),
            'user': profile_model.getUserId(profile_key),
            'organization': org_model.getOrgId(org_key),
        }
        return urlresolvers.reverse(url_name, kwargs=kwargs)