Show More
@@ -1010,8 +1010,10 b' class hgwebdir(object):' | |||
|
1010 | 1010 | return [(name.strip(os.sep), path) for name, path in items] |
|
1011 | 1011 | |
|
1012 | 1012 | self.motd = "" |
|
1013 | self.repos_sorted = ('name', False) | |
|
1013 | 1014 | if isinstance(config, (list, tuple)): |
|
1014 | 1015 | self.repos = cleannames(config) |
|
1016 | self.repos_sorted = ('', False) | |
|
1015 | 1017 | elif isinstance(config, dict): |
|
1016 | 1018 | self.repos = cleannames(config.items()) |
|
1017 | 1019 | self.repos.sort() |
@@ -1078,14 +1080,15 b' class hgwebdir(object):' | |||
|
1078 | 1080 | row = dict(contact=contact or "unknown", |
|
1079 | 1081 | contact_sort=contact.upper() or "unknown", |
|
1080 | 1082 | name=name, |
|
1081 |
name_sort=name |
|
|
1083 | name_sort=name, | |
|
1082 | 1084 | url=url, |
|
1083 | 1085 | description=description or "unknown", |
|
1084 | 1086 | description_sort=description.upper() or "unknown", |
|
1085 | 1087 | lastchange=d, |
|
1086 | 1088 | lastchange_sort=d[1]-d[0], |
|
1087 | 1089 | archives=archivelist(u, "tip", url)) |
|
1088 |
if not sortcolumn |
|
|
1090 | if (not sortcolumn | |
|
1091 | or (sortcolumn, descending) == self.repos_sorted): | |
|
1089 | 1092 | # fast path for unsorted output |
|
1090 | 1093 | row['parity'] = parity |
|
1091 | 1094 | parity = 1 - parity |
@@ -1121,14 +1124,14 b' class hgwebdir(object):' | |||
|
1121 | 1124 | or tmpl("error", error="%r not found" % fname)) |
|
1122 | 1125 | else: |
|
1123 | 1126 | sortable = ["name", "description", "contact", "lastchange"] |
|
1124 |
sortcolumn = |
|
|
1127 | sortcolumn, descending = self.repos_sorted | |
|
1125 | 1128 | if req.form.has_key('sort'): |
|
1126 | 1129 | sortcolumn = req.form['sort'][0] |
|
1127 | descending = sortcolumn.startswith('-') | |
|
1128 | if descending: | |
|
1129 | sortcolumn = sortcolumn[1:] | |
|
1130 | if sortcolumn not in sortable: | |
|
1131 | sortcolumn = "" | |
|
1130 | descending = sortcolumn.startswith('-') | |
|
1131 | if descending: | |
|
1132 | sortcolumn = sortcolumn[1:] | |
|
1133 | if sortcolumn not in sortable: | |
|
1134 | sortcolumn = "" | |
|
1132 | 1135 | |
|
1133 | 1136 | sort = [("sort_%s" % column, |
|
1134 | 1137 | "%s%s" % ((not descending and column == sortcolumn) |
General Comments 0
You need to be logged in to leave comments.
Login now