From c1170848c1287c3cdd0cd327c89da120a289ce1c Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Wed, 1 Dec 2021 11:50:27 +0530 Subject: [PATCH 1/2] fix: Compatibility fixes for Frappe v13, develop & Py3 --- .../doctype/esoc_applicant/esoc_applicant.py | 4 ++-- .../doctype/foundation_project/foundation_project.py | 2 +- .../doctype/service_provider/service_provider.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/foundation/erpnext_foundation/doctype/esoc_applicant/esoc_applicant.py b/foundation/erpnext_foundation/doctype/esoc_applicant/esoc_applicant.py index ddd14e17..100975c8 100644 --- a/foundation/erpnext_foundation/doctype/esoc_applicant/esoc_applicant.py +++ b/foundation/erpnext_foundation/doctype/esoc_applicant/esoc_applicant.py @@ -14,8 +14,8 @@ class ESoCApplicant(Document): self.validate_agreement_check() def validate_email_type(self, email): - from frappe.utils import validate_email_add - validate_email_add(email.strip(), True) + from frappe.utils import validate_email_address + validate_email_address(email.strip(), True) def validate_dob(self): from frappe.utils import now_datetime, getdate diff --git a/foundation/erpnext_foundation/doctype/foundation_project/foundation_project.py b/foundation/erpnext_foundation/doctype/foundation_project/foundation_project.py index e6ce66f6..2af31cf7 100644 --- a/foundation/erpnext_foundation/doctype/foundation_project/foundation_project.py +++ b/foundation/erpnext_foundation/doctype/foundation_project/foundation_project.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals # import frappe from frappe.model.document import Document -from frappe.website.render import clear_cache as clear_website_cache +from frappe.website.utils import clear_cache as clear_website_cache class FoundationProject(Document): def validate(self): diff --git a/foundation/erpnext_foundation/doctype/service_provider/service_provider.py b/foundation/erpnext_foundation/doctype/service_provider/service_provider.py index 912614fd..fbb3ed32 100644 --- a/foundation/erpnext_foundation/doctype/service_provider/service_provider.py +++ b/foundation/erpnext_foundation/doctype/service_provider/service_provider.py @@ -25,6 +25,6 @@ def get_last_login_diff(user): Returns difference between todays date and last login date """ last_login = frappe.db.get_value("User", user, ["last_login"]) - for x in xrange(1,10): + for x in range(1,10): print((get_datetime() - get_datetime(last_login)).days, user) return (get_datetime() - get_datetime(last_login)).days From 60813b63acc763011b61051c23fd34adbfb06603 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Wed, 1 Dec 2021 12:04:39 +0530 Subject: [PATCH 2/2] chore: Remove unused, redefined imports tx autoflake, flake8, pylint --- foundation/erpnext_foundation/doctype/bounty/bounty.py | 1 - foundation/erpnext_foundation/doctype/bounty/test_bounty.py | 1 - .../conference_participant/test_conference_participant.py | 1 - .../doctype/conference_settings/conference_settings.py | 1 - .../conference_talk_proposal/test_conference_talk_proposal.py | 1 - .../doctype/developer_sprint/test_developer_sprint.py | 1 - .../doctype/esoc_project_detail/esoc_project_detail.py | 1 - .../doctype/foundation_fellowship/test_foundation_fellowship.py | 1 - foundation/erpnext_foundation/doctype/frappe_app/frappe_app.py | 1 - .../erpnext_foundation/doctype/frappe_app/test_frappe_app.py | 1 - .../erpnext_foundation/doctype/portal_event/portal_event.py | 1 - .../erpnext_foundation/doctype/portal_event/test_portal_event.py | 1 - .../erpnext_foundation/doctype/portal_job/test_portal_job.py | 1 - .../doctype/service_provider/test_service_provider.py | 1 - .../conference_ticket_confirmation.py | 1 - .../erpnext_foundation/web_form/add_edit_app/add_edit_app.py | 1 - foundation/erpnext_foundation/web_form/add_event/add_event.py | 1 - .../erpnext_foundation/web_form/apply_for_esoc/apply_for_esoc.py | 1 - .../web_form/back_this_bounty/back_this_bounty.py | 1 - .../web_form/back_this_bounty_usd/back_this_bounty_usd.py | 1 - .../web_form/buy_tickets_inr/buy_tickets_inr.py | 1 - .../web_form/buy_tickets_paypal/buy_tickets_paypal.py | 1 - .../conference_talk_proposal/conference_talk_proposal.py | 1 - .../web_form/developer_sprint/developer_sprint.py | 1 - foundation/erpnext_foundation/web_form/jobs/jobs.py | 1 - .../erpnext_foundation/web_form/memberships/memberships.py | 1 - .../web_form/memberships_usd/memberships_usd.py | 1 - .../erpnext_foundation/web_form/request_a_call/request_a_call.py | 1 - .../web_form/service_provider/service_provider.py | 1 - .../web_form/start_a_new_bounty/start_a_new_bounty.py | 1 - foundation/migrate.py | 1 - foundation/www/conf/2019/talks.py | 1 - foundation/www/members/setup_payment.py | 1 - 33 files changed, 33 deletions(-) diff --git a/foundation/erpnext_foundation/doctype/bounty/bounty.py b/foundation/erpnext_foundation/doctype/bounty/bounty.py index 59e5c9b6..8f967fc4 100644 --- a/foundation/erpnext_foundation/doctype/bounty/bounty.py +++ b/foundation/erpnext_foundation/doctype/bounty/bounty.py @@ -5,7 +5,6 @@ from __future__ import unicode_literals import frappe from frappe.model.document import Document -from frappe.website.utils import get_comment_list from frappe.utils import date_diff, nowdate, fmt_money, add_months from frappe.website.utils import get_comment_list diff --git a/foundation/erpnext_foundation/doctype/bounty/test_bounty.py b/foundation/erpnext_foundation/doctype/bounty/test_bounty.py index 0f925c53..fa65ad98 100644 --- a/foundation/erpnext_foundation/doctype/bounty/test_bounty.py +++ b/foundation/erpnext_foundation/doctype/bounty/test_bounty.py @@ -3,7 +3,6 @@ # See license.txt from __future__ import unicode_literals -import frappe import unittest class TestBounty(unittest.TestCase): diff --git a/foundation/erpnext_foundation/doctype/conference_participant/test_conference_participant.py b/foundation/erpnext_foundation/doctype/conference_participant/test_conference_participant.py index 812e3bb4..bc288f5d 100644 --- a/foundation/erpnext_foundation/doctype/conference_participant/test_conference_participant.py +++ b/foundation/erpnext_foundation/doctype/conference_participant/test_conference_participant.py @@ -3,7 +3,6 @@ # See license.txt from __future__ import unicode_literals -import frappe import unittest class TestConferenceParticipant(unittest.TestCase): diff --git a/foundation/erpnext_foundation/doctype/conference_settings/conference_settings.py b/foundation/erpnext_foundation/doctype/conference_settings/conference_settings.py index 062168fe..1a795ac9 100644 --- a/foundation/erpnext_foundation/doctype/conference_settings/conference_settings.py +++ b/foundation/erpnext_foundation/doctype/conference_settings/conference_settings.py @@ -3,7 +3,6 @@ # For license information, please see license.txt from __future__ import unicode_literals -import frappe from frappe.model.document import Document class ConferenceSettings(Document): diff --git a/foundation/erpnext_foundation/doctype/conference_talk_proposal/test_conference_talk_proposal.py b/foundation/erpnext_foundation/doctype/conference_talk_proposal/test_conference_talk_proposal.py index bf6209f6..48147e5c 100644 --- a/foundation/erpnext_foundation/doctype/conference_talk_proposal/test_conference_talk_proposal.py +++ b/foundation/erpnext_foundation/doctype/conference_talk_proposal/test_conference_talk_proposal.py @@ -3,7 +3,6 @@ # See license.txt from __future__ import unicode_literals -import frappe import unittest class TestConferenceTalkProposal(unittest.TestCase): diff --git a/foundation/erpnext_foundation/doctype/developer_sprint/test_developer_sprint.py b/foundation/erpnext_foundation/doctype/developer_sprint/test_developer_sprint.py index 0cd212cc..9f766e14 100644 --- a/foundation/erpnext_foundation/doctype/developer_sprint/test_developer_sprint.py +++ b/foundation/erpnext_foundation/doctype/developer_sprint/test_developer_sprint.py @@ -3,7 +3,6 @@ # See license.txt from __future__ import unicode_literals -import frappe import unittest class TestDeveloperSprint(unittest.TestCase): diff --git a/foundation/erpnext_foundation/doctype/esoc_project_detail/esoc_project_detail.py b/foundation/erpnext_foundation/doctype/esoc_project_detail/esoc_project_detail.py index 7e82bd01..25a16745 100644 --- a/foundation/erpnext_foundation/doctype/esoc_project_detail/esoc_project_detail.py +++ b/foundation/erpnext_foundation/doctype/esoc_project_detail/esoc_project_detail.py @@ -3,7 +3,6 @@ # For license information, please see license.txt from __future__ import unicode_literals -import frappe from frappe.model.document import Document class ESoCProjectDetail(Document): diff --git a/foundation/erpnext_foundation/doctype/foundation_fellowship/test_foundation_fellowship.py b/foundation/erpnext_foundation/doctype/foundation_fellowship/test_foundation_fellowship.py index be738143..cdf70291 100644 --- a/foundation/erpnext_foundation/doctype/foundation_fellowship/test_foundation_fellowship.py +++ b/foundation/erpnext_foundation/doctype/foundation_fellowship/test_foundation_fellowship.py @@ -3,7 +3,6 @@ # See license.txt from __future__ import unicode_literals -import frappe import unittest class TestFoundationFellowship(unittest.TestCase): diff --git a/foundation/erpnext_foundation/doctype/frappe_app/frappe_app.py b/foundation/erpnext_foundation/doctype/frappe_app/frappe_app.py index cf72af17..da66edac 100644 --- a/foundation/erpnext_foundation/doctype/frappe_app/frappe_app.py +++ b/foundation/erpnext_foundation/doctype/frappe_app/frappe_app.py @@ -3,7 +3,6 @@ # For license information, please see license.txt from __future__ import unicode_literals -import frappe from frappe.website.website_generator import WebsiteGenerator class FrappeApp(WebsiteGenerator): diff --git a/foundation/erpnext_foundation/doctype/frappe_app/test_frappe_app.py b/foundation/erpnext_foundation/doctype/frappe_app/test_frappe_app.py index e4d93932..645d1dfc 100644 --- a/foundation/erpnext_foundation/doctype/frappe_app/test_frappe_app.py +++ b/foundation/erpnext_foundation/doctype/frappe_app/test_frappe_app.py @@ -3,7 +3,6 @@ # See license.txt from __future__ import unicode_literals -import frappe import unittest class TestFrappeApp(unittest.TestCase): diff --git a/foundation/erpnext_foundation/doctype/portal_event/portal_event.py b/foundation/erpnext_foundation/doctype/portal_event/portal_event.py index beaa4c96..d151dfc7 100644 --- a/foundation/erpnext_foundation/doctype/portal_event/portal_event.py +++ b/foundation/erpnext_foundation/doctype/portal_event/portal_event.py @@ -3,7 +3,6 @@ # For license information, please see license.txt from __future__ import unicode_literals -import frappe from frappe.website.website_generator import WebsiteGenerator diff --git a/foundation/erpnext_foundation/doctype/portal_event/test_portal_event.py b/foundation/erpnext_foundation/doctype/portal_event/test_portal_event.py index c1cc13e6..24dbe153 100644 --- a/foundation/erpnext_foundation/doctype/portal_event/test_portal_event.py +++ b/foundation/erpnext_foundation/doctype/portal_event/test_portal_event.py @@ -3,7 +3,6 @@ # See license.txt from __future__ import unicode_literals -import frappe import unittest # test_records = frappe.get_test_records('Portal Event') diff --git a/foundation/erpnext_foundation/doctype/portal_job/test_portal_job.py b/foundation/erpnext_foundation/doctype/portal_job/test_portal_job.py index 6889409d..baa55338 100644 --- a/foundation/erpnext_foundation/doctype/portal_job/test_portal_job.py +++ b/foundation/erpnext_foundation/doctype/portal_job/test_portal_job.py @@ -3,7 +3,6 @@ # See license.txt from __future__ import unicode_literals -import frappe import unittest # test_records = frappe.get_test_records('Portal Job') diff --git a/foundation/erpnext_foundation/doctype/service_provider/test_service_provider.py b/foundation/erpnext_foundation/doctype/service_provider/test_service_provider.py index c26c575c..0d70c260 100644 --- a/foundation/erpnext_foundation/doctype/service_provider/test_service_provider.py +++ b/foundation/erpnext_foundation/doctype/service_provider/test_service_provider.py @@ -3,7 +3,6 @@ # See license.txt from __future__ import unicode_literals -import frappe import unittest # test_records = frappe.get_test_records('Service Provider') diff --git a/foundation/erpnext_foundation/notification/conference_ticket_confirmation/conference_ticket_confirmation.py b/foundation/erpnext_foundation/notification/conference_ticket_confirmation/conference_ticket_confirmation.py index 2334f8b2..f57de916 100644 --- a/foundation/erpnext_foundation/notification/conference_ticket_confirmation/conference_ticket_confirmation.py +++ b/foundation/erpnext_foundation/notification/conference_ticket_confirmation/conference_ticket_confirmation.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import frappe def get_context(context): # do your magic here diff --git a/foundation/erpnext_foundation/web_form/add_edit_app/add_edit_app.py b/foundation/erpnext_foundation/web_form/add_edit_app/add_edit_app.py index 2334f8b2..f57de916 100644 --- a/foundation/erpnext_foundation/web_form/add_edit_app/add_edit_app.py +++ b/foundation/erpnext_foundation/web_form/add_edit_app/add_edit_app.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import frappe def get_context(context): # do your magic here diff --git a/foundation/erpnext_foundation/web_form/add_event/add_event.py b/foundation/erpnext_foundation/web_form/add_event/add_event.py index 2334f8b2..f57de916 100644 --- a/foundation/erpnext_foundation/web_form/add_event/add_event.py +++ b/foundation/erpnext_foundation/web_form/add_event/add_event.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import frappe def get_context(context): # do your magic here diff --git a/foundation/erpnext_foundation/web_form/apply_for_esoc/apply_for_esoc.py b/foundation/erpnext_foundation/web_form/apply_for_esoc/apply_for_esoc.py index 2334f8b2..f57de916 100644 --- a/foundation/erpnext_foundation/web_form/apply_for_esoc/apply_for_esoc.py +++ b/foundation/erpnext_foundation/web_form/apply_for_esoc/apply_for_esoc.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import frappe def get_context(context): # do your magic here diff --git a/foundation/erpnext_foundation/web_form/back_this_bounty/back_this_bounty.py b/foundation/erpnext_foundation/web_form/back_this_bounty/back_this_bounty.py index 2334f8b2..f57de916 100644 --- a/foundation/erpnext_foundation/web_form/back_this_bounty/back_this_bounty.py +++ b/foundation/erpnext_foundation/web_form/back_this_bounty/back_this_bounty.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import frappe def get_context(context): # do your magic here diff --git a/foundation/erpnext_foundation/web_form/back_this_bounty_usd/back_this_bounty_usd.py b/foundation/erpnext_foundation/web_form/back_this_bounty_usd/back_this_bounty_usd.py index 2334f8b2..f57de916 100644 --- a/foundation/erpnext_foundation/web_form/back_this_bounty_usd/back_this_bounty_usd.py +++ b/foundation/erpnext_foundation/web_form/back_this_bounty_usd/back_this_bounty_usd.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import frappe def get_context(context): # do your magic here diff --git a/foundation/erpnext_foundation/web_form/buy_tickets_inr/buy_tickets_inr.py b/foundation/erpnext_foundation/web_form/buy_tickets_inr/buy_tickets_inr.py index 92b87c55..04accad5 100644 --- a/foundation/erpnext_foundation/web_form/buy_tickets_inr/buy_tickets_inr.py +++ b/foundation/erpnext_foundation/web_form/buy_tickets_inr/buy_tickets_inr.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import frappe def get_context(context): # do your magic here diff --git a/foundation/erpnext_foundation/web_form/buy_tickets_paypal/buy_tickets_paypal.py b/foundation/erpnext_foundation/web_form/buy_tickets_paypal/buy_tickets_paypal.py index 92b87c55..04accad5 100644 --- a/foundation/erpnext_foundation/web_form/buy_tickets_paypal/buy_tickets_paypal.py +++ b/foundation/erpnext_foundation/web_form/buy_tickets_paypal/buy_tickets_paypal.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import frappe def get_context(context): # do your magic here diff --git a/foundation/erpnext_foundation/web_form/conference_talk_proposal/conference_talk_proposal.py b/foundation/erpnext_foundation/web_form/conference_talk_proposal/conference_talk_proposal.py index 2334f8b2..f57de916 100644 --- a/foundation/erpnext_foundation/web_form/conference_talk_proposal/conference_talk_proposal.py +++ b/foundation/erpnext_foundation/web_form/conference_talk_proposal/conference_talk_proposal.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import frappe def get_context(context): # do your magic here diff --git a/foundation/erpnext_foundation/web_form/developer_sprint/developer_sprint.py b/foundation/erpnext_foundation/web_form/developer_sprint/developer_sprint.py index 2334f8b2..f57de916 100644 --- a/foundation/erpnext_foundation/web_form/developer_sprint/developer_sprint.py +++ b/foundation/erpnext_foundation/web_form/developer_sprint/developer_sprint.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import frappe def get_context(context): # do your magic here diff --git a/foundation/erpnext_foundation/web_form/jobs/jobs.py b/foundation/erpnext_foundation/web_form/jobs/jobs.py index 2334f8b2..f57de916 100644 --- a/foundation/erpnext_foundation/web_form/jobs/jobs.py +++ b/foundation/erpnext_foundation/web_form/jobs/jobs.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import frappe def get_context(context): # do your magic here diff --git a/foundation/erpnext_foundation/web_form/memberships/memberships.py b/foundation/erpnext_foundation/web_form/memberships/memberships.py index ff67a0e6..12f65bed 100644 --- a/foundation/erpnext_foundation/web_form/memberships/memberships.py +++ b/foundation/erpnext_foundation/web_form/memberships/memberships.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals import frappe -import datetime from frappe.utils import fmt_money def get_context(context): diff --git a/foundation/erpnext_foundation/web_form/memberships_usd/memberships_usd.py b/foundation/erpnext_foundation/web_form/memberships_usd/memberships_usd.py index 2334f8b2..f57de916 100644 --- a/foundation/erpnext_foundation/web_form/memberships_usd/memberships_usd.py +++ b/foundation/erpnext_foundation/web_form/memberships_usd/memberships_usd.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import frappe def get_context(context): # do your magic here diff --git a/foundation/erpnext_foundation/web_form/request_a_call/request_a_call.py b/foundation/erpnext_foundation/web_form/request_a_call/request_a_call.py index 2334f8b2..f57de916 100644 --- a/foundation/erpnext_foundation/web_form/request_a_call/request_a_call.py +++ b/foundation/erpnext_foundation/web_form/request_a_call/request_a_call.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import frappe def get_context(context): # do your magic here diff --git a/foundation/erpnext_foundation/web_form/service_provider/service_provider.py b/foundation/erpnext_foundation/web_form/service_provider/service_provider.py index 2334f8b2..f57de916 100644 --- a/foundation/erpnext_foundation/web_form/service_provider/service_provider.py +++ b/foundation/erpnext_foundation/web_form/service_provider/service_provider.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import frappe def get_context(context): # do your magic here diff --git a/foundation/erpnext_foundation/web_form/start_a_new_bounty/start_a_new_bounty.py b/foundation/erpnext_foundation/web_form/start_a_new_bounty/start_a_new_bounty.py index 2334f8b2..f57de916 100644 --- a/foundation/erpnext_foundation/web_form/start_a_new_bounty/start_a_new_bounty.py +++ b/foundation/erpnext_foundation/web_form/start_a_new_bounty/start_a_new_bounty.py @@ -1,6 +1,5 @@ from __future__ import unicode_literals -import frappe def get_context(context): # do your magic here diff --git a/foundation/migrate.py b/foundation/migrate.py index e376e6c1..ff006d57 100644 --- a/foundation/migrate.py +++ b/foundation/migrate.py @@ -1,4 +1,3 @@ -import frappe def migrate(): pass diff --git a/foundation/www/conf/2019/talks.py b/foundation/www/conf/2019/talks.py index f7607956..04e1a5d6 100644 --- a/foundation/www/conf/2019/talks.py +++ b/foundation/www/conf/2019/talks.py @@ -1,4 +1,3 @@ -import frappe def get_context(context): context.schedules = [ diff --git a/foundation/www/members/setup_payment.py b/foundation/www/members/setup_payment.py index dddae26e..36c68ef8 100644 --- a/foundation/www/members/setup_payment.py +++ b/foundation/www/members/setup_payment.py @@ -1,5 +1,4 @@ import frappe -import foundation no_cache = 1 def get_context(context):