Skip to content

Commit

Permalink
Merge branch 'main' into validate-html
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobCoffee authored Sep 13, 2024
2 parents e3c9857 + 241b3b8 commit 8cae9ae
Show file tree
Hide file tree
Showing 20 changed files with 83 additions and 34 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Notify @EWDurbin for all opened Issues and Pull Requests
* @EWDurbin @JacobCoffee
19 changes: 19 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!--
By submitting this pull request, you agree to:
- follow the [PSF's Code of Conduct](https://www.python.org/psf/conduct/)
-->
#### Description

-

<!--
If applicable, please add in issue numbers this pull request will close, if applicable
Examples: Fixes #4321 or Closes #1234
Ensure you are using a supported keyword to properly link an issue:
https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
-->
#### Closes

-

2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
sudo dpkg -i pandoc-2.17.1.1-1-amd64.deb
- uses: actions/setup-python@v5
with:
python-version: 3.9.16
python-version-file: '.python-version'
- name: Cache Python dependencies
uses: actions/cache@v4
env:
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Check collectstatic
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
- name: Cache Python dependencies
uses: actions/cache@v4
env:
cache-name: pythondotorg-cache-pip
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('requirements.txt', '*-requirements.txt') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-
${{ runner.os }}-${{ github.job }}-
${{ runner.os }}-
- name: Install Python dependencies
run: |
pip install -U pip setuptools wheel
pip install -r requirements.txt -r prod-requirements.txt
- name: Run Tests
run: |
DJANGO_SETTINGS_MODULE=pydotorg.settings.static python manage.py collectstatic --noinput
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.9.16
3.12.6
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9-bookworm
FROM python:3.12.6-bookworm
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.cabotage
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9-bullseye
FROM python:3.12.6-bookworm
COPY --from=ewdurbin/nginx-static:1.25.x /usr/bin/nginx /usr/bin/nginx
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ default:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null\
| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}'\
| sort\
| egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
| grep -E -v -e '^[^[:alnum:]]' -e '^$@$$'
@echo
@exit 1

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ https://github.com/python/cpython/issues/.

* Source code: https://github.com/python/pythondotorg
* Issue tracker: https://github.com/python/pythondotorg/issues
* Documentation: https://pythondotorg.readthedocs.org/
* Documentation: https://pythondotorg.readthedocs.io/
* Mailing list: [pydotorg-www](https://mail.python.org/mailman/listinfo/pydotorg-www)
* IRC: `#pydotorg` on Freenode
* Staging site: https://staging.python.org/ (`main` branch)
Expand Down
14 changes: 7 additions & 7 deletions base-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ django-apptemplates==1.5
django-admin-interface==0.24.2
django-translation-aliases==0.1.0
Django==4.2.16
docutils==0.12
Markdown==3.3.4
docutils==0.21.2
Markdown==3.7
cmarkgfm==0.6.0
Pillow==9.4.0
psycopg2-binary==2.8.6
Pillow==10.4.0
psycopg2-binary==2.9.9
python3-openid==3.2.0
python-decouple==3.4
# lxml used by BeautifulSoup.
lxml==5.2.2
cssselect==1.1.0
feedparser==6.0.8
feedparser==6.0.11
beautifulsoup4==4.11.2
icalendar==4.0.7
chardet==4.0.0
Expand All @@ -36,14 +36,14 @@ requests[security]>=2.26.0
django-honeypot==1.0.4 # 1.0.4 is first version that supports Django 4.2
django-markupfield==2.0.1

django-allauth==0.57.2 # 0.55.0 is first version that supports Django 4.2
django-allauth==64.2.1

django-waffle==2.2.1

djangorestframework==3.14.0 # 3.14.0 is first version that supports Django 4.1, 4.2 support hasnt been "released"
django-filter==2.4.0
django-ordered-model==3.4.3
django-widget-tweaks==1.4.8
django-widget-tweaks==1.5.0
django-countries==7.2.1
num2words==0.5.10
django-polymorphic==3.1.0 # 3.1.0 is first version that supports Django 4.0, unsure if it fully supports 4.2
Expand Down
4 changes: 2 additions & 2 deletions docs/source/administration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Pages are individual entire pages of markup content. They are require ``Title``
:Is Published: Controls whether or not the page is visible on the site.
:Template Name: By default Pages use the template ``templates/pages/default.html`` to use a different template enter the template path here.

.. note:: Pages are automatically purge from Fastly.com upon save.
.. note:: Pages are automatically purged from Fastly.com upon save.

.. _boxes:

Expand Down Expand Up @@ -82,7 +82,7 @@ Release Files have a checkbox named 'Download button' that determines which bina
Jobs
----

The jobs application is using to display Python jobs on the site. The data items should be fairly self explanatory. There are a couple of things to keep in mind. Logged in users of the site can submit jobs for review.
The jobs application is used to display Python jobs on the site. The data items should be fairly self explanatory. There are a couple of things to keep in mind. Logged in users of the site can submit jobs for review.

:Status: Jobs enter the system in 'review' status after the submitter has entered them. Only jobs in the 'approved' state are displayed on the site.
:Featured: Featured jobs are displayed more prominently on the landing page.
Expand Down
6 changes: 3 additions & 3 deletions downloads/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def test_is_version_at_least(self):

release_38 = Release.objects.create(name='Python 3.8.0')
self.assertFalse(release_38.is_version_at_least_3_9)
self.assert_(release_38.is_version_at_least_3_5)
self.assertTrue(release_38.is_version_at_least_3_5)

release_310 = Release.objects.create(name='Python 3.10.0')
self.assert_(release_310.is_version_at_least_3_9)
self.assert_(release_310.is_version_at_least_3_5)
self.assertTrue(release_310.is_version_at_least_3_9)
self.assertTrue(release_310.is_version_at_least_3_5)
3 changes: 1 addition & 2 deletions downloads/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
from django.urls import reverse
from django.test import TestCase, override_settings

from rest_framework.authtoken.models import Token
from rest_framework.test import APITestCase

from .base import BaseDownloadTests, DownloadMixin
from ..models import OS, Release
from ..models import Release
from pages.factories import PageFactory
from pydotorg.drf import BaseAPITestCase
from users.factories import UserFactory
Expand Down
8 changes: 7 additions & 1 deletion events/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ def import_occurrence(self, event, event_data):
# but won't add any timezone information. We will convert them to
# aware datetime objects manually.
dt_start = extract_date_or_datetime(event_data['DTSTART'].dt)
dt_end = extract_date_or_datetime(event_data['DTEND'].dt)
if 'DTEND' in event_data:
# DTEND is not always set on events, in particular it seems that
# events which have the same start and end time, don't provide
# DTEND. See #2021.
dt_end = extract_date_or_datetime(event_data['DTEND'].dt)
else:
dt_end = dt_start

# Let's mark those occurrences as 'all-day'.
all_day = (
Expand Down
6 changes: 3 additions & 3 deletions events/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class OccurringRule(RuleMixin, models.Model):

def __str__(self):
strftime = settings.SHORT_DATETIME_FORMAT
return f'{self.event.title} {date(self.dt_start.strftime, strftime)} - {date(self.dt_end.strftime, strftime)}'
return f'{self.event.title} {date(self.dt_start, strftime)} - {date(self.dt_end, strftime)}'

@property
def begin(self):
Expand Down Expand Up @@ -283,8 +283,8 @@ class RecurringRule(RuleMixin, models.Model):
all_day = models.BooleanField(default=False)

def __str__(self):
strftime = settings.SHORT_DATETIME_FORMAT
return f'{self.event.title} every {timedelta_nice_repr(self.interval)} since {date(self.dt_start.strftime, strftime)}'
return (f'{self.event.title} every {timedelta_nice_repr(self.freq_interval_as_timedelta)} since '
f'{date(self.dt_start, settings.SHORT_DATETIME_FORMAT)}')

def to_rrule(self):
return rrule(
Expand Down
4 changes: 2 additions & 2 deletions fixtures/boxes.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@
"created": "2014-02-13T17:37:50.862Z",
"updated": "2014-02-16T23:01:04.762Z",
"label": "widget-weneedyou",
"content": "<h2 class=\"widget-title\"><span class=\"prompt\">&gt;&gt;&gt;</span> <a href=\"#\">Python Needs You</a></h2>\r\n<p>Open source software is made better when users can easily contribute code and documentation to fix bugs and add features. Python strongly encourages community involvement in improving the software. <a href=\"//docs.python.org/devguide\">Learn more</a> about how to make Python better for everyone.</p>\r\n<p class=\"click-these\">\r\n <a class=\"button\" href=\"//docs.python.org/devguide/#contributing\">Contribute to Python</a>\r\n <a class=\"button\" href=\"//bugs.python.org\">Bug Tracker</a>\r\n</p>",
"content": "<h2 class=\"widget-title\"><span class=\"prompt\">&gt;&gt;&gt;</span> <a href=\"#\">Python Needs You</a></h2>\r\n<p>Open source software is made better when users can easily contribute code and documentation to fix bugs and add features. Python strongly encourages community involvement in improving the software. <a href=\"//docs.python.org/devguide\">Learn more</a> about how to make Python better for everyone.</p>\r\n<p class=\"click-these\">\r\n <a class=\"button\" href=\"//docs.python.org/devguide/#contributing\">Contribute to Python</a>\r\n <a class=\"button\" href=\"//github.com/python/cpython/issues\">Bug Tracker</a>\r\n</p>",
"content_markup_type": "html",
"_content_rendered": "<h2 class=\"widget-title\"><span class=\"prompt\">&gt;&gt;&gt;</span> <a href=\"#\">Python Needs You</a></h2>\r\n<p>Open source software is made better when users can easily contribute code and documentation to fix bugs and add features. Python strongly encourages community involvement in improving the software. <a href=\"//docs.python.org/devguide\">Learn more</a> about how to make Python better for everyone.</p>\r\n<p class=\"click-these\">\r\n <a class=\"button\" href=\"//docs.python.org/devguide/#contributing\">Contribute to Python</a>\r\n <a class=\"button\" href=\"//bugs.python.org\">Bug Tracker</a>\r\n</p>"
"_content_rendered": "<h2 class=\"widget-title\"><span class=\"prompt\">&gt;&gt;&gt;</span> <a href=\"#\">Python Needs You</a></h2>\r\n<p>Open source software is made better when users can easily contribute code and documentation to fix bugs and add features. Python strongly encourages community involvement in improving the software. <a href=\"//docs.python.org/devguide\">Learn more</a> about how to make Python better for everyone.</p>\r\n<p class=\"click-these\">\r\n <a class=\"button\" href=\"//docs.python.org/devguide/#contributing\">Contribute to Python</a>\r\n <a class=\"button\" href=\"//github.com/python/cpython/issues\">Bug Tracker</a>\r\n</p>"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion jobs/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_visible_manager(self):
j3 = factories.ApprovedJobFactory(expires=past)

visible = Job.objects.visible()
self.assertTrue(len(visible), 1)
self.assertEqual(len(visible), 1)
self.assertIn(j1, visible)
self.assertNotIn(j2, visible)
self.assertNotIn(j3, visible)
Expand Down
5 changes: 0 additions & 5 deletions pydotorg/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,6 @@

'allauth',
'allauth.account',
'allauth.socialaccount',
#'allauth.socialaccount.providers.facebook',
#'allauth.socialaccount.providers.github',
#'allauth.socialaccount.providers.openid',
#'allauth.socialaccount.providers.twitter',

# Tastypie needs the `users` app to be already loaded.
'tastypie',
Expand Down
1 change: 0 additions & 1 deletion runtime.txt

This file was deleted.

2 changes: 1 addition & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<link rel="apple-touch-icon" href="{{ STATIC_URL }}apple-touch-icon-precomposed.png">

{# Tile icon for Win8 (144x144 + tile color) #}
<meta name="msapplication-TileImage" content="{{ STATIC_URL }}metro-icon-144x144-precomposed.png"><!-- white shape -->
<meta name="msapplication-TileImage" content="{{ STATIC_URL }}metro-icon-144x144.png"><!-- white shape -->
<meta name="msapplication-TileColor" content="#3673a5"><!-- python blue -->
<meta name="msapplication-navbutton-color" content="#3673a5">

Expand Down

0 comments on commit 8cae9ae

Please sign in to comment.