Re: Two small patches for the News section of the website

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: "Andreas 'ads' Scherbaum" <ads(at)pgug(dot)de>
Cc: PostgreSQL www <pgsql-www(at)postgresql(dot)org>
Subject: Re: Two small patches for the News section of the website
Date: 2021-01-04 13:48:08
Message-ID: CABUevExS_4K--ET11NPa35s4e4OJK1dXRMObJi6vPJ3xAX9KSg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-www

On Mon, Jan 4, 2021 at 2:46 PM Magnus Hagander <magnus(at)hagander(dot)net> wrote:
>
> On Wed, Dec 30, 2020 at 9:59 PM Andreas 'ads' Scherbaum <ads(at)pgug(dot)de> wrote:
> >
> > On 28/12/2020 17:31, Andreas 'ads' Scherbaum wrote:
> > >
> > > Hello,
> > >
> > > the attached patches propose the following changes:
> > >
> > >
> > > account_views.patch:
> > >
> > > This modifies the https://www.postgresql.org/account/ website, and
> > > shows "Items not submitted yet" and "Items waiting for moderator
> > > approval" only when there is actual content. Empty boxes are not shown.
> > >
> > >
> > > objectlist.patch:
> > >
> > > This updates https://www.postgresql.org/account/edit/news/ , fixes a
> > > missing </p>, and separates the "Submit for moderation" link from the
> > > item link to make it clear that these are two different things.
> > > It also updates the description above the items, and adds a note that
> > > items must be submitted, if there are items.
> > >
> > >
> > > Both patches are untested, as I couldn't get the pgweb working locally.
> >
> > Magnus pointed out that there is a syntax problem with one of the patches.
> > New version attached.
>
> I've applied an adapted version of the first one of these:
> * Fixed indentation. Please run the "pep8" command on the python code
> as part of your tests-before-submission. We need to document this
> somewhere, or direct people towards maknig PRs (currently turned off)
> which will validate it for them :)
> * Fixed incorrect removal of the dict passed to render -- you can't
> pass an array there, it still has to be the dict with a key.
> * The canonical way to check if an array is empty is not "if
> len(array)>0" in python, it's just "if array:". No need to compute the
> whole length just to know if it's empty.
> * I renamed the arrays to have plural names. It's really confusing to
> have singular names for something that contains multiple objects.
>
> And after second found:
> * The whole code becomes easier if we just leave the list of waiting
> and created in arrays, rather than break them out into separate
> variables and later put them back into another array
>
> Ḯ've attached a v3 of the patch with "-w" just to show how little
> change was actually needed after doing that :) (it could be done fully
> inline as well, but keeping it as a separate variable is probably a
> bit more future proof)

And again, with actual attachment.

Thanks!

--
Magnus Hagander
Me: https://www.hagander.net/
Work: https://www.redpill-linpro.com/

Attachment Content-Type Size
account_views_3.patch text/x-patch 764 bytes

In response to

Browse pgsql-www by date

  From Date Subject
Next Message Andreas 'ads' Scherbaum 2021-01-04 15:16:26 Re: Two small patches for the News section of the website
Previous Message Magnus Hagander 2021-01-04 13:46:40 Re: Two small patches for the News section of the website