[PATCH] hgwebdir: do not show RSS and Atom links for plain directories

Angel Ezquerra angel.ezquerra at gmail.com
Fri Jul 27 14:30:24 CDT 2012


On Fri, Jul 27, 2012 at 8:56 PM, Matt Mackall <mpm at selenic.com> wrote:
> On Fri, 2012-07-27 at 20:09 +0200, Angel Ezquerra wrote:
>> On Fri, Jul 27, 2012 at 7:06 PM, Matt Mackall <mpm at selenic.com> wrote:
>> > On Thu, 2012-07-26 at 00:19 +0200, Angel Ezquerra wrote:
>> >> On Thu, Jul 26, 2012 at 12:16 AM, Angel Ezquerra
>> >> <angel.ezquerra at gmail.com> wrote:
>> >> > # HG changeset patch
>> >> > # User Angel Ezquerra <angel.ezquerra at gmail.com>
>> >> > # Date 1343254355 -7200
>> >> > # Branch stable
>> >> > # Node ID dd7906475a607fc720b5716ef9b685e62f921693
>> >> > # Parent bf5bb38bcc7c28f7a355fdfff323aba2018cbb17
>> >> > hgwebdir: do not show RSS and Atom links for plain directories
>> >> >
>> >> > Up until now the templates that show RSS and Atom feeds on the
>> "repository
>> >> > lists" (i.e. gitweb and monoblue) showed them for all entries,
>> including regular
>> >> > folders. Clicking on those "folder RSS" links would result in an
>> error page
>> >> > being shown.
>> >> >
>> >> > This patch hides those links for regular folders.
>> >>
>> >> I think this is a bug since invalid links are shown by the web
>> server.
>> >> If this is not deemed fit for stable I can resend it after the
>> freeze.
>> >
>> > The right way to fix this is to finish adding conditionals to the
>> > templater.
>>
>> Yes, my solution was a bit hackish  :-)
>>
>> Is there a templater conditional syntax that has been agreed upon?
>
> { if(expr1, expr2, [expr3]) }
>
> If expr1 evaluates to a non-empty result, we should return expr2,
> otherwise expr3.
>
> We'll probably want a compare operation so we can do things like check
> against nullid and the like.

Does that mean that expr1 will not be an arbitrary python expression?
If not how should template variables be referred to within the
conditional expression?

For example, for the patch I sent, is this what you have in mind?

{ if(isrepo, <a href="{url}rss-log">RSS</a> <a href="{url}atom-log">Atom</a>) }

where isrepo would be a boolean passed to the templater?


Angel


More information about the Mercurial-devel mailing list