Support repos with semi-strange characters.
Sun Jul 3 21:39:57 UTC 2005 Alberto Bertogli <albertogli@telpin.com.ar>
* Support repos with semi-strange characters.
Implement support for repo names with semi-strange characters (ie. at least -
and _). It could use more improvement, but it'll do for most repos.
{
hunk ./darcsweb.cgi 18
+import urllib
hunk ./darcsweb.cgi 1122
-<td><a class="list" href="%(myname)s?r=%(name)s;a=summary">%(name)s</a></td>
+<td><a class="list" href="%(myname)s?r=%(name)s;a=summary">%(dname)s</a></td>
hunk ./darcsweb.cgi 1132
- 'name': name,
+ 'dname': name,
+ 'name': urllib.quote(name),
hunk ./darcsweb.cgi 1151
- raise
+ raise "RepoNotFound", name
hunk ./darcsweb.cgi 1156
- config.myreponame = base.myname + '?r=' + name
+ config.myreponame = base.myname + '?r=' + urllib.quote(name)
hunk ./darcsweb.cgi 1180
-current_repo = form['r'].value
+current_repo = urllib.unquote(form['r'].value)
hunk ./mkconfig.py 29
+import string
+import urllib
hunk ./mkconfig.py 36
+
+def filter_class(s):
+ "Filter s so the new string can be used as a class name."
+ allowed = string.ascii_letters + string.digits + '_'
+ l = [c for c in s if c in allowed]
+ return string.join(l, "")
+
+def filter_url(s):
+ "Filter s so the new string can be used in a raw url."
+ return urllib.quote_plus(s, ':/')
hunk ./mkconfig.py 63
-class %(name)s:
+class %(classname)s:
hunk ./mkconfig.py 70
+ 'classname': filter_class(d),
hunk ./mkconfig.py 74
- 'url': baseurl.replace('NAME', d),
+ 'url': filter_url(baseurl.replace('NAME', d)),
}