From aa00efc6048c4bca46acabe18ee6d1b08f52e0e5 Mon Sep 17 00:00:00 2001 From: Numerlor <25886452+Numerlor@users.noreply.github.com> Date: Mon, 30 Aug 2021 22:53:52 +0200 Subject: Allow empty value for inventory url field --- .../api/migrations/0072_doc_allow_blank_base_url.py | 19 +++++++++++++++++++ pydis_site/apps/api/models/bot/documentation_link.py | 1 + 2 files changed, 20 insertions(+) create mode 100644 pydis_site/apps/api/migrations/0072_doc_allow_blank_base_url.py (limited to 'pydis_site/apps/api') diff --git a/pydis_site/apps/api/migrations/0072_doc_allow_blank_base_url.py b/pydis_site/apps/api/migrations/0072_doc_allow_blank_base_url.py new file mode 100644 index 00000000..d4899354 --- /dev/null +++ b/pydis_site/apps/api/migrations/0072_doc_allow_blank_base_url.py @@ -0,0 +1,19 @@ +# Generated by Django 3.0.14 on 2021-08-30 21:09 + +from django.db import migrations, models +import pydis_site.apps.api.models.bot.documentation_link + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0071_increase_message_content_4000'), + ] + + operations = [ + migrations.AlterField( + model_name='documentationlink', + name='base_url', + field=models.URLField(blank=True, help_text='The base URL from which documentation will be available for this project. Used to generate links to various symbols within this package.', validators=[pydis_site.apps.api.models.bot.documentation_link.ends_with_slash_validator]), + ), + ] diff --git a/pydis_site/apps/api/models/bot/documentation_link.py b/pydis_site/apps/api/models/bot/documentation_link.py index 3dcc71fc..9941907c 100644 --- a/pydis_site/apps/api/models/bot/documentation_link.py +++ b/pydis_site/apps/api/models/bot/documentation_link.py @@ -30,6 +30,7 @@ class DocumentationLink(ModelReprMixin, models.Model): "The base URL from which documentation will be available for this project. " "Used to generate links to various symbols within this package." ), + blank=True, validators=(ends_with_slash_validator,) ) inventory_url = models.URLField( -- cgit v1.2.3 From 58e061109f3ce09e1d8687f61ad22a335deb893a Mon Sep 17 00:00:00 2001 From: Numerlor <25886452+Numerlor@users.noreply.github.com> Date: Mon, 30 Aug 2021 23:04:40 +0200 Subject: Move base_url field to the end In most cases this won't need to be specified, so it makes more sense to move it out of the way --- pydis_site/apps/api/admin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pydis_site/apps/api') diff --git a/pydis_site/apps/api/admin.py b/pydis_site/apps/api/admin.py index 449e660e..2aca38a1 100644 --- a/pydis_site/apps/api/admin.py +++ b/pydis_site/apps/api/admin.py @@ -48,8 +48,8 @@ class BotSettingAdmin(admin.ModelAdmin): class DocumentationLinkAdmin(admin.ModelAdmin): """Admin formatting for the DocumentationLink model.""" - fields = ("package", "base_url", "inventory_url") - list_display = ("package", "base_url", "inventory_url") + fields = ("package", "inventory_url", "base_url") + list_display = ("package", "inventory_url", "base_url") list_editable = ("base_url", "inventory_url") search_fields = ("package",) -- cgit v1.2.3 From 6730607d389e53276d3791a423f92f3a3f1349ef Mon Sep 17 00:00:00 2001 From: mbaruh Date: Tue, 7 Sep 2021 23:20:10 +0300 Subject: Update embed description length to 4096 --- pydis_site/apps/api/models/utils.py | 2 +- pydis_site/apps/api/tests/test_validators.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'pydis_site/apps/api') diff --git a/pydis_site/apps/api/models/utils.py b/pydis_site/apps/api/models/utils.py index 107231ba..0e220a1d 100644 --- a/pydis_site/apps/api/models/utils.py +++ b/pydis_site/apps/api/models/utils.py @@ -142,7 +142,7 @@ def validate_embed(embed: Any) -> None: ), MaxLengthValidator(limit_value=256) ), - 'description': (MaxLengthValidator(limit_value=2048),), + 'description': (MaxLengthValidator(limit_value=4096),), 'fields': ( MaxLengthValidator(limit_value=25), validate_embed_fields diff --git a/pydis_site/apps/api/tests/test_validators.py b/pydis_site/apps/api/tests/test_validators.py index 8bb7b917..551cc2aa 100644 --- a/pydis_site/apps/api/tests/test_validators.py +++ b/pydis_site/apps/api/tests/test_validators.py @@ -72,7 +72,7 @@ class TagEmbedValidatorTests(TestCase): def test_rejects_too_long_description(self): with self.assertRaises(ValidationError): validate_embed({ - 'description': 'd' * 2049 + 'description': 'd' * 4097 }) def test_allows_valid_embed(self): -- cgit v1.2.3 From 6abf47abd515ec789ad2f271dcbc48403a3e0d7e Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Wed, 22 Sep 2021 10:49:36 +0100 Subject: Rename an error to have a correct error suffix --- pydis_site/apps/api/models/bot/metricity.py | 10 +++++----- pydis_site/apps/api/tests/test_users.py | 10 +++++----- pydis_site/apps/api/viewsets/bot/user.py | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'pydis_site/apps/api') diff --git a/pydis_site/apps/api/models/bot/metricity.py b/pydis_site/apps/api/models/bot/metricity.py index 5daa5c66..33fb7ad7 100644 --- a/pydis_site/apps/api/models/bot/metricity.py +++ b/pydis_site/apps/api/models/bot/metricity.py @@ -10,7 +10,7 @@ EXCLUDE_CHANNELS = [ ] -class NotFound(Exception): +class NotFoundError(Exception): """Raised when an entity cannot be found.""" pass @@ -37,7 +37,7 @@ class Metricity: values = self.cursor.fetchone() if not values: - raise NotFound() + raise NotFoundError() return dict(zip(columns, values)) @@ -58,7 +58,7 @@ class Metricity: values = self.cursor.fetchone() if not values: - raise NotFound() + raise NotFoundError() return values[0] @@ -88,7 +88,7 @@ class Metricity: values = self.cursor.fetchone() if not values: - raise NotFound() + raise NotFoundError() return values[0] @@ -127,6 +127,6 @@ class Metricity: values = self.cursor.fetchall() if not values: - raise NotFound() + raise NotFoundError() return values diff --git a/pydis_site/apps/api/tests/test_users.py b/pydis_site/apps/api/tests/test_users.py index c43b916a..ed5b4ce3 100644 --- a/pydis_site/apps/api/tests/test_users.py +++ b/pydis_site/apps/api/tests/test_users.py @@ -5,7 +5,7 @@ from django_hosts.resolvers import reverse from .base import APISubdomainTestCase from ..models import Role, User -from ..models.bot.metricity import NotFound +from ..models.bot.metricity import NotFoundError class UnauthedUserAPITests(APISubdomainTestCase): @@ -501,7 +501,7 @@ class UserMetricityTests(APISubdomainTestCase): self.metricity = patcher.start() self.addCleanup(patcher.stop) self.metricity = self.metricity.return_value.__enter__.return_value - self.metricity.user.side_effect = NotFound() - self.metricity.total_messages.side_effect = NotFound() - self.metricity.total_message_blocks.side_effect = NotFound() - self.metricity.top_channel_activity.side_effect = NotFound() + self.metricity.user.side_effect = NotFoundError() + self.metricity.total_messages.side_effect = NotFoundError() + self.metricity.total_message_blocks.side_effect = NotFoundError() + self.metricity.top_channel_activity.side_effect = NotFoundError() diff --git a/pydis_site/apps/api/viewsets/bot/user.py b/pydis_site/apps/api/viewsets/bot/user.py index 25722f5a..0356e193 100644 --- a/pydis_site/apps/api/viewsets/bot/user.py +++ b/pydis_site/apps/api/viewsets/bot/user.py @@ -11,7 +11,7 @@ from rest_framework.serializers import ModelSerializer from rest_framework.viewsets import ModelViewSet from pydis_site.apps.api.models.bot.infraction import Infraction -from pydis_site.apps.api.models.bot.metricity import Metricity, NotFound +from pydis_site.apps.api.models.bot.metricity import Metricity, NotFoundError from pydis_site.apps.api.models.bot.user import User from pydis_site.apps.api.serializers import UserSerializer @@ -275,7 +275,7 @@ class UserViewSet(ModelViewSet): data["voice_banned"] = voice_banned data["activity_blocks"] = metricity.total_message_blocks(user.id) return Response(data, status=status.HTTP_200_OK) - except NotFound: + except NotFoundError: return Response(dict(detail="User not found in metricity"), status=status.HTTP_404_NOT_FOUND) @@ -290,6 +290,6 @@ class UserViewSet(ModelViewSet): data["total_messages"] = metricity.total_messages(user.id) data["top_channel_activity"] = metricity.top_channel_activity(user.id) return Response(data, status=status.HTTP_200_OK) - except NotFound: + except NotFoundError: return Response(dict(detail="User not found in metricity"), status=status.HTTP_404_NOT_FOUND) -- cgit v1.2.3 From 3cb0a6bdcd7e7fca560fbea4d2bc3ff50bbd8cfa Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Mon, 27 Sep 2021 21:35:28 +0100 Subject: Add LT and GT to supported otn chars --- .../apps/api/migrations/0073_otn_allow_GT_and_LT.py | 19 +++++++++++++++++++ .../apps/api/models/bot/off_topic_channel_name.py | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 pydis_site/apps/api/migrations/0073_otn_allow_GT_and_LT.py (limited to 'pydis_site/apps/api') diff --git a/pydis_site/apps/api/migrations/0073_otn_allow_GT_and_LT.py b/pydis_site/apps/api/migrations/0073_otn_allow_GT_and_LT.py new file mode 100644 index 00000000..09ad13da --- /dev/null +++ b/pydis_site/apps/api/migrations/0073_otn_allow_GT_and_LT.py @@ -0,0 +1,19 @@ +# Generated by Django 3.0.14 on 2021-09-27 20:38 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0072_doc_allow_blank_base_url'), + ] + + operations = [ + migrations.AlterField( + model_name='offtopicchannelname', + name='name', + field=models.CharField(help_text='The actual channel name that will be used on our Discord server.', max_length=96, primary_key=True, serialize=False, validators=[django.core.validators.RegexValidator(regex="^[a-z0-9\\U0001d5a0-\\U0001d5b9-ǃ?’'<>]+$")]), + ), + ] diff --git a/pydis_site/apps/api/models/bot/off_topic_channel_name.py b/pydis_site/apps/api/models/bot/off_topic_channel_name.py index 403c7465..8999e560 100644 --- a/pydis_site/apps/api/models/bot/off_topic_channel_name.py +++ b/pydis_site/apps/api/models/bot/off_topic_channel_name.py @@ -11,7 +11,7 @@ class OffTopicChannelName(ModelReprMixin, models.Model): primary_key=True, max_length=96, validators=( - RegexValidator(regex=r"^[a-z0-9\U0001d5a0-\U0001d5b9-ǃ?’']+$"), + RegexValidator(regex=r"^[a-z0-9\U0001d5a0-\U0001d5b9-ǃ?’'<>]+$"), ), help_text="The actual channel name that will be used on our Discord server." ) -- cgit v1.2.3 From 26be9bebfdb151a7e6d3e855c8d2a509ae1d4d38 Mon Sep 17 00:00:00 2001 From: Hassan Abouelela Date: Wed, 6 Oct 2021 00:41:23 +0400 Subject: Switches HTTP Links To HTTPS Switches the protocol for external sites where possible. Some sites don't have secure versions, and were skipped. Signed-off-by: Hassan Abouelela --- pydis_site/apps/api/urls.py | 2 +- pydis_site/apps/content/resources/frequently-asked-questions.md | 2 +- .../contributing/contributing-guidelines/supplemental-information.md | 2 +- .../guides/pydis-guides/contributing/sir-lancebot/env-var-reference.md | 2 +- pydis_site/apps/resources/resources/communities/panda3d.yaml | 2 +- pydis_site/apps/resources/resources/reading/books/byte_of_python.yaml | 2 +- .../apps/resources/resources/reading/books/flask_web_development.yaml | 2 +- pydis_site/apps/resources/resources/reading/books/python_cookbook.yaml | 2 +- .../apps/resources/resources/reading/tutorials/simple_guide_to_git.yaml | 2 +- pydis_site/apps/resources/resources/videos/microsoft.yaml | 2 +- pydis_site/settings.py | 2 +- pydis_site/templates/base/navbar.html | 2 +- pydis_site/templates/events/pages/code-jams/8/frameworks.html | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) (limited to 'pydis_site/apps/api') diff --git a/pydis_site/apps/api/urls.py b/pydis_site/apps/api/urls.py index 2e1ef0b4..b0ab545b 100644 --- a/pydis_site/apps/api/urls.py +++ b/pydis_site/apps/api/urls.py @@ -16,7 +16,7 @@ from .viewsets import ( UserViewSet ) -# http://www.django-rest-framework.org/api-guide/routers/#defaultrouter +# https://www.django-rest-framework.org/api-guide/routers/#defaultrouter bot_router = DefaultRouter(trailing_slash=False) bot_router.register( 'filter-lists', diff --git a/pydis_site/apps/content/resources/frequently-asked-questions.md b/pydis_site/apps/content/resources/frequently-asked-questions.md index 212ea5f8..a9a092fe 100644 --- a/pydis_site/apps/content/resources/frequently-asked-questions.md +++ b/pydis_site/apps/content/resources/frequently-asked-questions.md @@ -89,7 +89,7 @@ It's also to ease the burden on our moderators, otherwise they would have to dow Even though Discord does support previewing of files like `.txt` and `.py`, that support is only available on Desktop, not mobile. Additionally, we prefer people to use hastebin as it encourages them to only copy over the relevant code snippets instead of their whole code; this makes helping much easier for all involved. -If you want to share code please use our hosted hastebin, [paste.pythondiscord.com](http://paste.pythondiscord.com). +If you want to share code please use our hosted hastebin, [paste.pythondiscord.com](https://paste.pythondiscord.com). #### **Q: Why is this permission not allowed in that channel?** diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/contributing-guidelines/supplemental-information.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/contributing-guidelines/supplemental-information.md index 70d47563..e64e4fc6 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/contributing-guidelines/supplemental-information.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/contributing-guidelines/supplemental-information.md @@ -90,7 +90,7 @@ Our projects currently defines logging levels as follows, from lowest to highest - **ERROR:** These events can cause a failure in a specific part of the application and require urgent attention. - **CRITICAL:** These events can cause the whole application to fail and require immediate intervention. -Any logging above the **INFO** level will trigger a [Sentry](http://sentry.io) issue and alert the Core Developer team. +Any logging above the **INFO** level will trigger a [Sentry](https://sentry.io) issue and alert the Core Developer team. ## Draft Pull Requests diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot/env-var-reference.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot/env-var-reference.md index 2a7ef0d6..eba737ad 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot/env-var-reference.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot/env-var-reference.md @@ -43,7 +43,7 @@ If you will be working with an external service, you might have to set one of th | -------- | -------- | | `GITHUB_TOKEN` | Personal access token for GitHub, raises rate limits from 60 to 5000 requests per hour. | | `GIPHY_TOKEN` | Required for API access. [Docs](https://developers.giphy.com/docs/api) | -| `OMDB_API_KEY` | Required for API access. [Docs](http://www.omdbapi.com/) | +| `OMDB_API_KEY` | Required for API access. [Docs](https://www.omdbapi.com/) | | `REDDIT_CLIENT_ID` | OAuth2 client ID for authenticating with the [reddit API](https://github.com/reddit-archive/reddit/wiki/OAuth2). | | `REDDIT_SECRET` | OAuth2 secret for authenticating with the reddit API. *Leave empty if you're not using the reddit API.* | | `REDDIT_WEBHOOK` | Webhook ID for Reddit channel | diff --git a/pydis_site/apps/resources/resources/communities/panda3d.yaml b/pydis_site/apps/resources/resources/communities/panda3d.yaml index 4235793d..47797882 100644 --- a/pydis_site/apps/resources/resources/communities/panda3d.yaml +++ b/pydis_site/apps/resources/resources/communities/panda3d.yaml @@ -1,6 +1,6 @@ description: Panda3D is a Python-focused 3-D framework for rapid development of games, visualizations, and simulations, written in C++ with an emphasis on performance and flexibility. -title_image: http://www.panda3d.org/wp-content/uploads/2019/01/panda3d_logo.png +title_image: https://www.panda3d.org/wp-content/uploads/2019/01/panda3d_logo.png title_url: https://discord.gg/9XsucTT position: 9 urls: diff --git a/pydis_site/apps/resources/resources/reading/books/byte_of_python.yaml b/pydis_site/apps/resources/resources/reading/books/byte_of_python.yaml index 1f9642ad..2530c1a4 100644 --- a/pydis_site/apps/resources/resources/reading/books/byte_of_python.yaml +++ b/pydis_site/apps/resources/resources/reading/books/byte_of_python.yaml @@ -8,7 +8,7 @@ urls: url: https://python.swaroopch.com/ color: teal - icon: regular/book - url: http://www.lulu.com/shop/swaroop-c-h/a-byte-of-python/paperback/product-21142968.html + url: https://www.lulu.com/shop/swaroop-c-h/a-byte-of-python/paperback/product-21142968.html color: black - icon: branding/amazon url: https://www.amazon.com/Byte-Python-Swaroop-C-H-ebook/dp/B00FJ7S2JU/ diff --git a/pydis_site/apps/resources/resources/reading/books/flask_web_development.yaml b/pydis_site/apps/resources/resources/reading/books/flask_web_development.yaml index cc83a331..d191f02d 100644 --- a/pydis_site/apps/resources/resources/reading/books/flask_web_development.yaml +++ b/pydis_site/apps/resources/resources/reading/books/flask_web_development.yaml @@ -4,7 +4,7 @@ name: Flask Web Development position: 6 urls: - icon: regular/link - url: http://shop.oreilly.com/product/0636920031116.do + url: https://shop.oreilly.com/product/0636920031116.do color: teal - icon: branding/amazon url: https://www.amazon.com/Flask-Web-Development-Developing-Applications/dp/1449372627 diff --git a/pydis_site/apps/resources/resources/reading/books/python_cookbook.yaml b/pydis_site/apps/resources/resources/reading/books/python_cookbook.yaml index 032f8c64..c939ab9e 100644 --- a/pydis_site/apps/resources/resources/reading/books/python_cookbook.yaml +++ b/pydis_site/apps/resources/resources/reading/books/python_cookbook.yaml @@ -4,7 +4,7 @@ name: Python Cookbook position: 8 urls: - icon: regular/link - url: http://shop.oreilly.com/product/0636920027072.do + url: https://shop.oreilly.com/product/0636920027072.do color: teal - icon: branding/amazon url: https://www.amazon.com/Python-Cookbook-Third-David-Beazley/dp/1449340377 diff --git a/pydis_site/apps/resources/resources/reading/tutorials/simple_guide_to_git.yaml b/pydis_site/apps/resources/resources/reading/tutorials/simple_guide_to_git.yaml index a505715d..9d151bf9 100644 --- a/pydis_site/apps/resources/resources/reading/tutorials/simple_guide_to_git.yaml +++ b/pydis_site/apps/resources/resources/reading/tutorials/simple_guide_to_git.yaml @@ -1,6 +1,6 @@ description: A simple, no-nonsense guide to the basics of using Git. name: A Simple Guide to Git -title_url: http://rogerdudler.github.io/git-guide/ +title_url: https://rogerdudler.github.io/git-guide/ title_icon: branding/github title_icon_color: black position: 4 diff --git a/pydis_site/apps/resources/resources/videos/microsoft.yaml b/pydis_site/apps/resources/resources/videos/microsoft.yaml index 720ee202..3ceaa1a2 100644 --- a/pydis_site/apps/resources/resources/videos/microsoft.yaml +++ b/pydis_site/apps/resources/resources/videos/microsoft.yaml @@ -7,7 +7,7 @@ description: A trove of tutorials & guides for developers from Microsoft's Devel Microsoft's Python Development Team also runs a Discord Server for discussions of Python in the Microsoft ecosystem, including Visual Studio Code and Azure. -title_image: http://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE2qVsJ?ver=3f74 +title_image: https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE2qVsJ?ver=3f74 position: 4 urls: - icon: branding/youtube diff --git a/pydis_site/settings.py b/pydis_site/settings.py index d2cd8698..8d092ac9 100644 --- a/pydis_site/settings.py +++ b/pydis_site/settings.py @@ -201,7 +201,7 @@ else: PARENT_HOST = env('PARENT_HOST', default='pythondiscord.com') # Django REST framework -# http://www.django-rest-framework.org +# https://www.django-rest-framework.org REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.TokenAuthentication', diff --git a/pydis_site/templates/base/navbar.html b/pydis_site/templates/base/navbar.html index d7cb49b2..ed04995c 100644 --- a/pydis_site/templates/base/navbar.html +++ b/pydis_site/templates/base/navbar.html @@ -44,7 +44,7 @@ {# Patreon #} - +  Patreon diff --git a/pydis_site/templates/events/pages/code-jams/8/frameworks.html b/pydis_site/templates/events/pages/code-jams/8/frameworks.html index 34ac4f0a..1c02e38a 100644 --- a/pydis_site/templates/events/pages/code-jams/8/frameworks.html +++ b/pydis_site/templates/events/pages/code-jams/8/frameworks.html @@ -19,7 +19,7 @@