Re: Two small patches for the News section of the website
От | Andreas 'ads' Scherbaum |
---|---|
Тема | Re: Two small patches for the News section of the website |
Дата | |
Msg-id | 1320fb56-f8c7-bd43-a0b8-e1b14e2ec463@pgug.de обсуждение исходный текст |
Ответ на | Re: Two small patches for the News section of the website (Magnus Hagander <magnus@hagander.net>) |
Список | pgsql-www |
On 04/01/2021 14:46, Magnus Hagander wrote: > On Wed, Dec 30, 2020 at 9:59 PM Andreas 'ads' Scherbaum <ads@pgug.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) Nice, didn't thought about a Lambda there! Thanks for updating it! -- Andreas 'ads' Scherbaum German PostgreSQL User Group European PostgreSQL User Group - Board of Directors Volunteer Regional Contact, Germany - PostgreSQL Project
В списке pgsql-www по дате отправления: