Merge branch 'develop'

This commit is contained in:
Nabin Hait 2015-12-29 14:14:16 +05:30
commit d45f3baa55
6 changed files with 81 additions and 12 deletions

View file

@ -1,2 +1,2 @@
from __future__ import unicode_literals
__version__ = "6.16.2"
__version__ = "6.16.3"

View file

@ -117,7 +117,7 @@ class EmailAccount(Document):
try:
email_server.connect()
except (error_proto, imaplib.IMAP4.error), e:
if in_receive and (e.message=="-ERR authentication failed" or "log in via your web browser" in e.message):
if in_receive and ("authentication failed" in e.message.lower() or "log in via your web browser" in e.message.lower()):
# if called via self.receive and it leads to authentication error, disable incoming
# and send email to system manager
self.handle_incoming_connect_error(

View file

@ -5,7 +5,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd."
app_description = "Full stack web framework with Python, Javascript, MariaDB, Redis, Node"
app_icon = "octicon octicon-circuit-board"
app_version = "6.16.2"
app_version = "6.16.3"
app_color = "orange"
source_link = "https://github.com/frappe/frappe"
app_license = "MIT"

View file

@ -13,6 +13,7 @@ execute:frappe.reload_doc('desk', 'doctype', 'todo') #2014-12-31-1
execute:frappe.reload_doc('custom', 'doctype', 'property_setter') #2014-12-31-1
execute:frappe.reload_doc('core', 'doctype', 'patch_log') #2016-10-31
execute:frappe.reload_doctype("File") # 2015-10-19
execute:frappe.reload_doc('core', 'doctype', 'error_snapshot')
execute:frappe.db.sql("alter table `tabSessions` modify `user` varchar(255), engine=InnoDB")
execute:frappe.db.sql("delete from `tabDocField` where parent='0'")
frappe.patches.v4_0.change_varchar_length
@ -108,6 +109,6 @@ frappe.patches.v6_6.fix_file_url
frappe.patches.v6_9.rename_burmese_language
frappe.patches.v6_11.rename_field_in_email_account
execute:frappe.create_folder(os.path.join(frappe.local.site_path, 'private', 'files'))
frappe.patches.v6_15.remove_property_setter_for_previous_field
frappe.patches.v6_15.remove_property_setter_for_previous_field #2015-12-29
frappe.patches.v6_15.set_username
execute:frappe.permissions.reset_perms("Error Snapshot")

View file

@ -2,14 +2,82 @@
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
import frappe, json
from frappe.utils import cstr
def execute():
frappe.db.sql("""delete from `tabProperty Setter` where property='previous_field'""")
for d in frappe.db.sql("""select name from `tabCustom Field`
where insert_after is not null and insert_after != ''"""):
try:
frappe.get_doc("Custom Field", d[0]).set_property_setter_for_idx()
except frappe.DoesNotExistError:
pass
all_custom_fields = frappe._dict()
for d in frappe.db.sql("""select name, dt, fieldname, insert_after from `tabCustom Field`
where insert_after is not null and insert_after != ''""", as_dict=1):
all_custom_fields.setdefault(d.dt, frappe._dict()).setdefault(d.fieldname, d.insert_after)
for dt, custom_fields in all_custom_fields.items():
_idx = []
existing_ps = frappe.db.get_value("Property Setter",
{"doc_type": dt, "property": "_idx"}, ["name", "value", "creation"], as_dict=1)
# if no existsing property setter, build based on meta
if not existing_ps:
_idx = get_sorted_fields(dt, custom_fields)
else:
_idx = json.loads(existing_ps.value)
idx_needs_to_be_fixed = False
for fieldname, insert_after in custom_fields.items():
# Delete existing property setter if field is not there
if fieldname not in _idx:
idx_needs_to_be_fixed = True
break
else:
previous_field = _idx[_idx.index(fieldname) - 1]
if previous_field != insert_after and cstr(existing_ps.creation) >= "2015-12-28":
idx_needs_to_be_fixed = True
break
if idx_needs_to_be_fixed:
frappe.delete_doc("Property Setter", existing_ps.name)
_idx = get_sorted_fields(dt, custom_fields)
if _idx:
frappe.make_property_setter({
"doctype":dt,
"doctype_or_field": "DocType",
"property": "_idx",
"value": json.dumps(_idx),
"property_type": "Text"
}, validate_fields_for_doctype=False)
def get_sorted_fields(doctype, custom_fields):
"""sort on basis of insert_after"""
fields_dict = frappe.get_meta(doctype).get("fields")
standard_fields_count = frappe.db.sql("""select count(name) from `tabDocField`
where parent=%s""", doctype)[0][0]
newlist = []
pending = [d.fieldname for d in fields_dict]
maxloops = len(custom_fields) + 20
while (pending and maxloops>0):
maxloops -= 1
for fieldname in pending[:]:
if fieldname in custom_fields and len(newlist) >= standard_fields_count:
# field already added
for n in newlist:
if n==custom_fields.get(fieldname):
newlist.insert(newlist.index(n)+1, fieldname)
pending.remove(fieldname)
break
else:
newlist.append(fieldname)
pending.remove(fieldname)
# recurring at end
if pending:
newlist += pending
return newlist

View file

@ -1,7 +1,7 @@
from setuptools import setup, find_packages
from pip.req import parse_requirements
version = "6.16.2"
version = "6.16.3"
requirements = parse_requirements("requirements.txt", session="")
setup(