style: Fix liinter warnings
This commit is contained in:
parent
9e4c8cc28e
commit
5587ab5a91
4 changed files with 17 additions and 18 deletions
|
|
@ -319,7 +319,7 @@ class File(Document):
|
|||
|
||||
def unzip(self):
|
||||
'''Unzip current file and replace it by its children'''
|
||||
if not ".zip" in self.file_url:
|
||||
if not self.file_url.endswith(".zip"):
|
||||
frappe.throw(_("{0} is not a zip file").format(self.file_name))
|
||||
|
||||
zip_path = self.get_full_path()
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ from frappe.desk.query_report import generate_report_result
|
|||
from frappe.model.document import Document
|
||||
from frappe.utils import gzip_compress, gzip_decompress
|
||||
from frappe.utils.background_jobs import enqueue
|
||||
from frappe.utils.file_manager import remove_all
|
||||
|
||||
class PreparedReport(Document):
|
||||
def before_insert(self):
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# MIT License. See license.txt
|
||||
import frappe, unittest
|
||||
import json
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
import frappe
|
||||
import frappe.exceptions
|
||||
from frappe.core.doctype.user.user import (extract_mentions, reset_password,
|
||||
sign_up, test_password_strength, update_password, verify_password)
|
||||
from frappe.frappeclient import FrappeClient
|
||||
from frappe.model.delete_doc import delete_doc
|
||||
from frappe.utils import get_url
|
||||
from frappe.core.doctype.user.user import (test_password_strength,
|
||||
extract_mentions, sign_up, update_password, verify_password, reset_password)
|
||||
from frappe.frappeclient import FrappeClient
|
||||
|
||||
from unittest.mock import patch
|
||||
import frappe.exceptions
|
||||
|
||||
user_module = frappe.core.doctype.user.user
|
||||
test_records = frappe.get_test_records('User')
|
||||
|
|
@ -305,9 +305,8 @@ class TestUser(unittest.TestCase):
|
|||
|
||||
|
||||
def test_reset_password(self):
|
||||
from frappe.auth import CookieManager, LoginManager
|
||||
from frappe.utils import set_request
|
||||
from frappe.auth import CookieManager
|
||||
from frappe.auth import LoginManager
|
||||
old_password = "Eastern_43A1W"
|
||||
new_password = "easy_password"
|
||||
|
||||
|
|
@ -365,8 +364,8 @@ class TestUser(unittest.TestCase):
|
|||
self.assertEqual(reset_password(user="random"), "not found")
|
||||
|
||||
def test_user_onload_modules(self):
|
||||
from frappe.desk.form.load import getdoc
|
||||
from frappe.config import get_modules_from_all_apps
|
||||
from frappe.desk.form.load import getdoc
|
||||
frappe.response.docs = []
|
||||
getdoc("User", "Administrator")
|
||||
doc = frappe.response.docs[0]
|
||||
|
|
|
|||
|
|
@ -725,6 +725,7 @@ def get_max_email_uid(email_account):
|
|||
def setup_user_email_inbox(email_account, awaiting_password, email_id, enable_outgoing):
|
||||
""" setup email inbox for user """
|
||||
from frappe.core.doctype.user.user import ask_pass_update
|
||||
|
||||
def add_user_email(user):
|
||||
user = frappe.get_doc("User", user)
|
||||
row = user.append("user_emails", {})
|
||||
|
|
@ -736,11 +737,11 @@ def setup_user_email_inbox(email_account, awaiting_password, email_id, enable_ou
|
|||
|
||||
user.save(ignore_permissions=True)
|
||||
|
||||
udpate_user_email_settings = False
|
||||
update_user_email_settings = False
|
||||
if not all([email_account, email_id]):
|
||||
return
|
||||
|
||||
user_names = frappe.db.get_values("User", { "email": email_id }, as_dict=True)
|
||||
user_names = frappe.db.get_values("User", {"email": email_id}, as_dict=True)
|
||||
if not user_names:
|
||||
return
|
||||
|
||||
|
|
@ -757,9 +758,9 @@ def setup_user_email_inbox(email_account, awaiting_password, email_id, enable_ou
|
|||
add_user_email(user_name)
|
||||
else:
|
||||
# update awaiting password for email account
|
||||
udpate_user_email_settings = True
|
||||
update_user_email_settings = True
|
||||
|
||||
if udpate_user_email_settings:
|
||||
if update_user_email_settings:
|
||||
frappe.db.sql("""UPDATE `tabUser Email` SET awaiting_password = %(awaiting_password)s,
|
||||
enable_outgoing = %(enable_outgoing)s WHERE email_account = %(email_account)s""", {
|
||||
"email_account": email_account,
|
||||
|
|
@ -782,8 +783,8 @@ def remove_user_email_inbox(email_account):
|
|||
|
||||
for user in users:
|
||||
doc = frappe.get_doc("User", user.get("name"))
|
||||
to_remove = [ row for row in doc.user_emails if row.email_account == email_account ]
|
||||
[ doc.remove(row) for row in to_remove ]
|
||||
to_remove = [row for row in doc.user_emails if row.email_account == email_account]
|
||||
[doc.remove(row) for row in to_remove]
|
||||
|
||||
doc.save(ignore_permissions=True)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue