Patchwork hgweb: remove now unnecessary explicit header() and footer()

login
register
mail settings
Submitter Alexander Plavin
Date Oct. 12, 2013, 7:41 a.m.
Message ID <33338355d60477bfe550.1381563688@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/2752/
State Accepted
Commit 1dba26575dba49be8d7d2e6589c227419cfd1895
Headers show

Comments

Alexander Plavin - Oct. 12, 2013, 7:41 a.m.
# HG changeset patch
# User Alexander Plavin <alexander@plav.in>
# Date 1374621626 -14400
#      Wed Jul 24 03:20:26 2013 +0400
# Node ID 33338355d60477bfe550d4bf8be6be1b31b4f5de
# Parent  b93f0106ee2d60c2537b04dc52b502d99e4d05ba
hgweb: remove now unnecessary explicit header() and footer()

They became unnecessary after allowing custom-named entries in templates.
Augie Fackler - Oct. 16, 2013, 2:27 p.m.
On Sat, Oct 12, 2013 at 11:41:28AM +0400, Alexander Plavin wrote:
> # HG changeset patch
> # User Alexander Plavin <alexander@plav.in>
> # Date 1374621626 -14400
> #      Wed Jul 24 03:20:26 2013 +0400
> # Node ID 33338355d60477bfe550d4bf8be6be1b31b4f5de
> # Parent  b93f0106ee2d60c2537b04dc52b502d99e4d05ba
> hgweb: remove now unnecessary explicit header() and footer()

Looks like mpm already queued this one.

>
> They became unnecessary after allowing custom-named entries in templates.
>
> diff -r b93f0106ee2d -r 33338355d604 mercurial/hgweb/hgweb_mod.py
> --- a/mercurial/hgweb/hgweb_mod.py	Sun Sep 01 10:40:11 2013 +0400
> +++ b/mercurial/hgweb/hgweb_mod.py	Wed Jul 24 03:20:26 2013 +0400
> @@ -331,12 +331,6 @@
>
>          # some functions for the templater
>
> -        def header(**map):
> -            yield tmpl('header', encoding=encoding.encoding, **map)
> -
> -        def footer(**map):
> -            yield tmpl("footer", **map)
> -
>          def motd(**map):
>              yield self.config("web", "motd", "")
>
> @@ -373,8 +367,7 @@
>                                               "staticurl": staticurl,
>                                               "urlbase": urlbase,
>                                               "repo": self.reponame,
> -                                             "header": header,
> -                                             "footer": footer,
> +                                             "encoding": encoding.encoding,
>                                               "motd": motd,
>                                               "sessionvars": sessionvars,
>                                               "pathdef": makebreadcrumb(req.url),
> diff -r b93f0106ee2d -r 33338355d604 mercurial/hgweb/hgwebdir_mod.py
> --- a/mercurial/hgweb/hgwebdir_mod.py	Sun Sep 01 10:40:11 2013 +0400
> +++ b/mercurial/hgweb/hgwebdir_mod.py	Wed Jul 24 03:20:26 2013 +0400
> @@ -408,12 +408,6 @@
>
>      def templater(self, req):
>
> -        def header(**map):
> -            yield tmpl('header', encoding=encoding.encoding, **map)
> -
> -        def footer(**map):
> -            yield tmpl("footer", **map)
> -
>          def motd(**map):
>              if self.motd is not None:
>                  yield self.motd
> @@ -448,8 +442,7 @@
>              staticurl += '/'
>
>          tmpl = templater.templater(mapfile,
> -                                   defaults={"header": header,
> -                                             "footer": footer,
> +                                   defaults={"encoding": encoding.encoding,
>                                               "motd": motd,
>                                               "url": url,
>                                               "logourl": logourl,
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff -r b93f0106ee2d -r 33338355d604 mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Sun Sep 01 10:40:11 2013 +0400
+++ b/mercurial/hgweb/hgweb_mod.py	Wed Jul 24 03:20:26 2013 +0400
@@ -331,12 +331,6 @@ 
 
         # some functions for the templater
 
-        def header(**map):
-            yield tmpl('header', encoding=encoding.encoding, **map)
-
-        def footer(**map):
-            yield tmpl("footer", **map)
-
         def motd(**map):
             yield self.config("web", "motd", "")
 
@@ -373,8 +367,7 @@ 
                                              "staticurl": staticurl,
                                              "urlbase": urlbase,
                                              "repo": self.reponame,
-                                             "header": header,
-                                             "footer": footer,
+                                             "encoding": encoding.encoding,
                                              "motd": motd,
                                              "sessionvars": sessionvars,
                                              "pathdef": makebreadcrumb(req.url),
diff -r b93f0106ee2d -r 33338355d604 mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py	Sun Sep 01 10:40:11 2013 +0400
+++ b/mercurial/hgweb/hgwebdir_mod.py	Wed Jul 24 03:20:26 2013 +0400
@@ -408,12 +408,6 @@ 
 
     def templater(self, req):
 
-        def header(**map):
-            yield tmpl('header', encoding=encoding.encoding, **map)
-
-        def footer(**map):
-            yield tmpl("footer", **map)
-
         def motd(**map):
             if self.motd is not None:
                 yield self.motd
@@ -448,8 +442,7 @@ 
             staticurl += '/'
 
         tmpl = templater.templater(mapfile,
-                                   defaults={"header": header,
-                                             "footer": footer,
+                                   defaults={"encoding": encoding.encoding,
                                              "motd": motd,
                                              "url": url,
                                              "logourl": logourl,