Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ To start handling GitHub webhooks, create your event handlers in a new file (e.g

```python
# your_app/events.py
from django_github_app.routing import Router
from django_github_app.routing import GitHubRouter

gh = Router()
gh = GitHubRouter()

# Handle any issue event
@gh.event("issues")
Expand Down
4 changes: 2 additions & 2 deletions src/django_github_app/events/installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from django_github_app.models import Installation
from django_github_app.models import InstallationStatus
from django_github_app.models import Repository
from django_github_app.routing import Router
from django_github_app.routing import GitHubRouter

gh = Router()
gh = GitHubRouter()


@gh.event("installation", action="created")
Expand Down
4 changes: 2 additions & 2 deletions src/django_github_app/events/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from gidgethub.abc import GitHubAPI

from django_github_app.models import Repository
from django_github_app.routing import Router
from django_github_app.routing import GitHubRouter

gh = Router()
gh = GitHubRouter()


@gh.event("repository", action="renamed")
Expand Down
4 changes: 2 additions & 2 deletions src/django_github_app/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
from gidgethub.routing import Router as GidgetHubRouter


class Router:
class GitHubRouter:
_routers: list[GidgetHubRouter] = []

def __init__(self) -> None:
self.router = GidgetHubRouter()
Router._routers.append(self.router)
GitHubRouter._routers.append(self.router)

@classproperty
def routers(cls):
Expand Down
4 changes: 2 additions & 2 deletions src/django_github_app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from .github import SyncGitHubAPI
from .models import EventLog
from .models import Installation
from .routing import Router
from .routing import GitHubRouter

GitHubAPIType = TypeVar("GitHubAPIType", AsyncGitHubAPI, SyncGitHubAPI)

Expand Down Expand Up @@ -59,7 +59,7 @@ def get_response(self, event_log: EventLog) -> JsonResponse:

@property
def router(self) -> GidgetHubRouter:
return GidgetHubRouter(*Router.routers)
return GidgetHubRouter(*GitHubRouter.routers)

@abstractmethod
def post(
Expand Down
6 changes: 3 additions & 3 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from django_github_app.github import AsyncGitHubAPI
from django_github_app.github import SyncGitHubAPI
from django_github_app.models import EventLog
from django_github_app.routing import Router
from django_github_app.routing import GitHubRouter
from django_github_app.views import AsyncWebhookView
from django_github_app.views import BaseWebhookView
from django_github_app.views import SyncWebhookView
Expand Down Expand Up @@ -70,9 +70,9 @@ def _make_request(

@pytest.fixture
def test_router():
router = Router()
router = GitHubRouter()
yield router
Router._routers.remove(router.router)
GitHubRouter._routers.remove(router.router)


class TestWebhookView(BaseWebhookView):
Expand Down