Merge branch 'rmehta-commit-only-on-write' into develop

This commit is contained in:
Anand Doshi 2015-08-17 14:15:26 +05:30
commit 0ca64cd1a6
4 changed files with 188 additions and 190 deletions

View file

@ -2,12 +2,10 @@
# MIT License. See license.txt
from __future__ import unicode_literals
import sys, os
import json
import logging
import os
import MySQLdb
from werkzeug.wrappers import Request, Response
from werkzeug.wrappers import Request
from werkzeug.local import LocalManager
from werkzeug.exceptions import HTTPException, NotFound
from werkzeug.contrib.profiler import ProfilerMiddleware
@ -15,7 +13,6 @@ from werkzeug.wsgi import SharedDataMiddleware
from werkzeug.serving import run_with_reloader
import mimetypes
import frappe
import frappe.handler
import frappe.auth
@ -115,8 +112,9 @@ def application(request):
else:
if frappe.local.request.method in ("POST", "PUT") and frappe.db:
frappe.db.commit()
rollback = False
if frappe.db.transaction_writes:
frappe.db.commit()
rollback = False
# update session
if getattr(frappe.local, "session_obj", None):

View file

@ -208,7 +208,7 @@ class Database:
if query and query.strip().lower() in ('commit', 'rollback'):
self.transaction_writes = 0
if query[:6].lower() in ['update', 'insert']:
if query[:6].lower() in ('update', 'insert', 'delete'):
self.transaction_writes += 1
if self.transaction_writes > 200000:
if self.auto_commit_on_many_writes:

View file

@ -2,7 +2,7 @@
Call from command line:
bench frappe --setup_docs app docs_app path
bench setup-docs app docs_app path
"""

View file

@ -1,245 +1,245 @@
{
"creation": "2013-03-28 10:35:30",
"description": "Page to show on the website\n",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Document",
"creation": "2013-03-28 10:35:30",
"description": "Page to show on the website\n",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Document",
"fields": [
{
"fieldname": "section_title",
"fieldtype": "Section Break",
"label": "Title",
"fieldname": "section_title",
"fieldtype": "Section Break",
"label": "Title",
"permlevel": 0
},
},
{
"description": "Title / headline of your page",
"fieldname": "title",
"fieldtype": "Data",
"label": "Title",
"permlevel": 0,
"description": "Title / headline of your page",
"fieldname": "title",
"fieldtype": "Data",
"label": "Title",
"permlevel": 0,
"reqd": 1
},
},
{
"default": "1",
"fieldname": "show_title",
"fieldtype": "Check",
"label": "Show Title",
"permlevel": 0,
"default": "1",
"fieldname": "show_title",
"fieldtype": "Check",
"label": "Show Title",
"permlevel": 0,
"precision": ""
},
},
{
"description": "Begin this page with a slideshow of images",
"fieldname": "slideshow",
"fieldtype": "Link",
"label": "Slideshow",
"options": "Website Slideshow",
"description": "Begin this page with a slideshow of images",
"fieldname": "slideshow",
"fieldtype": "Link",
"label": "Slideshow",
"options": "Website Slideshow",
"permlevel": 0
},
},
{
"fieldname": "cb1",
"fieldtype": "Column Break",
"permlevel": 0,
"fieldname": "cb1",
"fieldtype": "Column Break",
"permlevel": 0,
"width": "50%"
},
},
{
"description": "Page url name (auto-generated)",
"fieldname": "page_name",
"fieldtype": "Data",
"in_list_view": 0,
"label": "Page Name",
"no_copy": 1,
"permlevel": 0,
"description": "Page url name (auto-generated)",
"fieldname": "page_name",
"fieldtype": "Data",
"in_list_view": 0,
"label": "Page Name",
"no_copy": 1,
"permlevel": 0,
"read_only": 0
},
},
{
"fieldname": "published",
"fieldtype": "Check",
"label": "Published",
"fieldname": "published",
"fieldtype": "Check",
"label": "Published",
"permlevel": 0
},
},
{
"description": "Page content",
"fieldname": "sb1",
"fieldtype": "Section Break",
"label": "Content",
"description": "Page content",
"fieldname": "sb1",
"fieldtype": "Section Break",
"label": "Content",
"permlevel": 0
},
},
{
"description": "Content in markdown format that appears on the main side of your page",
"fieldname": "main_section",
"fieldtype": "Text Editor",
"label": "Main Section",
"description": "Content in markdown format that appears on the main side of your page",
"fieldname": "main_section",
"fieldtype": "Text Editor",
"label": "Main Section",
"permlevel": 0
},
},
{
"fieldname": "fold_10",
"fieldtype": "Fold",
"permlevel": 0,
"fieldname": "fold_10",
"fieldtype": "Fold",
"permlevel": 0,
"precision": ""
},
},
{
"fieldname": "custom_javascript",
"fieldtype": "Section Break",
"label": "Custom Javascript",
"fieldname": "custom_javascript",
"fieldtype": "Section Break",
"label": "Custom Javascript",
"permlevel": 0
},
},
{
"description": "Add code as <script>",
"fieldname": "insert_code",
"fieldtype": "Check",
"label": "Insert Code",
"description": "Add code as <script>",
"fieldname": "insert_code",
"fieldtype": "Check",
"label": "Insert Code",
"permlevel": 0
},
},
{
"depends_on": "insert_code",
"fieldname": "javascript",
"fieldtype": "Code",
"label": "Javascript",
"options": "Javascript",
"depends_on": "insert_code",
"fieldname": "javascript",
"fieldtype": "Code",
"label": "Javascript",
"options": "Javascript",
"permlevel": 0
},
},
{
"fieldname": "custom_css",
"fieldtype": "Section Break",
"label": "Custom CSS",
"fieldname": "custom_css",
"fieldtype": "Section Break",
"label": "Custom CSS",
"permlevel": 0
},
},
{
"fieldname": "insert_style",
"fieldtype": "Check",
"label": "Insert Style",
"fieldname": "insert_style",
"fieldtype": "Check",
"label": "Insert Style",
"permlevel": 0
},
},
{
"depends_on": "insert_style",
"fieldname": "css",
"fieldtype": "Code",
"label": "CSS",
"options": "CSS",
"depends_on": "insert_style",
"fieldname": "css",
"fieldtype": "Code",
"label": "CSS",
"options": "CSS",
"permlevel": 0
},
},
{
"fieldname": "section_break_17",
"fieldtype": "Section Break",
"permlevel": 0,
"fieldname": "section_break_17",
"fieldtype": "Section Break",
"permlevel": 0,
"precision": ""
},
},
{
"fieldname": "enable_comments",
"fieldtype": "Check",
"label": "Enable Comments",
"fieldname": "enable_comments",
"fieldtype": "Check",
"label": "Enable Comments",
"permlevel": 0
},
},
{
"fieldname": "text_align",
"fieldtype": "Select",
"label": "Text Align",
"options": "Left\nCenter\nRight",
"fieldname": "text_align",
"fieldtype": "Select",
"label": "Text Align",
"options": "Left\nCenter\nRight",
"permlevel": 0
},
},
{
"fieldname": "column_break_20",
"fieldtype": "Column Break",
"permlevel": 0,
"fieldname": "column_break_20",
"fieldtype": "Column Break",
"permlevel": 0,
"precision": ""
},
},
{
"fieldname": "parent_web_page",
"fieldtype": "Link",
"label": "Parent Web Page",
"options": "Web Page",
"fieldname": "parent_web_page",
"fieldtype": "Link",
"label": "Parent Web Page",
"options": "Web Page",
"permlevel": 0
},
},
{
"fieldname": "parent_website_route",
"fieldtype": "Read Only",
"hidden": 1,
"label": "Parent Website Route",
"no_copy": 1,
"options": "",
"fieldname": "parent_website_route",
"fieldtype": "Read Only",
"hidden": 1,
"label": "Parent Website Route",
"no_copy": 1,
"options": "",
"permlevel": 0
},
},
{
"description": "0 is highest",
"fieldname": "idx",
"fieldtype": "Int",
"label": "Priority",
"description": "0 is highest",
"fieldname": "idx",
"fieldtype": "Int",
"label": "Priority",
"permlevel": 0
},
},
{
"fieldname": "template_path",
"fieldtype": "Data",
"hidden": 0,
"label": "Template Path",
"permlevel": 0,
"fieldname": "template_path",
"fieldtype": "Data",
"hidden": 0,
"label": "Template Path",
"permlevel": 0,
"read_only": 1
},
},
{
"depends_on": "eval:!doc.__islocal",
"description": "",
"fieldname": "sb2",
"fieldtype": "Section Break",
"label": "",
"depends_on": "eval:!doc.__islocal",
"description": "",
"fieldname": "sb2",
"fieldtype": "Section Break",
"label": "",
"permlevel": 0
},
},
{
"description": "Description for search engine optimization.",
"fieldname": "description",
"fieldtype": "Small Text",
"label": "Description",
"description": "Description for search engine optimization.",
"fieldname": "description",
"fieldtype": "Small Text",
"label": "Description",
"permlevel": 0
},
},
{
"description": "HTML for header section. Optional",
"fieldname": "header",
"fieldtype": "Text",
"label": "Header",
"description": "HTML for header section. Optional",
"fieldname": "header",
"fieldtype": "Text",
"label": "Header",
"permlevel": 0
}
],
"icon": "icon-file-alt",
"idx": 1,
"max_attachments": 20,
"modified": "2015-07-28 16:18:12.887565",
"modified_by": "Administrator",
"module": "Website",
"name": "Web Page",
"owner": "Administrator",
],
"icon": "icon-file-alt",
"idx": 1,
"max_attachments": 20,
"modified": "2015-08-17 14:18:12.887565",
"modified_by": "Administrator",
"module": "Website",
"name": "Web Page",
"owner": "Administrator",
"permissions": [
{
"cancel": 0,
"create": 0,
"delete": 0,
"email": 0,
"permlevel": 0,
"print": 0,
"read": 1,
"report": 0,
"role": "Website Manager",
"share": 1,
"submit": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 0,
"permlevel": 0,
"print": 0,
"read": 1,
"report": 0,
"role": "Website Manager",
"share": 1,
"submit": 0,
"write": 0
},
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Guest",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Guest",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
],
"search_fields": "title,main_section",
],
"search_fields": "title",
"title_field": "title"
}
}