Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Replace join_urls with new url_join

  • Loading branch information...
commit 60e6088839005b6b3f646d149d21d71392813d22 1 parent f092a84
k21 authored January 09, 2012
14  r2/r2/lib/template_helpers.py
@@ -391,20 +391,6 @@ def add_sr(path, sr_path = True, nocname=False, force_hostname = False, retain_e
391 391
 
392 392
     return u.unparse()
393 393
 
394  
-def join_urls(*urls):
395  
-    """joins a series of urls together without doubles slashes"""
396  
-    if not urls:
397  
-        return
398  
-    
399  
-    url = urls[0]
400  
-    for u in urls[1:]:
401  
-        if not url.endswith('/'):
402  
-            url += '/'
403  
-        while u.startswith('/'):
404  
-            u = utils.lstrips(u, '/')
405  
-        url += u
406  
-    return url
407  
-
408 394
 def style_line(button_width = None, bgcolor = "", bordercolor = ""):
409 395
     style_line = ''
410 396
     bordercolor = c.bordercolor or bordercolor
4  r2/r2/templates/cnameframe.html
@@ -21,7 +21,7 @@
21 21
 ################################################################################
22 22
 
23 23
 <%!
24  
-   from r2.lib.template_helpers import join_urls
  24
+   from r2.lib.utils import url_join
25 25
 %>
26 26
 
27 27
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@@ -33,7 +33,7 @@
33 33
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
34 34
     %if thing.original_path:
35 35
       <link rel="alternate" type="application/rss+xml" title="RSS"
36  
-            href="${join_urls(thing.original_path,'.rss')}" />
  36
+            href="${url_join(thing.original_path,'.rss')}" />
37 37
     %endif
38 38
     
39 39
   </head>
5  r2/r2/templates/reddit.html
@@ -21,12 +21,13 @@
21 21
 ################################################################################
22 22
 
23 23
 <%! 
24  
-   from r2.lib.template_helpers import add_sr, static, join_urls, class_dict, get_domain
  24
+   from r2.lib.template_helpers import add_sr, static, class_dict, get_domain
25 25
    from r2.lib.filters import unsafe
26 26
    from r2.lib.pages import SearchForm, ClickGadget, SideContentBox
27 27
    from r2.lib import tracking
28 28
    from pylons import request
29 29
    from r2.lib.strings import strings
  30
+   from r2.lib.utils import url_join
30 31
    from r2.models import make_feedurl, Sub
31 32
 %>
32 33
 <%namespace file="login.html" import="login_panel, login_form"/>
@@ -91,7 +92,7 @@
91 92
         type="image/x-icon" />
92 93
   %if thing.extension_handling:
93 94
     <%
94  
-       rss= add_sr(join_urls(request.path,'.rss'))
  95
+       rss= add_sr(url_join(request.path,'.rss'))
95 96
        if thing.extension_handling == "private":
96 97
           rss = make_feedurl(c.user, rss)
97 98
      %>

0 notes on commit 60e6088

Please sign in to comment.
Something went wrong with that request. Please try again.