Exemplo n.º 1
0
def editor_page_title(context, title=None, addon=None):
    """Wrapper for editor page titles.  Eerily similar to dev_page_title."""
    if addon:
        title = u'%s :: %s' % (title, addon.name)
    else:
        section = _lazy('Editor Tools')
        title = u'%s :: %s' % (title, section) if title else section
    return page_title(context, title)
Exemplo n.º 2
0
def dev_page_title(context, title=None, addon=None):
    """Wrapper for devhub page titles."""
    if addon:
        title = u'%s :: %s' % (title, addon.name)
    else:
        devhub = _('Developer Hub')
        title = '%s :: %s' % (title, devhub) if title else devhub
    return page_title(context, title)
Exemplo n.º 3
0
def editor_page_title(context, title=None, addon=None):
    """Wrapper for editor page titles.  Eerily similar to dev_page_title."""
    if addon:
        title = u'%s :: %s' % (title, addon.name)
    else:
        section = _lazy('Editor Tools')
        title = u'%s :: %s' % (title, section) if title else section
    return page_title(context, title)
Exemplo n.º 4
0
def editor_page_title(context, title=None, addon=None):
    """Wrapper for editor page titles.  Eerily similar to dev_page_title."""
    if addon:
        title = u'%s :: %s' % (title, addon.name)
    else:
        devhub = _('Editor Tools')
        title = '%s :: %s' % (title, devhub) if title else devhub
    return page_title(context, title)
Exemplo n.º 5
0
def dev_page_title(context, title=None, addon=None):
    """Wrapper for devhub page titles."""
    if addon:
        title = u'%s :: %s' % (title, addon.name)
    else:
        devhub = _('Developer Hub')
        title = '%s :: %s' % (title, devhub) if title else devhub
    return page_title(context, title)
Exemplo n.º 6
0
 def test_redirect_sharing(self):
     r = self.client.get(reverse('apps.share', args=['yeah']),
                         {'service': 'delicious'})
     d = {
         'title': page_title({'request': r}, self.webapp.name,
                             force_webapps=True),
         'description': truncate(self.webapp.summary, length=250),
         'url': absolutify(self.webapp.get_url_path()),
     }
     url = iri_to_uri(get_service('delicious').url.format(**d))
     self.assertRedirects(r, url, status_code=302, target_status_code=301)
Exemplo n.º 7
0
def share(request, obj, name, description):
    try:
        service = sharing.SERVICES[request.GET['service']]
    except KeyError:
        raise http.Http404()
    d = {
        'title': page_title({'request': request}, name),
        'description': u(description),
        'url': absolutify(u(obj.get_url_path())),
    }
    return redirect(service.url.format(**d))
Exemplo n.º 8
0
 def test_redirect_sharing(self):
     r = self.client.get(reverse('apps.share', args=['yeah']),
                         {'service': 'delicious'})
     d = {
         'title': page_title({'request': r}, self.webapp.name,
                             force_webapps=True),
         'description': truncate(self.webapp.summary, length=250),
         'url': absolutify(self.webapp.get_url_path()),
     }
     url = iri_to_uri(get_service('delicious').url.format(**d))
     self.assertRedirects(r, url, status_code=302, target_status_code=301)
Exemplo n.º 9
0
def share(request, obj, name, description):
    try:
        service = SERVICES[request.GET['service']]
    except KeyError:
        raise http.Http404()
    is_webapp = hasattr(obj, 'is_webapp') and obj.is_webapp()

    form = ShareForm({
        'title': page_title({'request': request}, name,
                            force_webapps=is_webapp),
        'url': u(obj.get_url_path()),
        'description': description,
    })
    form.full_clean()
    return redirect(service.url.format(**form.cleaned_data))
Exemplo n.º 10
0
def share(request, obj, name, description):
    try:
        service = get_service(request.GET['service'])
    except KeyError:
        raise http.Http404()

    if not service:
        raise http.Http404()

    form = ShareForm({
        'title': page_title({'request': request}, name),
        'url': u(obj.get_url_path()),
        'description': description,
    })
    form.full_clean()
    return http.HttpResponseRedirect(service.url.format(**form.cleaned_data))
Exemplo n.º 11
0
def share(request, obj, name, description):
    try:
        service = SERVICES[request.GET['service']]
    except KeyError:
        raise http.Http404()
    is_webapp = hasattr(obj, 'is_webapp') and obj.is_webapp()

    form = ShareForm({
        'title':
        page_title({'request': request}, name, force_webapps=is_webapp),
        'url':
        u(obj.get_url_path()),
        'description':
        description,
    })
    form.full_clean()
    return redirect(service.url.format(**form.cleaned_data))
Exemplo n.º 12
0
def docs_page_title(context, title=None):
    """Wrapper for docs page titles."""
    devhub = _('Add-on Documentation :: Developer Hub')
    title = '%s :: %s' % (title, devhub) if title else devhub
    return page_title(context, title)
Exemplo n.º 13
0
def docs_page_title(context, title=None):
    """Wrapper for docs page titles."""
    devhub = _('Add-on Documentation :: Developer Hub')
    title = '%s :: %s' % (title, devhub) if title else devhub
    return page_title(context, title)