瀏覽代碼

Merge branch 'develop'

version-14
Pratik Vyas 10 年之前
父節點
當前提交
dbba4b94d6
共有 7 個檔案被更改,包括 48 行新增42 行删除
  1. +1
    -1
      frappe/__version__.py
  2. +38
    -32
      frappe/core/doctype/comment/comment.py
  3. +4
    -4
      frappe/core/doctype/notification_count/notification_count.py
  4. +2
    -2
      frappe/core/report/permitted_documents_for_user/permitted_documents_for_user.py
  5. +1
    -1
      frappe/hooks.py
  6. +1
    -1
      frappe/utils/file_manager.py
  7. +1
    -1
      setup.py

+ 1
- 1
frappe/__version__.py 查看文件

@@ -1 +1 @@
__version__ = "4.11.1"
__version__ = "4.11.2"

+ 38
- 32
frappe/core/doctype/comment/comment.py 查看文件

@@ -5,8 +5,8 @@ from __future__ import unicode_literals
import frappe, json
from frappe import _
from frappe.website.render import clear_cache

from frappe.model.document import Document
from frappe.model.db_schema import add_column

class Comment(Document):

@@ -20,39 +20,44 @@ class Comment(Document):

def update_comment_in_doc(self):
if self.comment_doctype and self.comment_docname and self.comment and self.comment_type=="Comment":
try:
_comments = self.get_comments_from_parent()
updated = False
for c in _comments:
if c.get("name")==self.name:
c["comment"] = self.comment
updated = True

if not updated:
_comments.append({
"comment": self.comment,
"by": self.comment_by or self.owner,
"name":self.name
})
self.update_comments_in_parent(_comments)
except Exception, e:
if e.args[0]==1054:
if frappe.flags.in_test:
return

from frappe.model.db_schema import add_column
add_column(self.comment_doctype, "_comments", "Text")
self.update_comment_in_doc()
elif e.args[0]==1146:
# no table
pass
else:
raise
_comments = self.get_comments_from_parent()
updated = False
for c in _comments:
if c.get("name")==self.name:
c["comment"] = self.comment
updated = True

if not updated:
_comments.append({
"comment": self.comment,
"by": self.comment_by or self.owner,
"name":self.name
})
self.update_comments_in_parent(_comments)

def get_comments_from_parent(self):
_comments = frappe.db.get_value(self.comment_doctype,
self.comment_docname, "_comments") or "[]"
return json.loads(_comments)
try:
_comments = frappe.db.get_value(self.comment_doctype,
self.comment_docname, "_comments") or "[]"

return json.loads(_comments)

except Exception, e:

if e.args[0]==1054:
if frappe.flags.in_test:
return

add_column(self.comment_doctype, "_comments", "Text")

return self.get_comments_from_parent()

elif e.args[0]==1146:
# no table
pass

else:
raise

def update_comments_in_parent(self, _comments):
# use sql, so that we do not mess with the timestamp
@@ -80,3 +85,4 @@ def on_doctype_update():
frappe.db.commit()
frappe.db.sql("""alter table `tabComment`
add index comment_doctype_docname_index(comment_doctype, comment_docname)""")


+ 4
- 4
frappe/core/doctype/notification_count/notification_count.py 查看文件

@@ -44,7 +44,7 @@ def get_notifications():
"open_count":result}).insert(ignore_permissions=True)

except MySQLdb.OperationalError, e:
if e.args[0] != 1213:
if e.args[0] not in (1213, 1205):
raise

logger.error("Deadlock")
@@ -60,7 +60,7 @@ def get_notifications():
"open_count":open_count_module[m]}).insert(ignore_permissions=True)

except MySQLdb.OperationalError, e:
if e.args[0] != 1213:
if e.args[0] not in (1213, 1205):
raise

logger.error("Deadlock")
@@ -82,7 +82,7 @@ def clear_notifications(user=None):
frappe.db.sql("""delete from `tabNotification Count`""")

except MySQLdb.OperationalError, e:
if e.args[0] != 1213:
if e.args[0] not in (1213, 1205):
raise

logger.error("Deadlock")
@@ -94,7 +94,7 @@ def delete_notification_count_for(doctype):
frappe.db.sql("""delete from `tabNotification Count` where for_doctype = %s""", (doctype,))

except MySQLdb.OperationalError, e:
if e.args[0] != 1213:
if e.args[0] not in (1213, 1205):
raise

logger.error("Deadlock")


+ 2
- 2
frappe/core/report/permitted_documents_for_user/permitted_documents_for_user.py 查看文件

@@ -29,10 +29,10 @@ def validate(user, doctype):

def get_columns_and_fields(doctype):
columns = ["Name:Link/{}:200".format(doctype)]
fields = ["name"]
fields = ["`name`"]
for df in frappe.get_meta(doctype).fields:
if df.in_list_view and df.fieldtype in type_map:
fields.append(df.fieldname)
fields.append("`{0}`".format(df.fieldname))
fieldtype = "Link/{}".format(df.options) if df.fieldtype=="Link" else df.fieldtype
columns.append("{label}:{fieldtype}:{width}".format(label=df.label, fieldtype=fieldtype, width=df.width or 100))



+ 1
- 1
frappe/hooks.py 查看文件

@@ -3,7 +3,7 @@ app_title = "Frappe Framework"
app_publisher = "Web Notes Technologies Pvt. Ltd."
app_description = "Full Stack Web Application Framework in Python"
app_icon = "assets/frappe/images/frappe.svg"
app_version = "4.11.1"
app_version = "4.11.2"
app_color = "#3498db"
app_email = "support@frappe.io"



+ 1
- 1
frappe/utils/file_manager.py 查看文件

@@ -107,7 +107,7 @@ def extract_images_from_html(doc, fieldname):
return '<img src="{file_url}"'.format(file_url=file_url)

if content:
content = re.sub('<img\s*src=\s*["\'](.*?)["\']', _save_file, content)
content = re.sub('<img\s*src=\s*["\'](?=data:)(.*?)["\']', _save_file, content)
if frappe.flags.has_dataurl:
doc.set(fieldname, content)



+ 1
- 1
setup.py 查看文件

@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
import os

version = "4.11.1"
version = "4.11.2"

with open("requirements.txt", "r") as f:
install_requires = f.readlines()


Loading…
取消
儲存