Browse Source

3to4 fixes

version-14
Anand Doshi 11 years ago
parent
commit
4e4b9197d2
3 changed files with 15 additions and 10 deletions
  1. +1
    -1
      frappe/modules/__init__.py
  2. +12
    -8
      frappe/patches/4_0/rename_sitemap_to_route.py
  3. +2
    -1
      frappe/patches/4_0/set_website_route_idx.py

+ 1
- 1
frappe/modules/__init__.py View File

@@ -32,7 +32,7 @@ def get_doc_path(module, doctype, name):


def reload_doc(module, dt=None, dn=None, force=True): def reload_doc(module, dt=None, dn=None, force=True):
from frappe.modules.import_file import import_files from frappe.modules.import_file import import_files
return import_files(scrub(module), scrub(dt), scrub(dn), force=force)
return import_files(module, dt, dn, force=force)


def export_doc(doctype, name, module=None): def export_doc(doctype, name, module=None):
"""write out a doc""" """write out a doc"""


+ 12
- 8
frappe/patches/4_0/rename_sitemap_to_route.py View File

@@ -10,14 +10,18 @@ def execute():
if "tabWebsite Template" not in tables: if "tabWebsite Template" not in tables:
frappe.rename_doc("DocType", "Website Sitemap Config", "Website Template", force=True) frappe.rename_doc("DocType", "Website Sitemap Config", "Website Template", force=True)
if "tabWebsite Route Permission" not in tables:
frappe.rename_doc("DocType", "Website Sitemap Permission", "Website Route Permission", force=True)
try:
if "tabWebsite Route Permission" not in tables:
frappe.rename_doc("DocType", "Website Sitemap Permission", "Website Route Permission", force=True)
for d in ("Blog Category", "Blog Post", "Web Page", "Website Route", "Website Group"):
rename_field(d, "parent_website_sitemap", "parent_website_route")
rename_field("Website Route", "website_sitemap_config", "website_template")
rename_field("Website Route Permission", "website_sitemap", "website_route")
except Exception, e:
if e.args[0] != 1054:
raise

for d in ("blog_category", "blog_post", "web_page", "website_route", "website_group"): for d in ("blog_category", "blog_post", "web_page", "website_route", "website_group"):
frappe.reload_doc("website", "doctype", d) frappe.reload_doc("website", "doctype", d)
for d in ("Blog Category", "Blog Post", "Web Page", "Website Route", "Website Group"):
rename_field(d, "parent_website_sitemap", "parent_website_route")
rename_field("Website Route", "website_sitemap_config", "website_template")
rename_field("Website Route Permission", "website_sitemap", "website_route")

+ 2
- 1
frappe/patches/4_0/set_website_route_idx.py View File

@@ -13,7 +13,8 @@ def execute():
doctype = frappe.get_attr(get_template_controller(app, g["path"], g["fname"]) + ".doctype") doctype = frappe.get_attr(get_template_controller(app, g["path"], g["fname"]) + ".doctype")
module = frappe.db.get_value("DocType", doctype, "module") module = frappe.db.get_value("DocType", doctype, "module")
frappe.reload_doc(module, "doctype", doctype) frappe.reload_doc(module, "doctype", doctype)
frappe.db.sql("""update `tabBlog Category` set `title`=`name` where ifnull(`title`, '')=''""")
frappe.db.sql("""update `tabWebsite Route` set idx=null""") frappe.db.sql("""update `tabWebsite Route` set idx=null""")
for doctype in ["Blog Category", "Blog Post", "Web Page", "Website Group"]: for doctype in ["Blog Category", "Blog Post", "Web Page", "Website Group"]:
frappe.db.sql("""update `tab{}` set idx=null""".format(doctype)) frappe.db.sql("""update `tab{}` set idx=null""".format(doctype))


Loading…
Cancel
Save