Esempio n. 1
0
def url(selection, member=None, format='html', selection_page=False, **kwargs):
    if member is None and format == 'html' and not selection_page:
        anchor = "selection_%s" % selection.id
        return proposal.url(selection.proposal, anchor=anchor)
    url = proposal.url(selection.proposal, member='implementation')
    url += "/" + str(selection.id)
    return _url.append_member_and_format(url, member=member, format=format,
                                         **kwargs)
Esempio n. 2
0
def url(text, **kwargs):
    import page_helper as page
    if text is None:
        return ''
    in_context = (text == text.page.variant_head(text.variant))
    url = page.url(text.page, in_context=in_context)
    if text.page.has_variants and text.variant != text.HEAD:
        url += u'/' + urllib.quote(text.variant.encode('utf-8'))
    if text != text.page.variant_head(text.variant):
        url += u';' + str(text.id)
    return _url.append_member_and_format(url, **kwargs)
Esempio n. 3
0
def url(text, **kwargs):
    import page_helper as page
    if text is None:
        return ''
    in_context = (text == text.page.variant_head(text.variant))
    url = page.url(text.page, in_context=in_context)
    if text.page.has_variants and text.variant != text.HEAD:
        url += u'/' + urllib.quote(text.variant.encode('utf-8'))
    if text != text.page.variant_head(text.variant):
        url += u';' + str(text.id)
    return _url.append_member_and_format(url, **kwargs)
Esempio n. 4
0
 def test_append_member_and_format_full(self):
     from adhocracy.lib.helpers.url import append_member_and_format
     appended = append_member_and_format(u'http://base-url/existing',
                                         member='new',
                                         format='html')
     self.assertEqual(appended, u'http://base-url/existing/new.html')
Esempio n. 5
0
 def test_append_member_and_format_format_is_lowercased(self):
     from adhocracy.lib.helpers.url import append_member_and_format
     appended = append_member_and_format(u'http://base-url/existing',
                                         format='HTML')
     self.assertEqual(appended, u'http://base-url/existing.html')
Esempio n. 6
0
 def test_append_member_and_format_full(self):
     from adhocracy.lib.helpers.url import append_member_and_format
     appended = append_member_and_format(u'http://base-url/existing',
                                         member='new', format='html')
     self.assertEqual(appended, u'http://base-url/existing/new.html')
Esempio n. 7
0
 def test_append_member_and_format_format_is_lowercased(self):
     from adhocracy.lib.helpers.url import append_member_and_format
     appended = append_member_and_format(u'http://base-url/existing',
                                         format='HTML')
     self.assertEqual(appended, u'http://base-url/existing.html')