Skip to content

Commit

Permalink
fix: conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchamahabal committed Nov 13, 2019
2 parents 6ad08fa + d777320 commit fa6a29f
Show file tree
Hide file tree
Showing 250 changed files with 5,952 additions and 6,575 deletions.
17 changes: 17 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version = 1

test_patterns = [
"**/test_*.py"
]

exclude_patterns = [
"frappe/patches/**",
"*.min.js"
]

[[analyzers]]
name = "python"
enabled = true

[analyzers.meta]
runtime_version = "3.x.x"
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
"CANCEL": true,
"copy_dict": true,
"get_number_format_info": true,
"strip_number_groups": true,
"print_table": true,
"Layout": true,
"web_form_settings": true,
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Bug report
about: Report a bug encountered while using the Frappe Framework

labels: bug
---

<!--
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Feature request
about: Suggest an idea to improve Frappe

labels: feature-request
---

<!--
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question-about-using-frappe.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Question about using Frappe/Frappe Apps
about: This is not the appropriate channel

labels: invalid
---

Please post on our forums:
Expand Down
2 changes: 1 addition & 1 deletion .github/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ staleLabel: inactive
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This pull request has been automatically marked as stale because it has not had
recent activity. It will be closed within a week if no further activity occurs, but it
recent activity. It will be closed within 3 days if no further activity occurs, but it
only takes a comment to keep a contribution alive :) Also, even if it is closed,
you can always reopen the PR when you're ready. Thank you for contributing.
Expand Down
5 changes: 3 additions & 2 deletions .travis/consumer_db/mariadb.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"admin_password": "admin",
"root_login": "root",
"root_password": "travis",
"host_name": "http://test_site:8000"
}
"host_name": "http://test_site:8000",
"server_script_enabled": true
}
3 changes: 2 additions & 1 deletion .travis/consumer_db/postgres.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"admin_password": "admin",
"root_login": "postgres",
"root_password": "travis",
"host_name": "http://test_site:8000"
"host_name": "http://test_site:8000",
"server_script_enabled": true
}
7 changes: 7 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Security Policy

The Frappe team and community take security issues in the Frappe Framework seriously. To report a security issue, fill out the form at [https://erpnext.com/security/report](https://erpnext.com/security/report).

You can help us make Frappe and consequently all Frappe dependent apps like [ERPNext](https://erpnext.com) more secure by following the [Reporting guidelines](https://erpnext.com/security).

We appreciate your efforts to responsibly disclose your findings. We'll endeavor to respond quickly, and will keep you updated throughout the process.
12 changes: 5 additions & 7 deletions cypress/integration/control_link.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ context('Control Link', () => {
cy.server();
cy.route('POST', '/api/method/frappe.desk.search.search_link').as('search_link');

cy.get('.frappe-control[data-fieldname=link] input')
.focus()
.type('todo for li')
.type('n', { delay: 600 })
.type('k', { delay: 700 });
cy.get('.frappe-control[data-fieldname=link] input').focus().as('input');
cy.wait('@search_link');
cy.get('@input').type('todo for link');
cy.wait('@search_link');
cy.get('.frappe-control[data-fieldname=link] ul').should('be.visible');
cy.get('.frappe-control[data-fieldname=link] input').type('{downarrow}{enter}', { delay: 100 });
cy.get('.frappe-control[data-fieldname=link] input').type('{enter}', { delay: 100 });
cy.get('.frappe-control[data-fieldname=link] input').blur();
cy.get('@dialog').then(dialog => {
cy.get('@todos').then(todos => {
Expand All @@ -45,7 +43,7 @@ context('Control Link', () => {
});
});

it.only('should unset invalid value', () => {
it('should unset invalid value', () => {
get_dialog_with_link().as('dialog');

cy.server();
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/list_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ context('List View', () => {
it('enables "Actions" button', () => {
const actions = ['Approve', 'Reject', 'Edit', 'Assign To', 'Apply Assignment Rule', 'Print', 'Delete'];
cy.go_to_list('ToDo');
cy.get('.level-item.list-row-checkbox.hidden-xs').click({ multiple: true, force: true });
cy.get('.list-row-container:contains("Pending") .list-row-checkbox').click({ multiple: true, force: true });
cy.get('.btn.btn-primary.btn-sm.dropdown-toggle').contains('Actions').should('be.visible').click();
cy.get('.dropdown-menu li:visible').should('have.length', 7).each((el, index) => {
cy.wrap(el).contains(actions[index]);
Expand Down
39 changes: 22 additions & 17 deletions cypress/integration/query_report.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,27 @@ context('Form', () => {
it('add custom column in report', () => {
cy.visit('/desk#query-report/Permitted Documents For User');

cy.get('#page-query-report input[data-fieldname="user"]').as('input');
cy.get('@input').focus().type('[email protected]', { delay: 100 });
cy.get('#page-query-report input[data-fieldname="doctype"]').as('input-test');
cy.get('@input-test').focus().type('Role', { delay: 100 }).blur();
cy.get('.datatable').should('exist');
cy.get('button').contains('Menu').click({force: true});
cy.get('.dropdown-menu li').contains('Add Column').click({force: true});
cy.get('.modal-dialog').should('contain', 'Add Column');
cy.get('select[data-fieldname="doctype"]').select("Role", {force: true});
cy.get('select[data-fieldname="field"]').select("Role Name", {force: true});
cy.get('select[data-fieldname="insert_after"]').select("Name", {force: true});
cy.get('button').contains('Submit').click({force: true});
cy.get('button').contains('Menu').click({force: true});
cy.get('.dropdown-menu li').contains('Save').click({force: true});
cy.get('.modal-dialog').should('contain', 'Save Report');
cy.get('input[data-fieldname="report_name"]').type("Test Report", {force: true});
cy.get('button').contains('Submit').click({force: true});
cy.get('div[class="page-form flex"]', {timeout: 60000}).should('have.length', 1).then(()=>{
cy.get('#page-query-report input[data-fieldname="user"]').as('input');
cy.get('@input').focus().type('[email protected]', { delay: 100 });

cy.get('#page-query-report input[data-fieldname="doctype"]').as('input-test');
cy.get('@input-test').focus().type('Role', { delay: 100 }).blur();

cy.get('.datatable').should('exist');
cy.get('button').contains('Menu').click({force: true});
cy.get('.dropdown-menu li').contains('Add Column').click({force: true});
cy.get('.modal-dialog').should('contain', 'Add Column');
cy.get('select[data-fieldname="doctype"]').select("Role", {force: true});
cy.get('select[data-fieldname="field"]').select("Role Name", {force: true});
cy.get('select[data-fieldname="insert_after"]').select("Name", {force: true});
cy.get('button').contains('Submit').click({force: true});
cy.get('button').contains('Menu').click({force: true});
cy.get('.dropdown-menu li').contains('Save').click({force: true});
cy.get('.modal-dialog').should('contain', 'Save Report');

cy.get('input[data-fieldname="report_name"]').type("Test Report", {delay:100, force: true});
cy.get('button').contains('Submit').click({timeout:1000, force: true});
});
});
});
6 changes: 4 additions & 2 deletions frappe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
reload(sys)
sys.setdefaultencoding("utf-8")

__version__ = '12.0.16'
__version__ = '12.0.17'
__title__ = "Frappe Framework"

local = Local()
Expand Down Expand Up @@ -520,7 +520,7 @@ def wrapper_fn(*args, **kwargs):
return wrapper_fn
return innfn

def only_for(roles):
def only_for(roles, message=False):
"""Raise `frappe.PermissionError` if the user does not have any of the given **Roles**.
:param roles: List of roles to check."""
Expand All @@ -532,6 +532,8 @@ def only_for(roles):
roles = set(roles)
myroles = set(get_roles())
if not roles.intersection(myroles):
if message:
msgprint(_('Only for {}'.format(', '.join(roles))))
raise PermissionError

def get_domain_data(module):
Expand Down
5 changes: 4 additions & 1 deletion frappe/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ def handle():
frappe.local.response.update({"data": doc})

if frappe.local.request.method=="PUT":
data = json.loads(frappe.local.form_dict.data)
if frappe.local.form_dict.data is None:
data = json.loads(frappe.local.request.get_data())
else:
data = json.loads(frappe.local.form_dict.data)
doc = frappe.get_doc(doctype, name)

if "flags" in data:
Expand Down
4 changes: 4 additions & 0 deletions frappe/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ def force_user_to_reset_password(self):
if not self.user:
return

from frappe.core.doctype.user.user import STANDARD_USERS
if self.user in STANDARD_USERS:
return False

reset_pwd_after_days = cint(frappe.db.get_single_value("System Settings",
"force_user_to_reset_password"))

Expand Down
12 changes: 8 additions & 4 deletions frappe/automation/doctype/auto_repeat/auto_repeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,15 @@ def unlink_if_applicable(self):
frappe.db.set_value(self.reference_doctype, self.reference_document, 'auto_repeat', '')

def validate_reference_doctype(self):
if not frappe.flags.in_test:
if not frappe.get_meta(self.reference_doctype).allow_auto_repeat:
frappe.throw(_("Enable Allow Auto Repeat for the doctype {0} in Customize Form").format(self.reference_doctype))
if frappe.flags.in_test or frappe.flags.in_patch:
return
if not frappe.get_meta(self.reference_doctype).allow_auto_repeat:
frappe.throw(_("Enable Allow Auto Repeat for the doctype {0} in Customize Form").format(self.reference_doctype))

def validate_dates(self):
if frappe.flags.in_patch:
return

if self.end_date:
self.validate_from_to_dates('start_date', 'end_date')

Expand All @@ -81,7 +85,7 @@ def validate_email_id(self):
def update_auto_repeat_id(self):
#check if document is already on auto repeat
auto_repeat = frappe.db.get_value(self.reference_doctype, self.reference_document, "auto_repeat")
if auto_repeat and auto_repeat != self.name:
if auto_repeat and auto_repeat != self.name and not frappe.flags.in_patch:
frappe.throw(_("The {0} is already on auto repeat {1}").format(self.reference_document, auto_repeat))
else:
frappe.db.set_value(self.reference_doctype, self.reference_document, "auto_repeat", self.name)
Expand Down
9 changes: 7 additions & 2 deletions frappe/boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,13 @@ def get_user_pages_or_reports(parent):
has_role[p.name] = {"modified": p.modified, "title": p.title}

elif parent == "Report":
for report_name in has_role:
has_role[report_name]["report_type"] = frappe.db.get_value("Report", report_name, "report_type")
reports = frappe.get_all("Report",
fields=["name", "report_type"],
filters={"name": ("in", has_role.keys())},
ignore_ifnull=True
)
for report in reports:
has_role[report.name]["report_type"] = report.report_type

return has_role

Expand Down
6 changes: 3 additions & 3 deletions frappe/cache_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
common_default_keys = ["__default", "__global"]

global_cache_keys = ("app_hooks", "installed_apps",
"app_modules", "module_app", "notification_config", 'system_settings',
"app_modules", "module_app", "system_settings",
'scheduler_events', 'time_zone', 'webhooks', 'active_domains',
'active_modules', 'assignment_rule')
'active_modules', 'assignment_rule', 'server_script_map', 'wkhtmltopdf_version')

user_cache_keys = ("bootinfo", "user_recent", "roles", "user_doc", "lang",
"defaults", "user_permissions", "home_page", "linked_with",
Expand Down Expand Up @@ -114,4 +114,4 @@ def get_doctype_map(doctype, name, filters, order_by=None):

def clear_doctype_map(doctype, name):
cache_key = frappe.scrub(doctype) + '_map'
frappe.cache().hdel(cache_key, name)
frappe.cache().hdel(cache_key, name)
Loading

0 comments on commit fa6a29f

Please sign in to comment.