Merge branch 'hotfix'

This commit is contained in:
Nabin Hait 2017-03-08 11:08:16 +05:30
commit 1652460f2a
4 changed files with 25 additions and 10 deletions

View file

@ -13,7 +13,7 @@ import os, sys, importlib, inspect, json
from .exceptions import *
from .utils.jinja import get_jenv, get_template, render_template
__version__ = '7.2.27'
__version__ = '7.2.28'
__title__ = "Frappe Framework"
local = Local()
@ -48,7 +48,8 @@ def _(msg, lang=None):
# msg should always be unicode
msg = as_unicode(msg).strip()
return get_full_dict(local.lang).get(msg) or msg
# return lang_full_dict according to lang passed parameter
return get_full_dict(lang).get(msg) or msg
def as_unicode(text, encoding='utf-8'):
'''Convert to unicode if required'''

View file

@ -292,16 +292,28 @@ class Email:
def set_from(self):
# gmail mailing-list compatibility
# use X-Original-Sender if available, as gmail sometimes modifies the 'From'
_from_email = self.mail.get("X-Original-From") or self.mail["From"]
_from_email, encoding = decode_header(_from_email)[0]
_from_email = self.decode_email(self.mail.get("X-Original-From") or self.mail["From"])
_reply_to = self.decode_email(self.mail.get("Reply-To"))
if encoding:
_from_email = _from_email.decode(encoding)
if _reply_to and not frappe.db.get_value('Email Account', {"email_id":_reply_to}, 'email_id'):
self.from_email = extract_email_id(_reply_to)
else:
_from_email = _from_email.decode('utf-8')
self.from_email = extract_email_id(_from_email)
self.from_email = extract_email_id(_from_email)
self.from_real_name = email.utils.parseaddr(_from_email)[0]
if self.from_email:
self.from_email = self.from_email.lower()
self.from_real_name = email.utils.parseaddr(_from_email)[0] if "@" in _from_email else _from_email
def decode_email(self, email):
if not email: return
decoded = ""
for part, encoding in decode_header(email):
if encoding:
decoded += part.decode(encoding)
else:
decoded += part.decode('utf-8')
return decoded
def set_content_and_type(self):
self.content, self.content_type = '[Blank Email]', 'text/plain'

View file

@ -4,6 +4,8 @@ import frappe
def execute():
for doctype in frappe.get_all("DocType", filters={"issingle": 0}):
doctype = doctype.name
if not frappe.db.table_exists(doctype):
continue
for column in frappe.db.sql("desc `tab{doctype}`".format(doctype=doctype), as_dict=True):
fieldname = column["Field"]

View file

@ -179,7 +179,7 @@ def get_full_dict(lang):
return {}
# found in local, return!
if getattr(frappe.local, 'lang_full_dict', None) is not None:
if getattr(frappe.local, 'lang_full_dict', None) and frappe.local.lang_full_dict.get(lang, None):
return frappe.local.lang_full_dict
frappe.local.lang_full_dict = load_lang(lang)