Пример #1
0
    def _email_now_vouched(self, vouched_by, description=''):
        """Email this user, letting them know they are now vouched."""
        name = None
        voucher_profile_link = None
        vouchee_profile_link = utils.absolutify(self.get_absolute_url())
        if vouched_by:
            name = vouched_by.full_name
            voucher_profile_link = utils.absolutify(vouched_by.get_absolute_url())

        number_of_vouches = self.vouches_received.all().count()
        template = get_template('phonebook/emails/vouch_confirmation_email.txt')
        message = template.render({
            'voucher_name': name,
            'voucher_profile_url': voucher_profile_link,
            'vouchee_profile_url': vouchee_profile_link,
            'vouch_description': description,
            'functional_areas_url': utils.absolutify(reverse('groups:index_functional_areas')),
            'groups_url': utils.absolutify(reverse('groups:index_groups')),
            'first_vouch': number_of_vouches == 1,
            'can_vouch_threshold': number_of_vouches == settings.CAN_VOUCH_THRESHOLD,
        })
        subject = _(u'You have been vouched on Mozillians.org')
        filtered_message = message.replace('"', '"').replace(''', "'")
        send_mail(subject, filtered_message, settings.FROM_NOREPLY,
                  [self.user.email])
Пример #2
0
    def _email_now_vouched(self, vouched_by, description=''):
        """Email this user, letting them know they are now vouched."""
        name = None
        voucher_profile_link = None
        vouchee_profile_link = utils.absolutify(self.get_absolute_url())
        if vouched_by:
            name = vouched_by.full_name
            voucher_profile_link = utils.absolutify(
                vouched_by.get_absolute_url())

        number_of_vouches = self.vouches_received.all().count()
        template = get_template(
            'phonebook/emails/vouch_confirmation_email.txt')
        message = template.render({
            'voucher_name':
            name,
            'voucher_profile_url':
            voucher_profile_link,
            'vouchee_profile_url':
            vouchee_profile_link,
            'vouch_description':
            description,
            'functional_areas_url':
            utils.absolutify(reverse('groups:index_functional_areas')),
            'groups_url':
            utils.absolutify(reverse('groups:index_groups')),
            'first_vouch':
            number_of_vouches == 1,
            'can_vouch_threshold':
            number_of_vouches == settings.CAN_VOUCH_THRESHOLD,
        })
        subject = _(u'You have been vouched on Mozillians.org')
        filtered_message = message.replace('"', '"').replace(''', "'")
        send_mail(subject, filtered_message, settings.FROM_NOREPLY,
                  [self.user.email])
Пример #3
0
    def _email_now_vouched(self, vouched_by, description=""):
        """Email this user, letting them know they are now vouched."""
        name = None
        voucher_profile_link = None
        vouchee_profile_link = utils.absolutify(self.get_absolute_url())
        if vouched_by:
            name = vouched_by.full_name
            voucher_profile_link = utils.absolutify(vouched_by.get_absolute_url())

        number_of_vouches = self.vouches_received.all().count()
        template = get_template("phonebook/emails/vouch_confirmation_email.txt")
        message = template.render(
            {
                "voucher_name": name,
                "voucher_profile_url": voucher_profile_link,
                "vouchee_profile_url": vouchee_profile_link,
                "vouch_description": description,
                "functional_areas_url": utils.absolutify(reverse("groups:index_functional_areas")),
                "groups_url": utils.absolutify(reverse("groups:index_groups")),
                "first_vouch": number_of_vouches == 1,
                "can_vouch_threshold": number_of_vouches == settings.CAN_VOUCH_THRESHOLD,
            }
        )
        subject = _(u"You have been vouched on Mozillians.org")
        filtered_message = message.replace(""", '"').replace("'", "'")
        send_mail(subject, filtered_message, settings.FROM_NOREPLY, [self.user.email])
Пример #4
0
 def test_get_detail_mozilla_app(self):
     client = Client()
     url = reverse('api_dispatch_detail',
                   kwargs={'api_name': 'v1', 'resource_name': 'users',
                           'pk': self.user.userprofile.id})
     url = urlparams(url, app_name=self.mozilla_app.name,
                     app_key=self.mozilla_app.key)
     response = client.get(url, follow=True)
     data = json.loads(response.content)
     profile = self.user.userprofile
     eq_(response.status_code, 200)
     eq_(data['id'], profile.id)
     eq_(data['full_name'], profile.full_name)
     eq_(data['is_vouched'], profile.is_vouched)
     eq_(data['vouched_by'], profile.vouched_by.id)
     # eq_(data['date_vouched'], profile.date_vouched)
     eq_(data['groups'], list(profile.groups.values_list('name', flat=True)))
     eq_(data['skills'], list(profile.skills.values_list('name', flat=True)))
     eq_(data['accounts'],
         [{'identifier': a.identifier, 'type': a.type}
          for a in profile.externalaccount_set.all()])
     eq_(data['bio'], profile.bio)
     eq_(data['photo'], profile.photo)
     eq_(data['ircname'], profile.ircname)
     eq_(data['country'], profile.country)
     eq_(data['region'], profile.region)
     eq_(data['city'], profile.city)
     eq_(data['date_mozillian'], profile.date_mozillian)
     eq_(data['timezone'], profile.timezone)
     eq_(data['email'], profile.email)
     eq_(data['url'],
         absolutify(reverse('phonebook:profile_view',
                            args=[profile.user.username])))
Пример #5
0
def gravatar(email, default_avatar_url=settings.DEFAULT_AVATAR_URL,
             size=175, rating='pg'):
    """Return the Gravatar URL for an email address."""
    url = GRAVATAR_URL.format(emaildigest=md5(email).hexdigest())
    url = urlparams(url, d=utils.absolutify(default_avatar_url),
                    s=size, r=rating)
    return url
Пример #6
0
def browserid_login(request):
    """Multi-mode BrowserID authentication form processor.

    Handles login and register browserid verification. If
    the mode is login, we are done. If the mode is register
    then we start new profile flow. Also handles corner cases.

    Login and register sasl-browserid verification steps are very similar
    and the corner cases blur the lines, so this is best as one
    url.

    We use the form from django-browserid, but since the LDAP server
    does the BrowserID auth behind the scenes, we don't use it's auth code
    nor it's views.
    """
    form = ModalBrowserIdForm(data=request.POST)
    if form.is_valid():
        assertion = form.cleaned_data['assertion']
        store_assertion(request, assertion)
        mode = form.cleaned_data['mode']
        user = auth.authenticate(request=request, assertion=assertion)
        if user:
            auth.login(request, user)
            return redirect('profile', request.user.unique_id)
        else:
            url = absolutify("%s?link=%s" % (reverse('register'), mode))
            return redirect(url)
    else:
        msg = _('Sorry, but there were problems with the info you submitted. '
                'Please review the form, correct any errors, and try again.')
        messages.warning(request, msg)
        log.warning("Form didn't validate %s" % str(request.POST))
        return redirect('home')
Пример #7
0
def gravatar(email, default_avatar_url=settings.DEFAULT_AVATAR_URL,
             size=175, rating='pg'):
    """Return the Gravatar URL for an email address."""
    url = GRAVATAR_URL.format(emaildigest=md5(email).hexdigest())
    url = urlparams(url, d=utils.absolutify(default_avatar_url),
                    s=size, r=rating)
    return url
Пример #8
0
 def test_get_detail_mozilla_app(self):
     client = Client()
     url = reverse('api_dispatch_detail',
                   kwargs={'api_name': 'v1', 'resource_name': 'users',
                           'pk': self.user.userprofile.id})
     url = urlparams(url, app_name=self.mozilla_app.name,
                     app_key=self.mozilla_app.key)
     response = client.get(url, follow=True)
     data = json.loads(response.content)
     profile = self.user.userprofile
     eq_(response.status_code, 200)
     eq_(data['id'], profile.id)
     eq_(data['full_name'], profile.full_name)
     eq_(data['is_vouched'], profile.is_vouched)
     eq_(data['vouched_by'], profile.vouched_by.id)
     # eq_(data['date_vouched'], profile.date_vouched)
     eq_(data['groups'], list(profile.groups.values_list('name', flat=True)))
     eq_(data['skills'], list(profile.skills.values_list('name', flat=True)))
     eq_(data['accounts'],
         [{'identifier': a.identifier, 'type': a.type}
          for a in profile.externalaccount_set.all()])
     eq_(data['bio'], profile.bio)
     eq_(data['photo'], profile.photo)
     eq_(data['ircname'], profile.ircname)
     eq_(data['country'], profile.geo_country.code)
     eq_(data['region'], profile.geo_region.name)
     eq_(data['city'], profile.geo_city.name)
     eq_(data['date_mozillian'], profile.date_mozillian)
     eq_(data['timezone'], profile.timezone)
     eq_(data['email'], profile.email)
     eq_(data['url'],
         absolutify(reverse('phonebook:profile_view',
                            args=[profile.user.username])))
Пример #9
0
 def test_get_detail_mozilla_app(self):
     client = Client()
     url = reverse(
         "api_dispatch_detail", kwargs={"api_name": "v1", "resource_name": "users", "pk": self.user.userprofile.id}
     )
     url = urlparams(url, app_name=self.mozilla_app.name, app_key=self.mozilla_app.key)
     response = client.get(url, follow=True)
     data = json.loads(response.content)
     profile = self.user.userprofile
     eq_(response.status_code, 200)
     eq_(data["id"], profile.id)
     eq_(data["full_name"], profile.full_name)
     eq_(data["is_vouched"], profile.is_vouched)
     eq_(data["vouched_by"], profile.vouched_by.id)
     # eq_(data['date_vouched'], profile.date_vouched)
     eq_(data["groups"], list(profile.groups.values_list("name", flat=True)))
     eq_(data["skills"], list(profile.skills.values_list("name", flat=True)))
     eq_(data["accounts"], [{"identifier": a.identifier, "type": a.type} for a in profile.externalaccount_set.all()])
     eq_(data["bio"], profile.bio)
     eq_(data["photo"], profile.photo)
     eq_(data["ircname"], profile.ircname)
     eq_(data["country"], profile.geo_country.code)
     eq_(data["region"], profile.geo_region.name)
     eq_(data["city"], profile.geo_city.name)
     eq_(data["date_mozillian"], profile.date_mozillian)
     eq_(data["timezone"], profile.timezone)
     eq_(data["email"], profile.email)
     eq_(data["url"], absolutify(reverse("phonebook:profile_view", args=[profile.user.username])))
Пример #10
0
def browserid_login(request):
    """Multi-mode BrowserID authentication form processor.

    Handles login and register browserid verification. If
    the mode is login, we are done. If the mode is register
    then we start new profile flow. Also handles corner cases.

    Login and register sasl-browserid verification steps are very similar
    and the corner cases blur the lines, so this is best as one
    url.

    We use the form from django-browserid, but since the LDAP server
    does the BrowserID auth behind the scenes, we don't use it's auth code
    nor it's views.
    """
    form = ModalBrowserIdForm(data=request.POST)
    if form.is_valid():
        assertion = form.cleaned_data['assertion']
        store_assertion(request, assertion)
        mode = form.cleaned_data['mode']
        user = auth.authenticate(request=request, assertion=assertion)
        if user:
            auth.login(request, user)
            return redirect('profile', request.user.unique_id)
        else:
            url = absolutify("%s?link=%s" % (reverse('register'), mode))
            return redirect(url)
    else:
        msg = _('Sorry, but there were problems with the info you submitted. '
                'Please review the form, correct any errors, and try again.')
        messages.warning(request, msg)
        log.warning("Form didn't validate %s" % str(request.POST))
        return redirect('home')
Пример #11
0
 def test_get_detail_mozilla_app(self):
     client = Client()
     url = reverse('api_dispatch_detail',
                   kwargs={'api_name': 'v1', 'resource_name': 'users',
                           'pk': self.user.userprofile.id})
     url = urlparams(url, app_name=self.mozilla_app.name,
                     app_key=self.mozilla_app.key)
     response = client.get(url, follow=True)
     data = json.loads(response.content)
     profile = self.user.userprofile
     eq_(response.status_code, 200)
     eq_(data['id'], unicode(profile.id))
     eq_(data['full_name'], profile.full_name)
     eq_(data['is_vouched'], profile.is_vouched)
     eq_(data['website'], profile.website)
     eq_(data['vouched_by'], profile.vouched_by.user.id)
     eq_(data['date_vouched'], profile.date_vouched)
     eq_(data['groups'], unicode(profile.groups.values_list('name')))
     eq_(data['skills'], unicode(profile.skills.values_list('name')))
     eq_(data['languages'], unicode(profile.languages.values_list('name')))
     eq_(data['bio'], profile.bio)
     eq_(data['photo'], profile.photo)
     eq_(data['ircname'], profile.ircname)
     eq_(data['country'], profile.country)
     eq_(data['region'], profile.region)
     eq_(data['city'], profile.city)
     eq_(data['date_mozillian'], profile.date_mozillian)
     eq_(data['timezone'], profile.timezone)
     eq_(data['tshirt'], profile.tshirt)
     eq_(data['email'], profile.email)
     eq_(data['url'],
         absolutify(reverse('phonebook:profile_view',
                            args=[profile.user.username])))
Пример #12
0
 def test_get_detail_mozilla_app(self):
     client = Client()
     url = reverse(
         "api_dispatch_detail", kwargs={"api_name": "v1", "resource_name": "users", "pk": self.user.userprofile.id}
     )
     url = urlparams(url, app_name=self.mozilla_app.name, app_key=self.mozilla_app.key)
     response = client.get(url, follow=True)
     data = json.loads(response.content)
     profile = self.user.userprofile
     eq_(response.status_code, 200)
     eq_(data["id"], unicode(profile.id))
     eq_(data["full_name"], profile.full_name)
     eq_(data["is_vouched"], profile.is_vouched)
     eq_(data["website"], profile.website)
     eq_(data["vouched_by"], profile.vouched_by.user.id)
     eq_(data["date_vouched"], profile.date_vouched)
     eq_(data["groups"], unicode(profile.groups.values_list("name")))
     eq_(data["skills"], unicode(profile.skills.values_list("name")))
     eq_(data["languages"], unicode(profile.languages.values_list("name")))
     eq_(data["bio"], profile.bio)
     eq_(data["photo"], profile.photo)
     eq_(data["ircname"], profile.ircname)
     eq_(data["country"], profile.country)
     eq_(data["region"], profile.region)
     eq_(data["city"], profile.city)
     eq_(data["date_mozillian"], profile.date_mozillian)
     eq_(data["timezone"], profile.timezone)
     eq_(data["email"], profile.email)
     eq_(data["url"], absolutify(reverse("phonebook:profile_view", args=[profile.user.username])))
Пример #13
0
 def test_get_detail_mozilla_app(self):
     client = Client()
     url = reverse('api_dispatch_detail',
                   kwargs={'api_name': 'v1', 'resource_name': 'users',
                           'pk': self.user.userprofile.id})
     url = urlparams(url, app_name=self.mozilla_app.name,
                     app_key=self.mozilla_app.key)
     response = client.get(url, follow=True)
     data = json.loads(response.content)
     profile = self.user.userprofile
     eq_(response.status_code, 200)
     eq_(data['id'], unicode(profile.id))
     eq_(data['full_name'], profile.full_name)
     eq_(data['is_vouched'], profile.is_vouched)
     eq_(data['website'], profile.website)
     eq_(data['vouched_by'], profile.vouched_by.user.id)
     eq_(data['date_vouched'], profile.date_vouched)
     eq_(data['groups'], list(profile.groups.values_list('name', flat=True)))
     eq_(data['skills'], list(profile.skills.values_list('name', flat=True)))
     eq_(data['languages'], list(profile.languages.values_list('name', flat=True)))
     eq_(data['bio'], profile.bio)
     eq_(data['photo'], profile.photo)
     eq_(data['ircname'], profile.ircname)
     eq_(data['country'], profile.country)
     eq_(data['region'], profile.region)
     eq_(data['city'], profile.city)
     eq_(data['date_mozillian'], profile.date_mozillian)
     eq_(data['timezone'], profile.timezone)
     eq_(data['email'], profile.email)
     eq_(data['url'],
         absolutify(reverse('phonebook:profile_view',
                            args=[profile.user.username])))
Пример #14
0
def gravatar(email, default=settings.DEFAULT_AVATAR_URL, size=175, rating='pg'):
    """Return the Gravatar URL for an email address."""

    return 'http://www.gravatar.com/avatar/%s?%s' % (
            hashlib.md5(email.lower()).hexdigest(),
            urllib.urlencode({'d': absolutify(default),
                              's': str(size),
                              'r': rating}))
Пример #15
0
def gravatar(email, default=settings.DEFAULT_AVATAR_URL, size=175, rating='pg'):
    """Return the Gravatar URL for an email address."""

    return 'https://secure.gravatar.com/avatar/%s?%s' % (
            hashlib.md5(email.lower()).hexdigest(),
            urllib.urlencode({'d': absolutify(default),
                              's': str(size),
                              'r': rating}))
Пример #16
0
def gravatar(email, default='%simg/unknown.png' % (settings.MEDIA_URL),
             size=175, rating='pg'):
    """Return the Gravatar URL for an email address."""

    return 'http://www.gravatar.com/avatar/%s?%s' % (
            hashlib.md5(email.lower()).hexdigest(),
            urllib.urlencode({'d': absolutify(default),
                              's': str(size),
                              'r': rating}))
Пример #17
0
    def _email_now_vouched(self):
        """Email this user, letting them know they are now vouched."""
        name = None
        profile_link = None
        if self.vouched_by:
            name = self.vouched_by.full_name
            profile_link = utils.absolutify(self.vouched_by.get_absolute_url())

        template = get_template('phonebook/vouched_confirmation_email.txt')
        message = template.render({
            'voucher_name': name,
            'voucher_profile_url': profile_link,
            'functional_areas_url': utils.absolutify(reverse('groups:index_functional_areas')),
            'groups_url': utils.absolutify(reverse('groups:index_groups')),
        })
        subject = _(u'You are now vouched on Mozillians.org')
        filtered_message = message.replace('"', '"').replace(''', "'")
        send_mail(subject, filtered_message, settings.FROM_NOREPLY,
                  [self.user.email])
Пример #18
0
 def test_get_list(self):
     UserFactory.create(userprofile={"is_vouched": False, "country": "gr"})
     client = Client()
     response = client.get(self.resource_url, follow=True)
     eq_(response.status_code, 200)
     data = json.loads(response.content)
     eq_(data["meta"]["total_count"], 1, "Unvouched users get listed!")
     eq_(data["objects"][0]["country"], "gr")
     eq_(data["objects"][0]["country_name"], "Greece")
     eq_(data["objects"][0]["population"], 1)
     eq_(data["objects"][0]["url"], absolutify(reverse("phonebook:list_country", args=["gr"])))
Пример #19
0
 def test_get_list(self):
     UserFactory.create(userprofile={'is_vouched': False, 'country': 'gr'})
     client = Client()
     response = client.get(self.resource_url, follow=True)
     eq_(response.status_code, 200)
     data = json.loads(response.content)
     eq_(data['meta']['total_count'], 1, 'Unvouched users get listed!')
     eq_(data['objects'][0]['country'], 'gr')
     eq_(data['objects'][0]['country_name'], 'Greece')
     eq_(data['objects'][0]['population'], 1)
     eq_(data['objects'][0]['url'],
         absolutify(reverse('phonebook:list_country', args=['gr'])))
Пример #20
0
 def test_get_list(self):
     UserFactory.create(userprofile={'is_vouched': False, 'country': 'gr'})
     client = Client()
     response = client.get(self.resource_url, follow=True)
     eq_(response.status_code, 200)
     data = json.loads(response.content)
     eq_(data['meta']['total_count'], 1, 'Unvouched users get listed!')
     eq_(data['objects'][0]['country'], 'gr')
     eq_(data['objects'][0]['country_name'], 'Greece')
     eq_(data['objects'][0]['population'], 1)
     eq_(data['objects'][0]['url'],
         absolutify(reverse('phonebook:list_country', args=['gr'])))
Пример #21
0
    def send_thanks(self):
        """Sends email to person who friend accepted invitation."""
        template = get_template('phonebook/invite_accepted.txt')
        subject = _('%s created a Mozillians profile' % self.redeemer.full_name)
        message = template.render({
            'inviter' : self.inviter.full_name,
            'friend' : self.redeemer.full_name,
            'profile' : absolutify(reverse('profile', args=(self.redeemer.user,)))})        
        filtered_message = message.replace('"', '"').replace(''',"'")

        send_mail(subject, filtered_message, settings.FROM_NOREPLY,
            [self.inviter.email])
Пример #22
0
    def send_thanks(self):
        """Sends email to person who friend accepted invitation."""
        template = get_template('phonebook/invite_accepted.txt')
        subject = _('%s created a Mozillians profile' % self.redeemer.full_name)
        message = template.render({
            'inviter' : self.inviter.full_name,
            'friend' : self.redeemer.full_name,
            'profile' : absolutify(reverse('profile', args=(self.redeemer.user,)))})
        filtered_message = message.replace('"', '"').replace(''',"'")

        send_mail(subject, filtered_message, settings.FROM_NOREPLY,
            [self.inviter.email])
Пример #23
0
    def test_list_groups(self):
        user = UserFactory.create()
        group = GroupFactory.create()
        group.add_member(user.userprofile)

        client = Client()
        response = client.get(self.resource_url, follow=True)
        data = json.loads(response.content)
        eq_(data["meta"]["total_count"], 1)
        eq_(data["objects"][0]["name"], group.name)
        eq_(data["objects"][0]["number_of_members"], 1)
        eq_(int(data["objects"][0]["id"]), group.id)
        eq_(data["objects"][0]["url"], absolutify(reverse("groups:show_group", args=[group.url])))
Пример #24
0
    def test_list_groups(self):
        user = UserFactory.create()
        group = GroupFactory.create()
        group.add_member(user.userprofile)

        client = Client()
        response = client.get(self.resource_url, follow=True)
        data = json.loads(response.content)
        eq_(data['meta']['total_count'], 1)
        eq_(data['objects'][0]['name'], group.name)
        eq_(data['objects'][0]['number_of_members'], 1)
        eq_(int(data['objects'][0]['id']), group.id)
        eq_(data['objects'][0]['url'],
            absolutify(reverse('groups:show_group', args=[group.url])))
Пример #25
0
    def _email_now_vouched(self):
        """Email this user, letting them know they are now vouched."""
        name = None
        profile_link = None
        if self.vouched_by:
            name = self.vouched_by.full_name
            profile_link = utils.absolutify(self.vouched_by.get_absolute_url())

        template = get_template('phonebook/vouched_confirmation_email.txt')
        message = template.render({
            'voucher_name': name,
            'voucher_profile_url': profile_link
        })
        subject = _(u'You are now vouched on Mozillians.org')
        filtered_message = message.replace('"', '"').replace(''', "'")
        send_mail(subject, filtered_message, settings.FROM_NOREPLY,
                  [self.user.email])
Пример #26
0
    def test_list_groups(self):
        unvouched_user = UserFactory.create()
        user = UserFactory.create(userprofile={'is_vouched': True})
        group = Group.objects.get(name='staff')
        group.members.add(unvouched_user.userprofile)
        group.members.add(user.userprofile)

        client = Client()
        response = client.get(self.resource_url, follow=True)
        data = json.loads(response.content)
        eq_(data['meta']['total_count'], 1)
        eq_(data['objects'][0]['name'], group.name)

        eq_(data['objects'][0]['number_of_members'], 1,
            'List includes unvouched users')
        eq_(int(data['objects'][0]['id']), group.id)
        eq_(data['objects'][0]['url'],
            absolutify(reverse('groups:show_group', args=[group.url])))
Пример #27
0
    def test_list_groups(self):
        unvouched_user = UserFactory.create()
        user = UserFactory.create(userprofile={'is_vouched': True})
        group = Group.objects.get(name='staff')
        group.members.add(unvouched_user.userprofile)
        group.members.add(user.userprofile)

        client = Client()
        response = client.get(self.resource_url, follow=True)
        data = json.loads(response.content)
        eq_(data['meta']['total_count'], 1)
        eq_(data['objects'][0]['name'], group.name)

        eq_(data['objects'][0]['number_of_members'], 1,
            'List includes unvouched users')
        eq_(int(data['objects'][0]['id']), group.id)
        eq_(data['objects'][0]['url'],
            absolutify(reverse('groups:show', args=[group.url])))
Пример #28
0
 def get_url(self, absolute=True):
     """A url that can be used to redeem this invite."""
     return absolutify(urlparams(reverse("phonebook:register"), code=self.code))
Пример #29
0
 def dehydrate_url(self, bundle):
     url = reverse('phonebook:profile_view',
                   args=[bundle.obj.user.username])
     return utils.absolutify(url)
Пример #30
0
 def get_confirmation_url(self):
     url = (absolutify(reverse('confirm')) + '?code=' +
            self.confirmation_code)
     return url
Пример #31
0
def absolutify(url):
    """Prepend the SITE_URL to the url."""
    return utils.absolutify(url)
Пример #32
0
 def test_https(self):
     url = absolutify(AbsolutifyTests.ABS_PATH)
     eq_('https://test.mo.com/some/absolute/path', url)
Пример #33
0
def absolutify(url):
    return utils.absolutify(url)
Пример #34
0
 def get_url(self, absolute=True):
     """A url that can be used to redeem this invite."""
     return absolutify(reverse('register')) + '?code=' + self.code
Пример #35
0
 def test_with_port(self):
     url = utils.absolutify(AbsolutifyTests.ABS_PATH)
     eq_('http://test.mo.com:8009/some/absolute/path', url)
Пример #36
0
 def test_https(self):
     url = utils.absolutify(AbsolutifyTests.ABS_PATH)
     eq_('%s/some/absolute/path' % settings.SITE_URL, url)
Пример #37
0
 def get_url(self, absolute=True):
     """A url that can be used to redeem this invite."""
     return absolutify(
         urlparams(reverse('phonebook:register'), code=self.code))
Пример #38
0
 def _sasl_bind(self, assertion):
     """Binds to LDAP using sasl and BrowserID credentials."""
     audience = absolutify('')
     sasl_creds = browserid.Credentials(assertion, audience)
     self.conn.sasl_interactive_bind_s('', sasl_creds)
Пример #39
0
    def send_thanks(self):
        """Sends email to person who friend accepted invitation."""
        template = get_template("phonebook/invite_accepted.txt")
        subject = _("%s created a Mozillians profile" % self.redeemer.full_name)
        profile_url = reverse("phonebook:profile_view", kwargs={"username": self.redeemer.user.username})
        message = template.render(
            {"inviter": self.inviter.full_name, "friend": self.redeemer.full_name, "profile": absolutify(profile_url)}
        )
        filtered_message = message.replace(""", '"').replace("'", "'")

        send_mail(subject, filtered_message, settings.FROM_NOREPLY, [self.inviter.email])
Пример #40
0
 def dehydrate_url(self, bundle):
     url = reverse('groups:show_group', args=[bundle.obj.url])
     return utils.absolutify(url)
Пример #41
0
 def dehydrate_url(self, bundle):
     url = reverse("phonebook:list_city", args=[bundle.obj.country, bundle.obj.city])
     return utils.absolutify(url)
Пример #42
0
 def get_absolute_url(self):
     return absolutify(reverse('groups:show_group', args=[self.url]))
Пример #43
0
 def dehydrate_url(self, bundle):
     url = reverse('phonebook:list_city',
                   args=[bundle.obj.country, bundle.obj.city])
     return utils.absolutify(url)
Пример #44
0
def absolutify(url):
    """Prepend the SITE_URL to the url."""
    return utils.absolutify(url)
Пример #45
0
 def get_confirmation_url(self):
     url = (absolutify(reverse('confirm')) + '?code=' +
            self.confirmation_code)
     return url
Пример #46
0
 def get_absolute_url(self):
     return absolutify(reverse('groups:show_group', args=[self.url]))
Пример #47
0
 def dehydrate_url(self, bundle):
     url = reverse('groups:show_group', args=[bundle.obj.url])
     return utils.absolutify(url)
Пример #48
0
 def get_url(self, absolute=True):
     """A url that can be used to redeem this invite."""
     return absolutify(reverse('register')) + '?code=' + self.code
Пример #49
0
 def get_url(self, absolute=True):
     return absolutify(reverse('register')) + '?code=' + self.code
Пример #50
0
 def dehydrate_url(self, bundle):
     url = reverse("phonebook:profile_view", args=[bundle.obj.user.username])
     return utils.absolutify(url)
Пример #51
0
def absolutify(url):
    return utils.absolutify(url)