浏览代码

Use raise instead of six.reraise

version-14
Aditya Hase 8 年前
父节点
当前提交
7da257bfaa
共有 1 个文件被更改,包括 3 次插入4 次删除
  1. +3
    -4
      frappe/model/base_document.py

+ 3
- 4
frappe/model/base_document.py 查看文件

@@ -2,7 +2,7 @@
# MIT License. See license.txt

from __future__ import unicode_literals
from six import reraise as raise_, iteritems, string_types
from six import iteritems, string_types
import frappe, sys
from frappe import _
from frappe.utils import (cint, flt, now, cstr, strip_html, getdate, get_datetime, to_timedelta,
@@ -307,8 +307,7 @@ class BaseDocument(object):
return

frappe.msgprint(_("Duplicate name {0} {1}").format(self.doctype, self.name))
traceback = sys.exc_info()[2]
raise_(frappe.DuplicateEntryError, (self.doctype, self.name, e), traceback)
raise frappe.DuplicateEntryError(self.doctype, self.name, e)

elif "Duplicate" in cstr(e.args[1]):
# unique constraint
@@ -361,7 +360,7 @@ class BaseDocument(object):
frappe.msgprint(_("{0} must be unique".format(label or fieldname)))

# this is used to preserve traceback
raise_(frappe.UniqueValidationError, (self.doctype, self.name, e), traceback)
raise frappe.UniqueValidationError(self.doctype, self.name, e)

def db_set(self, fieldname, value=None, update_modified=True):
'''Set a value in the document object, update the timestamp and update the database.


正在加载...
取消
保存