Merge pull request #702 from anandpdoshi/anand-july-17

Data Import and Outgoing Email Settings
This commit is contained in:
Rushabh Mehta 2014-07-17 12:51:38 +05:30
commit 9e1d6d38ad
2 changed files with 10 additions and 3 deletions

View file

@ -5,12 +5,16 @@
from __future__ import unicode_literals
import frappe
from frappe import _, throw
from frappe.utils import validate_email_add
from frappe.model.document import Document
class OutgoingEmailSettings(Document):
def validate(self):
if self.auto_email_id and not validate_email_add(self.auto_email_id):
throw(_("{0} is not a valid email id").format(self.auto_email_id), frappe.InvalidEmailAddressError)
if self.mail_server and not frappe.local.flags.in_patch:
from frappe.utils import cint
from frappe.utils.email_lib.smtp import SMTPServer

View file

@ -56,11 +56,14 @@ def read_csv_content(fcontent, ignore_encoding=False):
for row in csv.reader(fcontent):
r = []
for val in row:
# decode everything
val = unicode(val, "utf-8").strip()
if val=="":
# reason: in maraidb strict config, one cannot have blank strings for non string datatypes
r.append(None)
else:
# decode everything
r.append(unicode(val, "utf-8").strip())
r.append(val)
rows.append(r)