Skip to content

Commit

Permalink
Merge pull request #69 from onaio/pytz-deprecated
Browse files Browse the repository at this point in the history
Remove pytz
  • Loading branch information
FrankApiyo authored Sep 19, 2024
2 parents fc127ab + d89cde0 commit 25aaea5
Show file tree
Hide file tree
Showing 6 changed files with 487 additions and 376 deletions.
851 changes: 479 additions & 372 deletions Pipfile.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions oidc/apps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Application Module for oidc app
"""

from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _

Expand Down
1 change: 1 addition & 0 deletions oidc/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Client module for the oidc app
"""

import json
import secrets
from typing import Optional
Expand Down
1 change: 1 addition & 0 deletions oidc/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
URL Configuration file for ona-oidc
"""

from django.conf import settings
from django.urls import re_path

Expand Down
5 changes: 3 additions & 2 deletions oidc/viewsets.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
oidc Viewsets module
"""

import importlib
import re
from typing import Optional, Tuple
Expand All @@ -14,6 +15,7 @@
HttpResponseBadRequest,
HttpResponseRedirect,
)
from django.utils import timezone
from django.utils.translation import gettext as _

import jwt
Expand Down Expand Up @@ -410,15 +412,14 @@ class RapidProOpenIDConnectViewset(BaseOpenIDConnectViewset):

def create_login_user(self, user_data: dict):
Org = importlib.import_module("temba").orgs.models.Org
timezone = importlib.import_module("pytz").timezone
org_name = user_data.pop("username")
user_data["username"] = user_data.get("email")

org_data = {
"name": org_name,
"slug": Org.get_unique_slug(org_name),
"brand": settings.DEFAULT_BRAND,
"timezone": timezone("UTC"),
"timezone": f"{timezone.utc}",
}
user = self.user_model.objects.create(**user_data)

Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ basepython = python3.9
commands =
pipenv sync --dev
flake8 {toxinidir}/oidc
black -v oidc --check -t py38 -t py39
isort -c -v .
black -v {toxinidir}/oidc --check -t py38 -t py39
isort -c -v {toxinidir}/oidc

[testenv]
deps =
Expand Down

0 comments on commit 25aaea5

Please sign in to comment.