From 825a6221356005de889a43304868c1db450dac47 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 9 Jun 2016 16:07:09 +0530 Subject: [PATCH 1/3] [fix] change in versioning: store __version__ in __init__.py --- frappe/__init__.py | 2 +- frappe/__version__.py | 2 -- frappe/hooks.py | 4 ++-- frappe/utils/boilerplate.py | 21 ++++++++++++++++++--- setup.py | 9 ++++++++- 5 files changed, 29 insertions(+), 9 deletions(-) delete mode 100644 frappe/__version__.py diff --git a/frappe/__init__.py b/frappe/__init__.py index 8f56d0d90f..71788796aa 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -11,10 +11,10 @@ from functools import wraps import os, importlib, inspect, logging, json # public -from frappe.__version__ import __version__ from .exceptions import * from .utils.jinja import get_jenv, get_template, render_template +__version__ = "6.27.21" local = Local() diff --git a/frappe/__version__.py b/frappe/__version__.py deleted file mode 100644 index 0fb7878698..0000000000 --- a/frappe/__version__.py +++ /dev/null @@ -1,2 +0,0 @@ -from __future__ import unicode_literals -__version__ = "6.27.21" diff --git a/frappe/hooks.py b/frappe/hooks.py index dfb0685e1c..b5234ee349 100644 --- a/frappe/hooks.py +++ b/frappe/hooks.py @@ -1,11 +1,11 @@ from __future__ import unicode_literals +from . import __version__ as app_version + app_name = "frappe" app_title = "Frappe Framework" app_publisher = "Frappe Technologies" app_description = "Full stack web framework with Python, Javascript, MariaDB, Redis, Node" - app_icon = "octicon octicon-circuit-board" -app_version = "6.27.21" app_color = "orange" source_link = "https://github.com/frappe/frappe" app_license = "MIT" diff --git a/frappe/utils/boilerplate.py b/frappe/utils/boilerplate.py index 1a175ce59c..022fcb575e 100644 --- a/frappe/utils/boilerplate.py +++ b/frappe/utils/boilerplate.py @@ -53,7 +53,8 @@ def make_boilerplate(dest, app_name): "includes")) frappe.create_folder(os.path.join(dest, hooks.app_name, hooks.app_name, "config"), with_init=True) - touch_file(os.path.join(dest, hooks.app_name, hooks.app_name, "__init__.py")) + with open(os.path.join(dest, hooks.app_name, hooks.app_name, "__init__.py"), "w") as f: + f.write(encode(init_template)) with open(os.path.join(dest, hooks.app_name, "MANIFEST.in"), "w") as f: f.write(encode(manifest_template.format(**hooks))) @@ -110,8 +111,16 @@ recursive-include {app_name} *.svg recursive-include {app_name} *.txt recursive-exclude {app_name} *.pyc""" +init_template = """# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +__version__ = '0.0.1' + +""" + hooks_template = """# -*- coding: utf-8 -*- from __future__ import unicode_literals +from . import __version__ as app_version app_name = "{app_name}" app_title = "{app_title}" @@ -120,7 +129,6 @@ app_description = "{app_description}" app_icon = "{app_icon}" app_color = "{app_color}" app_email = "{app_email}" -app_version = "0.0.1" app_license = "{app_license}" # Includes in @@ -244,8 +252,15 @@ def get_data(): setup_template = """# -*- coding: utf-8 -*- from setuptools import setup, find_packages from pip.req import parse_requirements +import re, ast + +# get version from __version__ variable in {app_name}/__init__.py +_version_re = re.compile(r'__version__\s+=\s+(.*)') + +with open('{app_name}/__init__.py', 'rb') as f: + version = str(ast.literal_eval(_version_re.search( + f.read().decode('utf-8')).group(1))) -version = '0.0.1' requirements = parse_requirements("requirements.txt", session="") setup( diff --git a/setup.py b/setup.py index afe470c8ed..bbcf6cfb37 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,14 @@ from setuptools import setup, find_packages from pip.req import parse_requirements +import re, ast + +# get version from __version__ variable in frappe/__init__.py +_version_re = re.compile(r'__version__\s+=\s+(.*)') + +with open('frappe/__init__.py', 'rb') as f: + version = str(ast.literal_eval(_version_re.search( + f.read().decode('utf-8')).group(1))) -version = "6.27.21" requirements = parse_requirements("requirements.txt", session="") setup( From dc8fd8d3640b0f1526ae68b8735856f3d6254de0 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 15 Jun 2016 12:44:00 +0530 Subject: [PATCH 2/3] [Fix] Unable to see the communication on LEAD time line, #WN-SUP18721 --- frappe/desk/form/load.py | 59 +++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/frappe/desk/form/load.py b/frappe/desk/form/load.py index fcc4859e42..929613f492 100644 --- a/frappe/desk/form/load.py +++ b/frappe/desk/form/load.py @@ -117,28 +117,7 @@ def get_communications(doctype, name, start=0, limit=20): def _get_communications(doctype, name, start=0, limit=20): - match_conditions = get_feed_match_conditions() - communications = frappe.db.sql("""select name, communication_type, - communication_medium, comment_type, - content, sender, sender_full_name, creation, subject, delivery_status, _liked_by, - timeline_doctype, timeline_name, - reference_doctype, reference_name, - link_doctype, link_name, - "Communication" as doctype - from tabCommunication - where - communication_type in ("Communication", "Comment") - and ( - (reference_doctype=%(doctype)s and reference_name=%(name)s) - or (timeline_doctype=%(doctype)s and timeline_name=%(name)s) - ) - and (comment_type is null or comment_type != 'Update') - {match_conditions} - order by creation desc limit %(start)s, %(limit)s""" - .format(match_conditions=("and " + match_conditions) if match_conditions else ""), - { "doctype": doctype, "name": name, "start": frappe.utils.cint(start), "limit": limit }, - as_dict=True) - + communications = get_communication_data(doctype, name, start, limit) for c in communications: if c.communication_type=="Communication": c.attachments = json.dumps(frappe.get_all("File", @@ -152,6 +131,42 @@ def _get_communications(doctype, name, start=0, limit=20): return communications +def get_communication_data(doctype, name, start=0, limit=20, after=None, fields=None, + group_by=None, as_dict=True): + '''Returns list of communications for a given document''' + if not fields: + fields = '''name, communication_type, + communication_medium, comment_type, + content, sender, sender_full_name, creation, subject, delivery_status, _liked_by, + timeline_doctype, timeline_name, + reference_doctype, reference_name, + link_doctype, link_name, + "Communication" as doctype''' + + conditions = '''communication_type in ("Communication", "Comment") + and ( + (reference_doctype=%(doctype)s and reference_name=%(name)s) + or (timeline_doctype=%(doctype)s + and timeline_name=%(name)s + and communication_type="Comment" + and comment_type in ("Created", "Updated", "Submitted", "Cancelled", "Deleted")) + ) + and (comment_type is null or comment_type != 'Update')''' + + if after: + # find after a particular date + conditions+= ' and creation > {0}'.format(after) + + communications = frappe.db.sql("""select {fields} + from tabCommunication + where {conditions} {group_by} + order by creation desc limit %(start)s, %(limit)s""".format( + fields = fields, conditions=conditions, group_by=group_by or ""), + { "doctype": doctype, "name": name, "start": frappe.utils.cint(start), "limit": limit }, + as_dict=as_dict) + + return communications + def get_assignments(dt, dn): cl = frappe.db.sql("""select owner, description from `tabToDo` where reference_type=%(doctype)s and reference_name=%(name)s and status="Open" From 5c10902ec240a97401e65396ed8361c9e7f78ebb Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 21 Jun 2016 17:15:36 +0600 Subject: [PATCH 3/3] bumped to version 6.27.22 --- frappe/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/__init__.py b/frappe/__init__.py index 71788796aa..ea05db6e52 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -14,7 +14,7 @@ import os, importlib, inspect, logging, json from .exceptions import * from .utils.jinja import get_jenv, get_template, render_template -__version__ = "6.27.21" +__version__ = "6.27.22" local = Local()