Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring code for Django 4.2 #4073

Open
wants to merge 9 commits into
base: zubair-django-oscar322-update
Choose a base branch
from

Conversation

mumarkhan999
Copy link
Member

⛔️ MAIN BRANCH WARNING! 2U EMPLOYEES must make branches against the 2u/main BRANCH

  • I have checked the branch to which I would like to merge.

⛔️ DEPRECATION WARNING

This repository is deprecated and in maintainence-only operation while we work on a replacement, please see this announcement for more information.

Although we have stopped integrating new contributions, we always appreciate security disclosures and patches sent to security@edx.org

Anyone internally merging to this repository is expected to release and monitor their changes; if you are not able to do this DO NOT MERGE, please coordinate with someone who can to ensure that the changes are released.

Required Testing

  • Before deploying this change, complete a purchase in the stage environment.
    (^ We can remove that manual check once REV-2624 is done and the corresponding e2e test runs again)

Description

Describe what this pull request changes, and why these changes were made. How will these changes affect other people, installations of edx, etc.?
Please include links to any relevant ADRs, design artifacts, and decision documents. Make sure to document the rationale behind significant changes in the repo, per OEP-19, and can be
linked here.

Useful information to include:

  • Which edX user roles will this change impact? Common user roles are "Learner", "Course Author", "Developer", and "Operator".
  • Include screenshots for changes to the UI (ideally, both "before" and "after" screenshots, if applicable).
  • Provide links to the description of corresponding configuration changes. Remember to correctly annotate these changes.

Supporting information

Link to other information about the change, such as Jira issues, GitHub issues, or Discourse discussions.
Be sure to check they are publicly readable, or if not, repeat the information here.

Testing instructions

Please provide detailed step-by-step instructions for testing this change; how did YOU test this change?

Other information

Include anything else that will help reviewers and consumers understand the change.

  • Does this change depend on other changes elsewhere?
  • Any special concerns or limitations? For example: deprecations, migrations, OpenEdx vs. edx.org differences, development vs. production environment differences, security, or accessibility.

Copy link
Member

@UsamaSadiq UsamaSadiq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small suggestions, otherwise looking good.

@@ -40,5 +40,5 @@ def process_view(self, request, view_func, view_args, view_kwargs): # pylint: d
# If the user does not already have an LMS user id, add it
called_from = u'middleware with request path: {request}, referrer: {referrer}'.format(
request=request.get_full_path(),
referrer=request.META.get('HTTP_REFERER'))
referrer=request.headers.get('referer'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can skip this change for now as both are supported with Django 42

@@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [master]
branches: ['*']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change intentional? If yes, we can instead use only the headers to achieve the same purpose so following will work as well for all branches

on: 
    push:
    pull_request:

@@ -5,7 +5,7 @@ on:
pull_request:
push:
branches:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly this can also be changed to only following:

on: 
   push:

@@ -34,7 +34,7 @@ class StripeWebhooksView(APIView):
@csrf_exempt
def post(self, request):
payload = request.body
sig_header = request.META['HTTP_STRIPE_SIGNATURE']
sig_header = request.headers['stripe-signature']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can skip this change for Django 42 support as well.

Suggested change
sig_header = request.headers['stripe-signature']
sig_header = request.META['HTTP_STRIPE_SIGNATURE']

@@ -31,7 +31,7 @@ class Command(BaseCommand):
help = 'Compile and collect assets'

# NOTE (CCB): This allows us to compile static assets in Docker containers without database access.
requires_system_checks = False
requires_system_checks = []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change intentional?

enterprise_views.EnterpriseCustomerCatalogsViewSet.as_view({'get': 'get'}),
name='enterprise_customer_catalogs'
),
url(
r'^customer_catalogs/(?P<enterprise_catalog_uuid>[^/]+)$',
path(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
path(
re_path(

url(
r'^customer_catalogs/(?P<enterprise_catalog_uuid>[^/]+)$',
path(
'customer_catalogs/<str:enterprise_catalog_uuid>',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'customer_catalogs/<str:enterprise_catalog_uuid>',
r'^customer_catalogs/(?P<enterprise_catalog_uuid>[^/]+)$',

@mumarkhan999 mumarkhan999 changed the title Upgrade django 42 Refactoring code for Django 4.2 Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants