From 2e6b3ad3560a01bec56a54eab06015abd25fab89 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 4 Mar 2016 22:38:37 +0530 Subject: [PATCH] [fixes] changed patches while migrating from v4 to v6 --- frappe/config/docs.py | 2 +- frappe/docs/_config.yml | 2 ++ frappe/docs/index.html | 5 +--- frappe/docs/user/en/index.txt | 1 + frappe/docs/user/en/tutorial/index.md | 3 +++ frappe/docs/user/en/videos/index.md | 2 +- frappe/docs/user/fr/index.txt | 1 + frappe/docs/user/fr/tutorial/web-views.md | 4 +-- frappe/docs/user/fr/videos/index.md | 2 +- frappe/docs/user/index.md | 6 +++++ frappe/docs/user/index.txt | 2 ++ frappe/patches.txt | 1 + frappe/patches/v4_0/change_varchar_length.py | 3 +++ frappe/patches/v5_0/update_shared.py | 1 + .../v6_11/rename_field_in_email_account.py | 3 ++- .../v6_19/comment_feed_communication.py | 26 +++++++++++-------- frappe/website/doctype/web_page/web_page.py | 6 +++-- 17 files changed, 47 insertions(+), 23 deletions(-) create mode 100644 frappe/docs/_config.yml create mode 100644 frappe/docs/user/index.md create mode 100644 frappe/docs/user/index.txt diff --git a/frappe/config/docs.py b/frappe/config/docs.py index e6f77bc1dd..b045c15e76 100644 --- a/frappe/config/docs.py +++ b/frappe/config/docs.py @@ -20,7 +20,7 @@ to ERPNext. Frappe Framework was designed to build [ERPNext](https://erpnext.com), open source ERP for managing small and medium sized businesses. -[Get started with the Tutorial](https://frappe.github.io/frappe/user/tutorial) +[Get started with the Tutorial](https://frappe.github.io/frappe/user/) """ docs_version = "6.x.x" diff --git a/frappe/docs/_config.yml b/frappe/docs/_config.yml new file mode 100644 index 0000000000..ebbb601208 --- /dev/null +++ b/frappe/docs/_config.yml @@ -0,0 +1,2 @@ +gems: + - jekyll-redirect-from diff --git a/frappe/docs/index.html b/frappe/docs/index.html index 35a80e1bc1..8b1e6eb3d8 100644 --- a/frappe/docs/index.html +++ b/frappe/docs/index.html @@ -44,10 +44,7 @@ to ERPNext.

Frappe Framework was designed to build ERPNext, open source ERP for managing small and medium sized businesses.

-

- Get started with the Tutorial - Débuter le tutoriel -

+

Get started with the Tutorial

diff --git a/frappe/docs/user/en/index.txt b/frappe/docs/user/en/index.txt index dfc33261aa..1e50854610 100755 --- a/frappe/docs/user/en/index.txt +++ b/frappe/docs/user/en/index.txt @@ -1,2 +1,3 @@ tutorial guides +videos diff --git a/frappe/docs/user/en/tutorial/index.md b/frappe/docs/user/en/tutorial/index.md index 56f5817fc5..e2d23236d0 100755 --- a/frappe/docs/user/en/tutorial/index.md +++ b/frappe/docs/user/en/tutorial/index.md @@ -1,3 +1,6 @@ +--- +redirect_from: "/user/tutorial" +--- # Frappe Tutorial In this guide we will show you how to create an application from scratch using **Frappe**. Using the example of a Library Management System, we will cover: diff --git a/frappe/docs/user/en/videos/index.md b/frappe/docs/user/en/videos/index.md index edcdf8ac54..8b095501e4 100755 --- a/frappe/docs/user/en/videos/index.md +++ b/frappe/docs/user/en/videos/index.md @@ -2,7 +2,7 @@ This 10-part video tutorial will teach you how to build complex apps in Frappe -Pre-requisites: You must have some understanding of Python, Javascript and MySQL before you start this tutorial. +Pre-requisites: You must have some understanding of Python, Javascript and MySQL before you start this tutorial. --- diff --git a/frappe/docs/user/fr/index.txt b/frappe/docs/user/fr/index.txt index dfc33261aa..1e50854610 100644 --- a/frappe/docs/user/fr/index.txt +++ b/frappe/docs/user/fr/index.txt @@ -1,2 +1,3 @@ tutorial guides +videos diff --git a/frappe/docs/user/fr/tutorial/web-views.md b/frappe/docs/user/fr/tutorial/web-views.md index ed5409d800..c14e63a170 100644 --- a/frappe/docs/user/fr/tutorial/web-views.md +++ b/frappe/docs/user/fr/tutorial/web-views.md @@ -29,7 +29,7 @@ Cliquez sur un article et vous devriez voir une vue par défaut. Maintenant, si vous voulez une meilleur liste pour vos articles, créez un fichier appelé `list_item.html` dans le repertoire `library_management/doctype/article`. Voici un exemple du contenu de ce fichier: -
+ {% raw %} +
{% endraw %} Ici, vous aurez toutes les propriétés d'un article dans l'object `doc`. diff --git a/frappe/docs/user/fr/videos/index.md b/frappe/docs/user/fr/videos/index.md index edcdf8ac54..883c586cc7 100644 --- a/frappe/docs/user/fr/videos/index.md +++ b/frappe/docs/user/fr/videos/index.md @@ -2,7 +2,7 @@ This 10-part video tutorial will teach you how to build complex apps in Frappe -Pre-requisites: You must have some understanding of Python, Javascript and MySQL before you start this tutorial. +Pre-requisites: You must have some understanding of Python, Javascript and MySQL before you start this tutorial. --- diff --git a/frappe/docs/user/index.md b/frappe/docs/user/index.md new file mode 100644 index 0000000000..a95a166ace --- /dev/null +++ b/frappe/docs/user/index.md @@ -0,0 +1,6 @@ +# Frappe Developer Tutorial + +Select your language + +1. [English](en) +1. [Français](fr) diff --git a/frappe/docs/user/index.txt b/frappe/docs/user/index.txt new file mode 100644 index 0000000000..7e6d9e4012 --- /dev/null +++ b/frappe/docs/user/index.txt @@ -0,0 +1,2 @@ +en +fr diff --git a/frappe/patches.txt b/frappe/patches.txt index e3c132ab93..49855837d4 100644 --- a/frappe/patches.txt +++ b/frappe/patches.txt @@ -15,6 +15,7 @@ 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 diff --git a/frappe/patches/v4_0/change_varchar_length.py b/frappe/patches/v4_0/change_varchar_length.py index 950d56316d..29fe8f310d 100644 --- a/frappe/patches/v4_0/change_varchar_length.py +++ b/frappe/patches/v4_0/change_varchar_length.py @@ -5,6 +5,9 @@ from __future__ import unicode_literals import frappe def execute(): + frappe.db.sql('update tabDocField set search_index=0 where fieldtype="Small Text"') + frappe.db.sql('update tabDocField set in_list_view=0 where fieldtype="Image"') + for dt in frappe.db.sql_list("""select name from `tabDocType` where issingle=0"""): desc = dict((d["Field"], d) for d in frappe.db.sql("desc `tab{}`".format(dt), as_dict=True)) alter_table = [] diff --git a/frappe/patches/v5_0/update_shared.py b/frappe/patches/v5_0/update_shared.py index e8b4370eac..8ce3f842af 100644 --- a/frappe/patches/v5_0/update_shared.py +++ b/frappe/patches/v5_0/update_shared.py @@ -4,6 +4,7 @@ import frappe.share def execute(): frappe.reload_doc("core", "doctype", "docperm") frappe.reload_doc("core", "doctype", "docshare") + frappe.reload_doc('email', 'doctype', 'email_account') # default share to all writes frappe.db.sql("""update tabDocPerm set `share`=1 where ifnull(`write`,0)=1 and ifnull(`permlevel`,0)=0""") diff --git a/frappe/patches/v6_11/rename_field_in_email_account.py b/frappe/patches/v6_11/rename_field_in_email_account.py index 8c22e4fc5c..8462ab66ad 100644 --- a/frappe/patches/v6_11/rename_field_in_email_account.py +++ b/frappe/patches/v6_11/rename_field_in_email_account.py @@ -2,4 +2,5 @@ import frappe def execute(): frappe.reload_doc("email", "doctype", "email_account") - frappe.db.sql("update `tabEmail Account` set email_server = pop3_server") + if frappe.db.has_column('Email Account', 'pop3_server'): + frappe.db.sql("update `tabEmail Account` set email_server = pop3_server") diff --git a/frappe/patches/v6_19/comment_feed_communication.py b/frappe/patches/v6_19/comment_feed_communication.py index 09eeaa63fc..89c4b3d89c 100644 --- a/frappe/patches/v6_19/comment_feed_communication.py +++ b/frappe/patches/v6_19/comment_feed_communication.py @@ -20,6 +20,13 @@ def execute(): update_timeline_doc_for("Blogger") def migrate_comments(): + from_fields = "" + to_fields = "" + + if "reference_doctype" in frappe.db.get_table_columns("Comment"): + from_fields = "reference_doctype as link_doctype, reference_name as link_name," + to_fields = "link_doctype, link_name," + # comments frappe.db.sql("""insert ignore into `tabCommunication` ( subject, @@ -30,8 +37,7 @@ def migrate_comments(): communication_date, reference_doctype, reference_name, - link_doctype, - link_name, + {to_fields} name, user, @@ -53,8 +59,7 @@ def migrate_comments(): ifnull(timestamp(comment_date, comment_time), creation) as communication_date, comment_doctype as reference_doctype, comment_docname as reference_name, - reference_doctype as link_doctype, - reference_name as link_name, + {from_fields} name, owner as user, @@ -66,7 +71,8 @@ def migrate_comments(): 'Sent' as sent_or_received, 'Comment' as communication_type, 1 as seen - from `tabComment` where comment_doctype is not null and comment_doctype not in ('Message', 'My Company')""") + from `tabComment` where comment_doctype is not null and comment_doctype not in ('Message', 'My Company')""" + .format(to_fields=to_fields, from_fields=from_fields)) # chat and assignment notifications frappe.db.sql("""insert ignore into `tabCommunication` ( @@ -78,8 +84,7 @@ def migrate_comments(): communication_date, reference_doctype, reference_name, - link_doctype, - link_name, + {to_fields} name, user, @@ -105,8 +110,7 @@ def migrate_comments(): ifnull(timestamp(comment_date, comment_time), creation) as communication_date, 'User' as reference_doctype, comment_docname as reference_name, - reference_doctype as link_doctype, - reference_name as link_name, + {from_fields} name, owner as user, @@ -122,7 +126,8 @@ def migrate_comments(): end as communication_type, 1 as seen - from `tabComment` where comment_doctype in ('Message', 'My Company')""", {"assignment": _("Assignment")}) + from `tabComment` where comment_doctype in ('Message', 'My Company')""" + .format(to_fields=to_fields, from_fields=from_fields), {"assignment": _("Assignment")}) def migrate_feed(): # migrate delete feed @@ -296,4 +301,3 @@ def is_valid_timeline_doctype(reference_doctype, timeline_doctype): return True - diff --git a/frappe/website/doctype/web_page/web_page.py b/frappe/website/doctype/web_page/web_page.py index 34684ed921..2ba1006273 100644 --- a/frappe/website/doctype/web_page/web_page.py +++ b/frappe/website/doctype/web_page/web_page.py @@ -52,8 +52,10 @@ class WebPage(WebsiteGenerator): # render dynamic context (if .py file exists) # get absolute template path considering first fragment as app name - split_path = self.template_path.split(os.sep) - self.template_path = os.path.join(frappe.get_app_path(split_path[0]), *split_path[1:]) + if not self.template_path.startswith(os.sep): + split_path = self.template_path.split(os.sep) + + self.template_path = os.path.join(frappe.get_app_path(split_path[0]), *split_path[1:]) context = self.get_dynamic_context(frappe._dict(context))