id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
18,400 | filter_queryset.py | rafalp_Misago/misago/search/filter_queryset.py | EQUAL = 0
CONTAINS = 1
STARTS_WITH = 2
ENDS_WITH = 3
def filter_queryset(queryset, attr, search, *, case_sensitive=False):
mode = get_mode(search)
search = search.strip("*")
if not search:
return queryset
queryset_filter = get_queryset_filter(
attr, mode, search, case_sensitive=case_... | 1,246 | Python | .py | 37 | 27.162162 | 69 | 0.626566 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,401 | apps.py | rafalp_Misago/misago/search/apps.py | from django.apps import AppConfig
class MisagoSearchConfig(AppConfig):
name = "misago.search"
label = "misago_search"
verbose_name = "Misago Search"
| 163 | Python | .py | 5 | 28.8 | 36 | 0.75 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,402 | api.py | rafalp_Misago/misago/search/api.py | from time import time
from django.core.exceptions import PermissionDenied
from django.urls import reverse
from django.utils.translation import pgettext
from rest_framework.decorators import api_view
from rest_framework.response import Response
from ..core.shortcuts import get_int_or_404
from .searchproviders import s... | 1,735 | Python | .py | 41 | 33.926829 | 86 | 0.644088 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,403 | context_processors.py | rafalp_Misago/misago/search/context_processors.py | from django.urls import reverse
from .searchproviders import searchproviders
def search_providers(request):
allowed_providers = []
try:
if request.user_acl["can_search"]:
allowed_providers = searchproviders.get_allowed_providers(request)
except AttributeError:
# is user has n... | 1,401 | Python | .py | 33 | 31.666667 | 81 | 0.601763 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,404 | searchprovider.py | rafalp_Misago/misago/search/searchprovider.py | class SearchProvider:
def __init__(self, request):
self.request = request
def allow_search(self):
pass
def search(self, query, page=1):
raise NotImplementedError(
"%s has to define search(query, page=1) method" % self.__class__.__name__
)
| 297 | Python | .py | 9 | 25.555556 | 85 | 0.597902 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,405 | searchproviders.py | rafalp_Misago/misago/search/searchproviders.py | from django.core.exceptions import PermissionDenied
from django.utils.module_loading import import_string
from ..conf import settings
class SearchProviders:
def __init__(self, search_providers):
self._initialized = False
self._providers = []
self.providers = search_providers
def ini... | 1,147 | Python | .py | 30 | 29.266667 | 68 | 0.658228 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,406 | permissions.py | rafalp_Misago/misago/search/permissions.py | from django import forms
from django.utils.translation import pgettext_lazy
from ..acl import algebra
from ..acl.models import Role
from ..admin.forms import YesNoSwitch
class PermissionsForm(forms.Form):
legend = pgettext_lazy("search permission", "Search")
can_search = YesNoSwitch(
label=pgettext_... | 683 | Python | .py | 19 | 31.526316 | 78 | 0.728244 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,407 | views.py | rafalp_Misago/misago/search/views.py | from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.shortcuts import redirect, render
from django.utils.translation import pgettext
from .searchproviders import searchproviders
def landing(request):
allowed_providers = searchproviders.get_allowed_providers(request)
... | 1,344 | Python | .py | 31 | 36.774194 | 80 | 0.707822 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,408 | api.py | rafalp_Misago/misago/search/urls/api.py | from django.urls import path
from .. import api
urlpatterns = [
path("search/", api.search, name="search"),
path("search/<slug:search_provider>/", api.search, name="search"),
]
| 187 | Python | .py | 6 | 28.5 | 70 | 0.692737 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,409 | __init__.py | rafalp_Misago/misago/search/urls/__init__.py | from django.urls import path
from ..views import landing, search
urlpatterns = [
path("search/", landing, name="search"),
path("search/<slug:search_provider>/", search, name="search"),
]
| 197 | Python | .py | 6 | 30.166667 | 66 | 0.708995 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,410 | test_searchproviders.py | rafalp_Misago/misago/search/tests/test_searchproviders.py | from django.core.exceptions import PermissionDenied
from django.test import TestCase
from ...conf import settings
from ..searchprovider import SearchProvider
from ..searchproviders import SearchProviders
class MockProvider(SearchProvider):
pass
class DisallowedProvider(SearchProvider):
def allow_search(sel... | 2,271 | Python | .py | 49 | 38.183673 | 88 | 0.704948 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,411 | test_api.py | rafalp_Misago/misago/search/tests/test_api.py | from django.urls import reverse
from ...acl.test import patch_user_acl
from ...users.test import AuthenticatedUserTestCase
from ..searchproviders import searchproviders
class SearchApiTests(AuthenticatedUserTestCase):
def setUp(self):
super().setUp()
self.test_link = reverse("misago:api:search")... | 2,032 | Python | .py | 42 | 38.928571 | 84 | 0.638706 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,412 | test_views.py | rafalp_Misago/misago/search/tests/test_views.py | from django.urls import reverse
from ...acl.test import patch_user_acl
from ...threads.search import SearchThreads
from ...users.test import AuthenticatedUserTestCase
class LandingTests(AuthenticatedUserTestCase):
def setUp(self):
super().setUp()
self.test_link = reverse("misago:search")
@p... | 2,196 | Python | .py | 48 | 37.9375 | 88 | 0.663385 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,413 | users.py | rafalp_Misago/misago/notifications/users.py | from typing import TYPE_CHECKING, Optional
from django.db.models import F
from ..categories.models import Category
from ..threads.models import Post, Thread
from .models import Notification
if TYPE_CHECKING:
from ..users.models import User
def notify_user(
user: "User",
verb: str,
actor: Optional["... | 898 | Python | .py | 28 | 26.821429 | 61 | 0.698725 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,414 | signals.py | rafalp_Misago/misago/notifications/signals.py | from django.contrib.auth import get_user_model
from django.dispatch import receiver
from django.db.models import Q
from django.db.models.signals import pre_delete
from ..users.signals import (
anonymize_user_data,
archive_user_data,
delete_user_content,
username_changed,
)
from .registry import registr... | 1,518 | Python | .py | 36 | 37.555556 | 86 | 0.747283 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,415 | models.py | rafalp_Misago/misago/notifications/models.py | from django.conf import settings
from django.db import models
from django.utils.crypto import get_random_string
from django.utils import timezone
from django.urls import reverse
WATCHED_THREAD_SECRET = 32
def get_watched_thread_secret() -> str:
return get_random_string(WATCHED_THREAD_SECRET)
class Notificatio... | 2,802 | Python | .py | 68 | 33.602941 | 88 | 0.660655 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,416 | urls.py | rafalp_Misago/misago/notifications/urls.py | from django.urls import path
from .views import disable_email_notifications, notification, notifications
urlpatterns = [
path(
"notifications/disable-email/<int:watched_thread_id>/<str:secret>/",
disable_email_notifications,
name="notifications-disable-email",
),
path("notification... | 603 | Python | .py | 13 | 41.538462 | 83 | 0.734694 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,417 | tasks.py | rafalp_Misago/misago/notifications/tasks.py | from logging import getLogger
from celery import shared_task
from django.conf import settings
from django.contrib.auth import get_user_model
from ..cache.versions import get_cache_versions
from ..conf.dynamicsettings import DynamicSettings
from ..users.bans import get_user_ban
from ..threads.models import Post, Threa... | 3,819 | Python | .py | 96 | 33.208333 | 88 | 0.696757 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,418 | apps.py | rafalp_Misago/misago/notifications/apps.py | from django.apps import AppConfig
class MisagoNotificationsConfig(AppConfig):
name = "misago.notifications"
label = "misago_notifications"
verbose_name = "Misago Notifications"
def ready(self):
from . import signals as _ # noqa: F401
| 262 | Python | .py | 7 | 32.571429 | 48 | 0.730159 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,419 | threads.py | rafalp_Misago/misago/notifications/threads.py | from datetime import datetime, timedelta
from typing import TYPE_CHECKING, Dict, Iterable, Optional
from django.db.models import IntegerChoices
from django.urls import reverse
from django.utils.translation import pgettext, pgettext_lazy
from ..acl.useracl import get_user_acl
from ..categories.enums import CategoryTre... | 9,562 | Python | .py | 263 | 29.78327 | 88 | 0.676021 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,420 | exceptions.py | rafalp_Misago/misago/notifications/exceptions.py | class NotificationVerbError(KeyError):
"""Raised by message and redirect factions for unknown notification types."""
pass
| 131 | Python | .py | 3 | 39.666667 | 81 | 0.779528 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,421 | registry.py | rafalp_Misago/misago/notifications/registry.py | import html
from typing import TYPE_CHECKING, Callable, Dict, overload
from django.http import HttpRequest
from django.utils.translation import pgettext
from ..categories.enums import CategoryTree
from ..threads.views.redirect import get_redirect_to_post_response
from .verbs import NotificationVerb
from .exceptions i... | 5,662 | Python | .py | 139 | 33.935252 | 86 | 0.68527 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,422 | verbs.py | rafalp_Misago/misago/notifications/verbs.py | from enum import StrEnum
class NotificationVerb(StrEnum):
REPLIED = "REPLIED"
INVITED = "INVITED"
| 108 | Python | .py | 4 | 23.5 | 32 | 0.754902 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,423 | permissions.py | rafalp_Misago/misago/notifications/permissions.py | from typing import TYPE_CHECKING
from django.core.exceptions import PermissionDenied
from django.utils.translation import pgettext
if TYPE_CHECKING:
from misago.users.models import User
def allow_use_notifications(user: "User"):
if user.is_anonymous:
raise PermissionDenied(
pgettext(
... | 456 | Python | .py | 13 | 27.615385 | 70 | 0.687927 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,424 | targets.py | rafalp_Misago/misago/notifications/targets.py | from enum import StrEnum
class NotificationTarget(StrEnum):
USER = "USER"
THREAD = "THREAD"
POST = "POST"
| 120 | Python | .py | 5 | 20.2 | 34 | 0.699115 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,425 | views.py | rafalp_Misago/misago/notifications/views.py | from django.db.models import F
from django.http import Http404, HttpRequest, HttpResponse
from django.shortcuts import get_object_or_404, redirect, render
from .exceptions import NotificationVerbError
from .models import Notification, WatchedThread
from .permissions import allow_use_notifications
from .registry import... | 2,438 | Python | .py | 62 | 32 | 77 | 0.692797 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,426 | 0004_rename_read_at_watchedthread_read_time.py | rafalp_Misago/misago/notifications/migrations/0004_rename_read_at_watchedthread_read_time.py | # Generated by Django 4.2.10 on 2024-09-03 17:17
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("misago_notifications", "0003_indexes"),
]
operations = [
migrations.RenameField(
model_name="watchedthread",
old_name="read... | 377 | Python | .py | 13 | 21.769231 | 49 | 0.610028 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,427 | 0002_migrate_threads_subscriptions.py | rafalp_Misago/misago/notifications/migrations/0002_migrate_threads_subscriptions.py | # Generated by Django 3.2.15 on 2023-03-30 22:39
from django.db import migrations
from django.utils import timezone
BATCH_SIZE_LIMIT = 50
def migrate_threads_subscriptions(apps, schema_editor):
WatchedThread = apps.get_model("misago_notifications", "WatchedThread")
Subscription = apps.get_model("misago_thre... | 1,423 | Python | .py | 38 | 28.973684 | 87 | 0.644574 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,428 | 0001_initial.py | rafalp_Misago/misago/notifications/migrations/0001_initial.py | # Generated by Django 3.2.15 on 2023-04-12 20:46
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import misago.notifications.models
class Migration(migrations.Migration):
initial = True
dependencies = [
migration... | 4,171 | Python | .py | 110 | 20.145455 | 88 | 0.426529 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,429 | 0003_indexes.py | rafalp_Misago/misago/notifications/migrations/0003_indexes.py | # Generated by Django 3.2.15 on 2023-05-13 20:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("misago_notifications", "0002_migrate_threads_subscriptions"),
]
operations = [
migrations.AddIndex(
model_name="notification",
... | 1,382 | Python | .py | 41 | 22.560976 | 83 | 0.516829 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,430 | test_username_change.py | rafalp_Misago/misago/notifications/tests/test_username_change.py | from ..models import Notification
def test_notification_actor_name_is_updated_on_username_change(user, other_user):
notification = Notification.objects.create(
user=user,
actor=other_user,
actor_name=other_user.username,
verb="TEST",
)
other_user.set_username("ChangedName"... | 410 | Python | .py | 11 | 31.181818 | 81 | 0.711392 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,431 | test_delete_user_data.py | rafalp_Misago/misago/notifications/tests/test_delete_user_data.py | import pytest
from ..models import Notification, WatchedThread
def test_user_content_delete_deletes_user_notifications(user, other_user):
notification = Notification.objects.create(
user=user,
actor=other_user,
actor_name=other_user.username,
verb="TEST",
)
user.delete_co... | 1,604 | Python | .py | 42 | 32.309524 | 82 | 0.726801 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,432 | test_notify_on_new_private_thread.py | rafalp_Misago/misago/notifications/tests/test_notify_on_new_private_thread.py | import pytest
from ...threads.models import ThreadParticipant
from ...users.bans import ban_user
from ..models import Notification, WatchedThread
from ..tasks import notify_on_new_private_thread
from ..threads import ThreadNotifications
from ..verbs import NotificationVerb
@pytest.fixture
def notify_participant_mock... | 9,919 | Python | .py | 214 | 41 | 88 | 0.748597 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,433 | test_disable_email_notifications.py | rafalp_Misago/misago/notifications/tests/test_disable_email_notifications.py | from django.urls import reverse
def test_disable_email_notifications_view_disables_emails_for_watched_thread(
watched_thread_factory, user, user_client, thread
):
watched_thread = watched_thread_factory(user, thread, send_emails=True)
response = user_client.get(
reverse(
"misago:notif... | 2,190 | Python | .py | 61 | 27.590164 | 85 | 0.636407 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,434 | test_anonymize_data.py | rafalp_Misago/misago/notifications/tests/test_anonymize_data.py | from ..models import Notification
def test_notification_actor_name_is_anonymized(user, other_user):
notification = Notification.objects.create(
user=user,
actor=other_user,
actor_name=other_user.username,
verb="TEST",
)
other_user.anonymize_data("Deleted")
notificatio... | 388 | Python | .py | 11 | 29.181818 | 65 | 0.702413 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,435 | test_notification_registry.py | rafalp_Misago/misago/notifications/tests/test_notification_registry.py | import pytest
from ..exceptions import NotificationVerbError
from ..registry import NotificationRegistry, registry
from ..models import Notification
from ..verbs import NotificationVerb
@pytest.fixture
def request_mock(rf, user):
request = rf.get("/notification/1/")
request.user = user
return request
... | 4,514 | Python | .py | 101 | 38.524752 | 105 | 0.709906 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,436 | test_update_watched_thread_read_time.py | rafalp_Misago/misago/notifications/tests/test_update_watched_thread_read_time.py | from django.utils import timezone
from ..threads import update_watched_thread_read_time
def test_update_watched_thread_read_time_updates_watched_thread_read_time(
thread, user, watched_thread_factory
):
watched_thread = watched_thread_factory(user, thread, False)
new_read_time = timezone.now()
updat... | 1,473 | Python | .py | 31 | 43.322581 | 85 | 0.756833 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,437 | test_clearnotifications_command.py | rafalp_Misago/misago/notifications/tests/test_clearnotifications_command.py | from datetime import timedelta
from io import StringIO
from django.core import management
from django.utils import timezone
from ...conf.test import override_dynamic_settings
from ..management.commands import clearnotifications
from ..models import Notification
def call_command():
command = clearnotifications.C... | 1,337 | Python | .py | 28 | 44.142857 | 79 | 0.777006 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,438 | test_delete_duplicate_watched_threads.py | rafalp_Misago/misago/notifications/tests/test_delete_duplicate_watched_threads.py | from datetime import timedelta
import pytest
from django.utils import timezone
from ..models import WatchedThread
from ..tasks import delete_duplicate_watched_threads
def test_delete_duplicate_watched_threads_deletes_duplicates_ordered_by_read_time_desc(
user, thread
):
kept_watched_thread = WatchedThread.o... | 4,133 | Python | .py | 114 | 29.517544 | 87 | 0.699423 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,439 | test_notification_view.py | rafalp_Misago/misago/notifications/tests/test_notification_view.py | from django.urls import reverse
from ...test import assert_contains
from ...threads.models import ThreadParticipant
from ..verbs import NotificationVerb
from ..models import Notification
from ..registry import registry
def test_notification_view_returns_redirect_to_user_notification(rf, user, user_client):
reque... | 5,119 | Python | .py | 120 | 37.183333 | 88 | 0.728957 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,440 | test_notify_user.py | rafalp_Misago/misago/notifications/tests/test_notify_user.py | from ..models import Notification
from ..users import notify_user
def test_notify_user_creates_notification_for_user(user):
notification = notify_user(user, "TEST")
assert notification
assert notification.user == user
assert notification.verb == "TEST"
assert notification.actor is None
assert ... | 4,776 | Python | .py | 107 | 39.766355 | 75 | 0.763922 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,441 | test_get_watched_thread.py | rafalp_Misago/misago/notifications/tests/test_get_watched_thread.py | from ..models import WatchedThread
from ..threads import get_watched_thread
def test_get_watched_thread_returns_null_if_thread_is_not_watched(user, thread):
watched_thread = get_watched_thread(user, thread)
assert watched_thread is None
def test_get_watched_thread_returns_watched_thread_for_user(
user, ... | 1,735 | Python | .py | 34 | 46.852941 | 84 | 0.767359 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,442 | test_notifications_view.py | rafalp_Misago/misago/notifications/tests/test_notifications_view.py | from django.urls import reverse
from ...test import assert_contains
def test_notifications_view_is_accessible_by_users(user_client):
response = user_client.get(reverse("misago:notifications"))
assert_contains(response, "Notifications")
assert_contains(response, "enable JavaScript")
def test_notificatio... | 511 | Python | .py | 9 | 53 | 79 | 0.780684 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,443 | test_notify_on_new_thread_reply.py | rafalp_Misago/misago/notifications/tests/test_notify_on_new_thread_reply.py | from datetime import timedelta
import pytest
from django.utils import timezone
from ...threads.models import ThreadParticipant
from ...users.bans import ban_user
from ..models import Notification
from ..tasks import notify_on_new_thread_reply
@pytest.fixture
def notify_watcher_mock(mocker):
return mocker.patch(... | 5,813 | Python | .py | 130 | 40.230769 | 88 | 0.753641 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,444 | test_watch_new_private_thread.py | rafalp_Misago/misago/notifications/tests/test_watch_new_private_thread.py | from ..models import WatchedThread
from ..threads import ThreadNotifications, watch_new_private_thread
def test_private_thread_is_watched_with_email_notifications(user, private_thread):
user.watch_new_private_threads_by_other_users = ThreadNotifications.SITE_AND_EMAIL
user.save()
watched_thread = watch_n... | 4,078 | Python | .py | 93 | 38.182796 | 88 | 0.746646 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,445 | test_watch_replied_thread.py | rafalp_Misago/misago/notifications/tests/test_watch_replied_thread.py | from ..models import WatchedThread
from ..threads import ThreadNotifications, watch_replied_thread
def test_replied_thread_is_watched_with_email_notifications(user, thread):
user.watch_replied_threads = ThreadNotifications.SITE_AND_EMAIL
user.save()
watch_replied_thread(user, thread)
watched_thread ... | 2,268 | Python | .py | 46 | 44.673913 | 77 | 0.778132 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,446 | test_get_watched_threads.py | rafalp_Misago/misago/notifications/tests/test_get_watched_threads.py | from ..threads import ThreadNotifications, get_watched_threads
def test_get_watched_threads_returns_empty_dict_if_threads_are_not_watched(
user, thread, other_thread
):
watched_threads = get_watched_threads(user, [thread, other_thread])
assert watched_threads == {}
def test_get_watched_threads_returns_w... | 1,468 | Python | .py | 30 | 44.5 | 75 | 0.754029 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,447 | test_permissions.py | rafalp_Misago/misago/notifications/tests/test_permissions.py | import pytest
from django.core.exceptions import PermissionDenied
from ..permissions import allow_use_notifications
def test_allow_use_notifications_permission_check_passes_authenticated(user):
allow_use_notifications(user)
def test_allow_use_notifications_permission_check_blocks_anonymous_users(
anonymous... | 483 | Python | .py | 11 | 40.181818 | 77 | 0.809013 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,448 | test_delete_user_account.py | rafalp_Misago/misago/notifications/tests/test_delete_user_account.py | import pytest
from ..models import Notification, WatchedThread
def test_user_delete_deletes_user_notifications(user, other_user):
notification = Notification.objects.create(
user=user,
actor=other_user,
actor_name=other_user.username,
verb="TEST",
)
user.delete(anonymous_... | 1,646 | Python | .py | 42 | 33.404762 | 81 | 0.731522 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,449 | test_watch_started_thread.py | rafalp_Misago/misago/notifications/tests/test_watch_started_thread.py | from ..models import WatchedThread
from ..threads import ThreadNotifications, watch_started_thread
def test_started_thread_is_watched_with_email_notifications(user, thread):
user.watch_started_threads = ThreadNotifications.SITE_AND_EMAIL
user.save()
watch_started_thread(user, thread)
watched_thread ... | 966 | Python | .py | 19 | 46.263158 | 77 | 0.785027 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,450 | clearnotifications.py | rafalp_Misago/misago/notifications/management/commands/clearnotifications.py | from datetime import timedelta
from django.core.management.base import BaseCommand
from django.utils import timezone
from ....conf.shortcuts import get_dynamic_settings
from ...models import Notification
class Command(BaseCommand):
help = "Deletes old notifications"
def handle(self, *args, **options):
... | 841 | Python | .py | 20 | 34.7 | 74 | 0.687961 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,451 | models.py | rafalp_Misago/misago/conf/models.py | from pathlib import Path
from django.db import models
from ..core.utils import get_file_hash
from .hydrators import dehydrate_value, hydrate_value
class SettingsManager(models.Manager):
def change_setting(self, setting, dry_value=None, wet_value=None):
if dry_value:
return self.filter(settin... | 2,365 | Python | .py | 61 | 30.278689 | 77 | 0.638149 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,452 | test.py | rafalp_Misago/misago/conf/test.py | from functools import wraps
from .dynamicsettings import DynamicSettings
class override_dynamic_settings:
def __init__(self, **settings):
self._overrides = settings
def __enter__(self):
DynamicSettings.override_settings(self._overrides)
def __exit__(self, *_):
DynamicSettings.re... | 538 | Python | .py | 15 | 28.266667 | 58 | 0.637597 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,453 | apps.py | rafalp_Misago/misago/conf/apps.py | from django.apps import AppConfig
class MisagoConfConfig(AppConfig):
name = "misago.conf"
label = "misago_conf"
verbose_name = "Misago Configuration"
| 164 | Python | .py | 5 | 29 | 41 | 0.751592 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,454 | context_processors.py | rafalp_Misago/misago/conf/context_processors.py | import json
from hashlib import sha256
from django.templatetags.static import static
from django.urls import reverse
from django.utils.translation import get_language
import misago
from ..auth.loginurl import get_login_url
from . import settings
# Simple but hard to guess version signature for current Misago versio... | 3,175 | Python | .py | 83 | 30.204819 | 85 | 0.637073 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,455 | dynamicsettings.py | rafalp_Misago/misago/conf/dynamicsettings.py | from .cache import get_settings_cache, set_settings_cache
from .models import Setting
class DynamicSettings:
_overrides = {}
def __init__(self, cache_versions):
self._settings = get_settings_cache(cache_versions)
if self._settings is None:
self._settings = get_settings_from_db()
... | 2,654 | Python | .py | 64 | 30.640625 | 80 | 0.589057 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,456 | cache.py | rafalp_Misago/misago/conf/cache.py | from django.core.cache import cache
from . import SETTINGS_CACHE
from ..cache.versions import invalidate_cache
def get_settings_cache(cache_versions):
key = get_cache_key(cache_versions)
return cache.get(key)
def set_settings_cache(cache_versions, user_settings):
key = get_cache_key(cache_versions)
... | 525 | Python | .py | 13 | 36.846154 | 69 | 0.763419 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,457 | defaults.py | rafalp_Misago/misago/conf/defaults.py | # pylint: disable=line-too-long
"""
Default Misago settings. Override these with settings in the module pointed to
by the DJANGO_SETTINGS_MODULE environment variable.
If you rely on any of those in your code, make sure you use `misago.conf.settings`
instead of Django's `django.conf.settings`.
"""
# Permissions system... | 6,456 | Python | .py | 194 | 29.458763 | 92 | 0.736221 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,458 | __init__.py | rafalp_Misago/misago/conf/__init__.py | from .staticsettings import StaticSettings
SETTINGS_CACHE = "settings"
settings = StaticSettings()
| 101 | Python | .py | 3 | 32 | 42 | 0.84375 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,459 | staticsettings.py | rafalp_Misago/misago/conf/staticsettings.py | from django.conf import settings
from . import defaults
class StaticSettings:
def __getattr__(self, name):
try:
return getattr(settings, name)
except AttributeError:
pass
try:
return getattr(defaults, name)
except AttributeError:
pa... | 389 | Python | .py | 13 | 21.461538 | 64 | 0.619946 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,460 | hydrators.py | rafalp_Misago/misago/conf/hydrators.py | # fixme: rename this module to serialize
def hydrate_string(dry_value):
return str(dry_value) if dry_value else ""
def dehydrate_string(wet_value):
return str(wet_value)
def hydrate_bool(dry_value):
return dry_value == "True"
def dehydrate_bool(wet_value):
return "True" if wet_value else "False"
... | 1,397 | Python | .py | 40 | 30.225 | 70 | 0.693923 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,461 | middleware.py | rafalp_Misago/misago/conf/middleware.py | from django.utils.functional import SimpleLazyObject
from .dynamicsettings import DynamicSettings
def dynamic_settings_middleware(get_response):
"""Sets request.settings attribute with DynamicSettings."""
def middleware(request):
def get_dynamic_settings():
return DynamicSettings(request... | 464 | Python | .py | 10 | 40 | 65 | 0.767857 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,462 | shortcuts.py | rafalp_Misago/misago/conf/shortcuts.py | from ..cache.versions import get_cache_versions
from .dynamicsettings import DynamicSettings
def get_dynamic_settings():
cache_versions = get_cache_versions()
return DynamicSettings(cache_versions)
| 208 | Python | .py | 5 | 38.6 | 47 | 0.810945 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,463 | 0004_create_settings.py | rafalp_Misago/misago/conf/migrations/0004_create_settings.py | # Generated by Django 2.2.1 on 2019-05-19 00:16
from django.conf import settings
from django.db import migrations
from ..hydrators import dehydrate_value
default_settings = [
{"setting": "account_activation", "dry_value": "none", "is_public": True},
{"setting": "allow_custom_avatars", "python_type": "bool", ... | 6,018 | Python | .py | 129 | 40.372093 | 88 | 0.600408 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,464 | 0005_add_sso_settings.py | rafalp_Misago/misago/conf/migrations/0005_add_sso_settings.py | # Generated by Django 2.2.1 on 2019-05-19 00:16
from django.db import migrations
from ..hydrators import dehydrate_value
settings = [
{
"setting": "enable_sso",
"python_type": "bool",
"wet_value": False,
"is_public": True,
},
{"setting": "sso_public_key", "is_public": Fals... | 956 | Python | .py | 26 | 30.346154 | 60 | 0.619978 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,465 | 0009_delete_oauth2_access_token_method.py | rafalp_Misago/misago/conf/migrations/0009_delete_oauth2_access_token_method.py | from django.db import migrations
def delete_oauth2_token_method_setting(apps, _):
Setting = apps.get_model("misago_conf", "Setting")
Setting.objects.filter(setting="oauth2_token_method").delete()
class Migration(migrations.Migration):
dependencies = [
("misago_conf", "0008_delete_sso_settings"),... | 404 | Python | .py | 9 | 40.222222 | 75 | 0.733333 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,466 | 0006_add_index_message.py | rafalp_Misago/misago/conf/migrations/0006_add_index_message.py | # Generated by Django 3.2.15 on 2022-12-29 19:55
from django.db import migrations
def create_index_message_setting(apps, _):
Setting = apps.get_model("misago_conf", "Setting")
Setting.objects.create(setting="index_message", is_public=False)
class Migration(migrations.Migration):
dependencies = [
... | 441 | Python | .py | 10 | 39.7 | 69 | 0.729412 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,467 | 0012_add_oauth2_pkce_settings.py | rafalp_Misago/misago/conf/migrations/0012_add_oauth2_pkce_settings.py | # Generated by Django 4.2.8 on 2024-01-27 12:54
from django.db import migrations
from misago.conf.hydrators import dehydrate_value
settings = [
{
"setting": "oauth2_enable_pkce",
"python_type": "bool",
"wet_value": False,
"is_public": False,
},
{
"setting": "oauth2... | 1,210 | Python | .py | 34 | 29.088235 | 73 | 0.636052 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,468 | 0008_delete_sso_settings.py | rafalp_Misago/misago/conf/migrations/0008_delete_sso_settings.py | # Generated by Django 3.2.15 on 2023-01-04 12:37
from django.db import migrations
settings = (
"enable_sso",
"sso_public_key",
"sso_private_key",
"sso_url",
)
def delete_sso_settings(apps, _):
Setting = apps.get_model("misago_conf", "Setting")
Setting.objects.filter(setting__in=settings).del... | 509 | Python | .py | 16 | 27.625 | 60 | 0.691358 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,469 | 0003_simplify_models.py | rafalp_Misago/misago/conf/migrations/0003_simplify_models.py | # Generated by Django 2.2.1 on 2019-05-19 00:08
from django.db import migrations, models
from django.db.models import F
def set_default_dry_value(apps, _):
Setting = apps.get_model("misago_conf", "Setting")
Setting.objects.filter(dry_value__isnull=True, default_value__isnull=False).update(
dry_value=... | 2,004 | Python | .py | 48 | 32.041667 | 87 | 0.621026 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,470 | 0001_initial.py | rafalp_Misago/misago/conf/migrations/0001_initial.py | import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="Setting",
fields=[
(
"id",
... | 2,509 | Python | .py | 64 | 23.953125 | 84 | 0.475215 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,471 | 0011_add_notifications_settings.py | rafalp_Misago/misago/conf/migrations/0011_add_notifications_settings.py | # Generated by Django 3.2.15 on 2023-04-02 17:57
from django.db import migrations
from ...notifications.threads import ThreadNotifications
from ..hydrators import dehydrate_value
settings = [
{
"setting": "watch_started_threads",
"python_type": "int",
"dry_value": ThreadNotifications.SIT... | 2,168 | Python | .py | 66 | 26.090909 | 87 | 0.613397 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,472 | 0007_add_oauth2_settings.py | rafalp_Misago/misago/conf/migrations/0007_add_oauth2_settings.py | # Generated by Django 3.2.15 on 2023-01-04 12:36
from django.db import migrations
from ..hydrators import dehydrate_value
settings = [
{
"setting": "enable_oauth2_client",
"python_type": "bool",
"wet_value": False,
"is_public": True,
},
{"setting": "oauth2_provider", "is_p... | 2,340 | Python | .py | 61 | 31.836066 | 84 | 0.589868 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,473 | 0002_cache_version.py | rafalp_Misago/misago/conf/migrations/0002_cache_version.py | # Generated by Django 1.11.16 on 2018-12-02 15:54
from django.db import migrations
from .. import SETTINGS_CACHE
from ...cache.operations import StartCacheVersioning
class Migration(migrations.Migration):
dependencies = [("misago_conf", "0001_initial"), ("misago_cache", "0001_initial")]
operations = [StartC... | 352 | Python | .py | 7 | 47.571429 | 86 | 0.771261 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,474 | 0014_add_threads_lists_settings.py | rafalp_Misago/misago/conf/migrations/0014_add_threads_lists_settings.py | # Generated by Django 4.2.10 on 2024-07-03 17:12
from django.db import migrations
from ...threads.enums import ThreadsListsPolling
settings = {
"threads_list_item_categories_component": {
"dry_value": "breadcrumbs",
},
"threads_list_categories_component": {
"dry_value": "dropdown",
},
... | 974 | Python | .py | 27 | 30.962963 | 71 | 0.680556 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,475 | 0010_add_admin_link_setting.py | rafalp_Misago/misago/conf/migrations/0010_add_admin_link_setting.py | # Generated by Django 3.2.15 on 2023-04-04 18:29
from django.db import migrations
from ..hydrators import dehydrate_value
setting = {
"setting": "show_admin_panel_link_in_ui",
"python_type": "bool",
"wet_value": True,
"is_public": False,
}
def create_settings(apps, _):
Setting = apps.get_model(... | 944 | Python | .py | 25 | 32.76 | 80 | 0.685777 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,476 | 0013_add_index_view_setting.py | rafalp_Misago/misago/conf/migrations/0013_add_index_view_setting.py | # Generated by Django 4.2.10 on 2024-06-20 21:30
from django.conf import settings
from django.db import migrations
THREADS_ON_INDEX = getattr(settings, "MISAGO_THREADS_ON_INDEX", True)
def create_setting(apps, _):
Setting = apps.get_model("misago_conf", "Setting")
Setting.objects.create(
setting="in... | 772 | Python | .py | 19 | 35.736842 | 71 | 0.707941 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,477 | conftest.py | rafalp_Misago/misago/conf/tests/conftest.py | import pytest
from ..models import Setting
@pytest.fixture
def lazy_setting(db):
return Setting.objects.create(
setting="lazy_setting", dry_value="Hello", is_lazy=True
)
@pytest.fixture
def lazy_setting_without_value(db):
return Setting.objects.create(setting="lazy_setting", dry_value="", is_la... | 634 | Python | .py | 20 | 27.65 | 85 | 0.728926 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,478 | test_getting_static_settings_values.py | rafalp_Misago/misago/conf/tests/test_getting_static_settings_values.py | import pytest
from django.test import override_settings
def test_accessing_attr_returns_setting_value_defined_in_settings_file(settings):
assert settings.STATIC_URL
def test_accessing_attr_returns_setting_value_defined_in_misago_defaults_file(settings):
assert settings.MISAGO_MOMENT_JS_LOCALES
def test_se... | 1,027 | Python | .py | 18 | 52.277778 | 88 | 0.782347 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,479 | test_hydrators.py | rafalp_Misago/misago/conf/tests/test_hydrators.py | from unittest.mock import Mock
import pytest
from ..hydrators import dehydrate_value, hydrate_value
def test_string_value_can_be_dehydrated_and_hydrated_back():
assert hydrate_value("string", dehydrate_value("string", "test")) == "test"
def test_int_value_is_dehydrated_to_string():
assert dehydrate_value(... | 2,829 | Python | .py | 51 | 51.372549 | 83 | 0.715959 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,480 | test_context_processors.py | rafalp_Misago/misago/conf/tests/test_context_processors.py | from unittest.mock import Mock
from ..context_processors import conf
from ..test import override_dynamic_settings
def test_request_settings_are_included_in_template_context(db, dynamic_settings):
mock_request = Mock(settings=dynamic_settings)
context_settings = conf(mock_request)["settings"]
assert conte... | 1,793 | Python | .py | 36 | 45.833333 | 83 | 0.732491 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,481 | test_getting_dynamic_settings_values.py | rafalp_Misago/misago/conf/tests/test_getting_dynamic_settings_values.py | import pytest
from .. import SETTINGS_CACHE
from ..dynamicsettings import DynamicSettings
def test_settings_are_loaded_from_database_if_cache_is_not_available(
db, mocker, cache_versions, django_assert_num_queries
):
mocker.patch("django.core.cache.cache.get", return_value=None)
with django_assert_num_qu... | 4,760 | Python | .py | 106 | 40.320755 | 88 | 0.754223 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,482 | test_dynamic_settings_middleware.py | rafalp_Misago/misago/conf/tests/test_dynamic_settings_middleware.py | from unittest.mock import Mock
import pytest
from django.utils.functional import SimpleLazyObject
from ..middleware import dynamic_settings_middleware
@pytest.fixture
def get_response():
return Mock()
class PlainRequest:
pass
@pytest.fixture
def plain_request():
return PlainRequest()
def test_midd... | 1,493 | Python | .py | 37 | 36.378378 | 87 | 0.777469 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,483 | test_overridding_dynamic_settings.py | rafalp_Misago/misago/conf/tests/test_overridding_dynamic_settings.py | from ..dynamicsettings import DynamicSettings
from ..test import override_dynamic_settings
def test_dynamic_setting_can_be_overridden_using_context_manager(dynamic_settings):
assert dynamic_settings.forum_name == "Misago"
with override_dynamic_settings(forum_name="Overrided"):
assert dynamic_settings.... | 1,711 | Python | .py | 32 | 48.65625 | 83 | 0.756741 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,484 | test_model_value_prop.py | rafalp_Misago/misago/conf/tests/test_model_value_prop.py | from ..models import Setting
def test_setting_value_is_hydrated_by_getter(db):
setting = Setting(python_type="list", dry_value="lorem,ipsum")
assert setting.value == ["lorem", "ipsum"]
def test_setting_value_is_dehydrated_by_setter(db):
setting = Setting(python_type="list")
setting.value = ["lorem",... | 550 | Python | .py | 12 | 41.666667 | 66 | 0.712406 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,485 | __init__.py | rafalp_Misago/misago/conf/admin/__init__.py | from django.urls import path
from django.utils.translation import pgettext_lazy
from .views import (
AnalyticsSettingsView,
CaptchaSettingsView,
GeneralSettingsView,
NotificationsSettingsView,
OAuth2SettingsView,
ThreadsSettingsView,
UsersSettingsView,
index,
)
class MisagoAdminExtens... | 4,161 | Python | .py | 117 | 24.384615 | 139 | 0.559822 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,486 | views.py | rafalp_Misago/misago/conf/admin/views.py | from django.contrib import messages
from django.shortcuts import redirect
from django.utils.translation import pgettext
from ...admin.views import render
from ...admin.views.generic import AdminView
from ..models import Setting
from .forms import (
AnalyticsSettingsForm,
CaptchaSettingsForm,
GeneralSetting... | 3,150 | Python | .py | 74 | 35.162162 | 84 | 0.700656 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,487 | users.py | rafalp_Misago/misago/conf/admin/forms/users.py | from django import forms
from django.utils.translation import npgettext_lazy, pgettext_lazy
from ....admin.forms import YesNoSwitch
from ....core.validators import validate_image_square
from ....users.validators import validate_username_content
from ... import settings
from .base import SettingsForm
class UsersSetti... | 11,472 | Python | .py | 315 | 25.088889 | 305 | 0.556154 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,488 | general.py | rafalp_Misago/misago/conf/admin/forms/general.py | from django import forms
from django.utils.translation import pgettext_lazy
from ....admin.forms import YesNoSwitch
from ....forumindex.views import index_views
from .base import SettingsForm
class GeneralSettingsForm(SettingsForm):
settings = [
"forum_name",
"forum_address",
"index_heade... | 6,866 | Python | .py | 168 | 32.220238 | 231 | 0.632162 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,489 | captcha.py | rafalp_Misago/misago/conf/admin/forms/captcha.py | from django import forms
from django.utils.translation import pgettext_lazy
from ....admin.forms import YesNoSwitch
from .base import SettingsForm
class CaptchaSettingsForm(SettingsForm):
settings = [
"captcha_type",
"recaptcha_site_key",
"recaptcha_secret_key",
"qa_question",
... | 4,603 | Python | .py | 115 | 28.269565 | 303 | 0.564469 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,490 | analytics.py | rafalp_Misago/misago/conf/admin/forms/analytics.py | import re
from django import forms
from django.utils.translation import pgettext_lazy
from .base import SettingsForm
GOOGLE_SITE_VERIFICATION = re.compile(
r"^google-site-verification: google([0-9a-z]+)\.html$"
)
class AnalyticsSettingsForm(SettingsForm):
settings = ["google_tracking_id", "google_site_veri... | 2,658 | Python | .py | 62 | 33.241935 | 148 | 0.640232 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,491 | __init__.py | rafalp_Misago/misago/conf/admin/forms/__init__.py | from .analytics import AnalyticsSettingsForm
from .base import SettingsForm
from .captcha import CaptchaSettingsForm
from .general import GeneralSettingsForm
from .notifications import NotificationsSettingsForm
from .oauth2 import OAuth2SettingsForm
from .threads import ThreadsSettingsForm
from .users import UsersSetti... | 328 | Python | .py | 8 | 40 | 52 | 0.9 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,492 | base.py | rafalp_Misago/misago/conf/admin/forms/base.py | from django import forms
from ...cache import clear_settings_cache
class SettingsForm(forms.Form):
settings = []
def __init__(self, *args, **kwargs):
self.request = kwargs.pop("request")
super().__init__(*args, **kwargs)
def save(self, settings):
self.save_settings(settings)
... | 1,322 | Python | .py | 34 | 29.117647 | 72 | 0.599374 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,493 | threads.py | rafalp_Misago/misago/conf/admin/forms/threads.py | from django import forms
from django.utils.translation import pgettext_lazy
from ....categories.enums import CategoryChildrenComponent
from ....threads.enums import ThreadsListsPolling
from .base import SettingsForm
class ThreadsSettingsForm(SettingsForm):
settings = [
"attachment_403_image",
"at... | 8,394 | Python | .py | 209 | 30.578947 | 303 | 0.621651 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,494 | oauth2.py | rafalp_Misago/misago/conf/admin/forms/oauth2.py | from django import forms
from django.contrib import messages
from django.utils.translation import pgettext, pgettext_lazy
from ....admin.forms import YesNoSwitch
from .base import SettingsForm
OAUTH2_OPTIONAL_FIELDS = (
"oauth2_enable_pkce",
"oauth2_token_extra_headers",
"oauth2_user_extra_headers",
"... | 11,464 | Python | .py | 291 | 29.130584 | 253 | 0.588246 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,495 | notifications.py | rafalp_Misago/misago/conf/admin/forms/notifications.py | from django import forms
from django.utils.translation import pgettext_lazy
from ....notifications.threads import ThreadNotifications
from .base import SettingsForm
class NotificationsSettingsForm(SettingsForm):
settings = [
"watch_started_threads",
"watch_replied_threads",
"watch_new_pri... | 2,984 | Python | .py | 79 | 29.189873 | 88 | 0.658385 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,496 | conftest.py | rafalp_Misago/misago/conf/admin/tests/conftest.py | import pytest
from ...models import Setting
@pytest.fixture
def setting(db):
return Setting.objects.get(setting="forum_name")
| 133 | Python | .py | 5 | 24.2 | 52 | 0.792 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,497 | test_image_setting_handling.py | rafalp_Misago/misago/conf/admin/tests/test_image_setting_handling.py | import os
import pytest
from django.urls import reverse
from ....test import assert_contains
from ...models import Setting
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
IMAGE = os.path.join(BASE_DIR, "testfiles", "image.png")
OTHER_IMAGE = os.path.join(BASE_DIR, "testfiles", "image-other.png")
OTHER_FILE = o... | 7,375 | Python | .py | 202 | 27.049505 | 85 | 0.578186 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,498 | test_settings_grid.py | rafalp_Misago/misago/conf/admin/tests/test_settings_grid.py | from django.urls import reverse
from ....test import assert_contains
def test_link_is_registered_in_admin_nav(admin_client):
response = admin_client.get(reverse("misago:admin:index"))
assert_contains(response, reverse("misago:admin:settings:index"))
def test_settings_grid_renders(admin_client):
respons... | 420 | Python | .py | 8 | 48.875 | 71 | 0.771499 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |
18,499 | test_change_settings_form.py | rafalp_Misago/misago/conf/admin/tests/test_change_settings_form.py | from django import forms
from ....cache.test import assert_invalidates_cache
from ... import SETTINGS_CACHE
from ..forms import SettingsForm
class Form(SettingsForm):
settings = ["forum_name"]
forum_name = forms.CharField(max_length=255)
def test_form_updates_setting_on_save(setting):
form = Form({"fo... | 745 | Python | .py | 18 | 36.777778 | 62 | 0.710306 | rafalp/Misago | 2,519 | 524 | 136 | GPL-2.0 | 9/5/2024, 5:12:22 PM (Europe/Amsterdam) |