Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/hgweb.py @ 1406:34cb3957d875
hgweb: allow urls to be shorter by using shortcuts
for example cs=xxx will be expanded to cmd=changeset;node=xxx
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Tue, 18 Oct 2005 20:06:34 -0700 |
parents | 9d2c2e6b32b5 |
children | db571bcaa35d |
comparison
equal
deleted
inserted
replaced
1405:6fd6527f95eb | 1406:34cb3957d875 |
---|---|
702 def header(**map): | 702 def header(**map): |
703 yield self.t("header", **map) | 703 yield self.t("header", **map) |
704 | 704 |
705 def footer(**map): | 705 def footer(**map): |
706 yield self.t("footer", **map) | 706 yield self.t("footer", **map) |
707 | |
708 def expand_form(form): | |
709 shortcuts = { | |
710 'cs': [('cmd', ['changeset']), ('node', None)], | |
711 } | |
712 for k in shortcuts.iterkeys(): | |
713 if form.has_key(k): | |
714 for name, value in shortcuts[k]: | |
715 if value is None: | |
716 value = form[k] | |
717 form[name] = value | |
718 del form[k] | |
707 | 719 |
708 self.refresh() | 720 self.refresh() |
721 | |
722 expand_form(req.form) | |
709 | 723 |
710 t = self.repo.ui.config("web", "templates", templatepath()) | 724 t = self.repo.ui.config("web", "templates", templatepath()) |
711 m = os.path.join(t, "map") | 725 m = os.path.join(t, "map") |
712 style = self.repo.ui.config("web", "style", "") | 726 style = self.repo.ui.config("web", "style", "") |
713 if req.form.has_key('style'): | 727 if req.form.has_key('style'): |