Browse Source

Use raise instead of six.reraise

version-14
Aditya Hase 8 years ago
parent
commit
7da257bfaa
1 changed files with 3 additions and 4 deletions
  1. +3
    -4
      frappe/model/base_document.py

+ 3
- 4
frappe/model/base_document.py View File

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


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


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


# this is used to preserve traceback # 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): def db_set(self, fieldname, value=None, update_modified=True):
'''Set a value in the document object, update the timestamp and update the database. '''Set a value in the document object, update the timestamp and update the database.


Loading…
Cancel
Save