Explorar el Código

[minor] commit only if there were writes

version-14
Rushabh Mehta hace 10 años
padre
commit
1654c5b038
Se han modificado 5 ficheros con 173 adiciones y 174 borrados
  1. +5
    -7
      frappe/app.py
  2. +1
    -1
      frappe/database.py
  3. +1
    -0
      frappe/public/css/website.css
  4. +1
    -1
      frappe/utils/setup_docs.py
  5. +165
    -165
      frappe/website/doctype/web_page/web_page.json

+ 5
- 7
frappe/app.py Ver fichero

@@ -2,18 +2,15 @@
# MIT License. See license.txt # MIT License. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals


import sys, os
import json
import logging
import os
import MySQLdb import MySQLdb


from werkzeug.wrappers import Request, Response
from werkzeug.wrappers import Request
from werkzeug.local import LocalManager from werkzeug.local import LocalManager
from werkzeug.exceptions import HTTPException, NotFound from werkzeug.exceptions import HTTPException, NotFound
from werkzeug.contrib.profiler import ProfilerMiddleware from werkzeug.contrib.profiler import ProfilerMiddleware
from werkzeug.wsgi import SharedDataMiddleware from werkzeug.wsgi import SharedDataMiddleware


import mimetypes
import frappe import frappe
import frappe.handler import frappe.handler
import frappe.auth import frappe.auth
@@ -97,8 +94,9 @@ def application(request):


else: else:
if frappe.local.request.method in ("POST", "PUT") and frappe.db: 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 # update session
if getattr(frappe.local, "session_obj", None): if getattr(frappe.local, "session_obj", None):


+ 1
- 1
frappe/database.py Ver fichero

@@ -208,7 +208,7 @@ class Database:
if query and query.strip().lower() in ('commit', 'rollback'): if query and query.strip().lower() in ('commit', 'rollback'):
self.transaction_writes = 0 self.transaction_writes = 0


if query[:6].lower() in ['update', 'insert']:
if query[:6].lower() in ('update', 'insert', 'delete'):
self.transaction_writes += 1 self.transaction_writes += 1
if self.transaction_writes > 200000: if self.transaction_writes > 200000:
if self.auto_commit_on_many_writes: if self.auto_commit_on_many_writes:


+ 1
- 0
frappe/public/css/website.css Ver fichero

@@ -285,6 +285,7 @@ body {
} }
.avatar-empty { .avatar-empty {
border: 1px dashed #d1d8dd; border: 1px dashed #d1d8dd;
border-radius: 4px;
} }
.avatar-small { .avatar-small {
margin-right: 5px; margin-right: 5px;


+ 1
- 1
frappe/utils/setup_docs.py Ver fichero

@@ -2,7 +2,7 @@


Call from command line: Call from command line:


bench frappe --setup_docs app docs_app path
bench setup-docs app docs_app path


""" """




+ 165
- 165
frappe/website/doctype/web_page/web_page.json Ver fichero

@@ -1,226 +1,226 @@
{ {
"creation": "2013-03-28 10:35:30",
"description": "Page to show on the website\n",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Transaction",
"creation": "2013-03-28 10:35:30",
"description": "Page to show on the website\n",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Transaction",
"fields": [ "fields": [
{ {
"fieldname": "section_title",
"fieldtype": "Section Break",
"label": "Title",
"fieldname": "section_title",
"fieldtype": "Section Break",
"label": "Title",
"permlevel": 0 "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 "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": "" "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 "permlevel": 0
},
},
{ {
"fieldname": "cb1",
"fieldtype": "Column Break",
"permlevel": 0,
"fieldname": "cb1",
"fieldtype": "Column Break",
"permlevel": 0,
"width": "50%" "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 "read_only": 0
},
},
{ {
"fieldname": "published",
"fieldtype": "Check",
"label": "Published",
"fieldname": "published",
"fieldtype": "Check",
"label": "Published",
"permlevel": 0 "permlevel": 0
},
},
{ {
"description": "Page content",
"fieldname": "sb1",
"fieldtype": "Section Break",
"label": "Content",
"description": "Page content",
"fieldname": "sb1",
"fieldtype": "Section Break",
"label": "Content",
"permlevel": 0 "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 "permlevel": 0
},
},
{ {
"fieldname": "fold_10",
"fieldtype": "Fold",
"permlevel": 0,
"fieldname": "fold_10",
"fieldtype": "Fold",
"permlevel": 0,
"precision": "" "precision": ""
},
},
{ {
"fieldname": "custom_javascript",
"fieldtype": "Section Break",
"label": "Custom Javascript",
"fieldname": "custom_javascript",
"fieldtype": "Section Break",
"label": "Custom Javascript",
"permlevel": 0 "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 "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 "permlevel": 0
},
},
{ {
"fieldname": "custom_css",
"fieldtype": "Section Break",
"label": "Custom CSS",
"fieldname": "custom_css",
"fieldtype": "Section Break",
"label": "Custom CSS",
"permlevel": 0 "permlevel": 0
},
},
{ {
"fieldname": "insert_style",
"fieldtype": "Check",
"label": "Insert Style",
"fieldname": "insert_style",
"fieldtype": "Check",
"label": "Insert Style",
"permlevel": 0 "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 "permlevel": 0
},
},
{ {
"fieldname": "section_break_17",
"fieldtype": "Section Break",
"permlevel": 0,
"fieldname": "section_break_17",
"fieldtype": "Section Break",
"permlevel": 0,
"precision": "" "precision": ""
},
},
{ {
"fieldname": "enable_comments",
"fieldtype": "Check",
"label": "Enable Comments",
"fieldname": "enable_comments",
"fieldtype": "Check",
"label": "Enable Comments",
"permlevel": 0 "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 "permlevel": 0
},
},
{ {
"fieldname": "column_break_20",
"fieldtype": "Column Break",
"permlevel": 0,
"fieldname": "column_break_20",
"fieldtype": "Column Break",
"permlevel": 0,
"precision": "" "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 "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 "permlevel": 0
},
},
{ {
"description": "0 is highest",
"fieldname": "idx",
"fieldtype": "Int",
"label": "Priority",
"description": "0 is highest",
"fieldname": "idx",
"fieldtype": "Int",
"label": "Priority",
"permlevel": 0 "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 "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 "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 "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 "permlevel": 0
} }
],
"icon": "icon-file-alt",
"idx": 1,
"max_attachments": 20,
"modified": "2015-07-13 04:46:59.435179",
"modified_by": "Administrator",
"module": "Website",
"name": "Web Page",
"owner": "Administrator",
],
"icon": "icon-file-alt",
"idx": 1,
"max_attachments": 20,
"modified": "2015-07-21 03:57:01.199380",
"modified_by": "Administrator",
"module": "Website",
"name": "Web Page",
"owner": "Administrator",
"permissions": [ "permissions": [
{ {
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Website Manager",
"share": 1,
"submit": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Website Manager",
"share": 1,
"submit": 0,
"write": 1 "write": 1
} }
],
"search_fields": "title,main_section",
],
"search_fields": "title",
"title_field": "title" "title_field": "title"
}
}

Cargando…
Cancelar
Guardar