[minor] fixes for frappe/erpnext#8347
This commit is contained in:
parent
0ff340ba3b
commit
a7f63eb381
2 changed files with 6 additions and 6 deletions
|
|
@ -198,18 +198,18 @@ class EmailServer:
|
|||
uidnext=uidnext,
|
||||
email_account=self.settings.email_account)
|
||||
)
|
||||
|
||||
|
||||
# uid validity not found pulling emails for first time
|
||||
if not uid_validity:
|
||||
self.settings.email_sync_rule = "UNSEEN"
|
||||
return
|
||||
|
||||
|
||||
sync_count = 100 if uid_validity else int(self.settings.initial_sync_count)
|
||||
from_uid = 1 if uidnext < (sync_count + 1) or (uidnext - sync_count) < 1 else uidnext - sync_count
|
||||
# sync last 100 email
|
||||
self.settings.email_sync_rule = "UID {}:{}".format(from_uid, uidnext)
|
||||
self.uid_reindexed = True
|
||||
|
||||
|
||||
elif uid_validity == current_uid_validity:
|
||||
return
|
||||
|
||||
|
|
@ -407,9 +407,9 @@ class Email:
|
|||
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
|
||||
if not email: return
|
||||
decoded = ""
|
||||
for part, encoding in decode_header(email.replace("\""," ").replace("\'"," ")):
|
||||
for part, encoding in decode_header(frappe.as_unicode(email).replace("\""," ").replace("\'"," ")):
|
||||
if encoding:
|
||||
decoded += part.decode(encoding)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ def get_translation_dict_from_file(path, lang, app):
|
|||
elif len(item)==2:
|
||||
cleaned[item[0]] = strip(item[1])
|
||||
|
||||
else:
|
||||
elif item:
|
||||
raise Exception("Bad translation in '{app}' for language '{lang}': {values}".format(
|
||||
app=app, lang=lang, values=repr(item).encode("utf-8")
|
||||
))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue