From 13bbf6536b468a4e5ed94752b7099c92128f8512 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 10 Sep 2013 14:44:36 +0530 Subject: [PATCH] [minor] webutils moved to lib --- .../p03_move_website_to_framework.py | 4 +- startup/webutils.py | 56 ------------------- 2 files changed, 3 insertions(+), 57 deletions(-) diff --git a/patches/september_2013/p03_move_website_to_framework.py b/patches/september_2013/p03_move_website_to_framework.py index cbfed7c178..9629b7acc1 100644 --- a/patches/september_2013/p03_move_website_to_framework.py +++ b/patches/september_2013/p03_move_website_to_framework.py @@ -12,5 +12,7 @@ def execute(): if os.path.exists(utils_pyc): os.remove(utils_pyc) - shutil.rmtree(os.path.join(get_base_path(), "app", "website")) + old_path = os.path.join(get_base_path(), "app", "website") + if os.path.exists(old_path): + shutil.rmtree(old_path) \ No newline at end of file diff --git a/startup/webutils.py b/startup/webutils.py index 9ce3f0a582..cd37be4964 100644 --- a/startup/webutils.py +++ b/startup/webutils.py @@ -3,62 +3,6 @@ import webnotes, conf, os from webnotes.utils import cint, cstr, encode - -def get_templates_path(): - return os.path.join(os.path.dirname(conf.__file__), "app", "website", "templates") - -def update_template_args(page_name, args): - - from webnotes.utils import get_request_site_address - from urllib import quote - - all_top_items = webnotes.conn.sql("""\ - select * from `tabTop Bar Item` - where parent='Website Settings' and parentfield='top_bar_items' - order by idx asc""", as_dict=1) - - top_items = [d for d in all_top_items if not d['parent_label']] - - # attach child items to top bar - for d in all_top_items: - if d['parent_label']: - for t in top_items: - if t['label']==d['parent_label']: - if not 'child_items' in t: - t['child_items'] = [] - t['child_items'].append(d) - break - - ret = webnotes._dict({ - 'top_bar_items': top_items, - 'footer_items': webnotes.conn.sql("""\ - select * from `tabTop Bar Item` - where parent='Website Settings' and parentfield='footer_items' - order by idx asc""", as_dict=1), - - 'int':int, - "webnotes": webnotes, - "utils": webnotes.utils - }) - - args.update(ret) - - settings = webnotes.doc("Website Settings", "Website Settings") - for k in ["banner_html", "brand_html", "copyright", "address", "twitter_share_via", - "favicon", "facebook_share", "google_plus_one", "twitter_share", "linked_in_share", - "disable_signup"]: - if k in settings.fields: - args[k] = settings.fields.get(k) - - for k in ["facebook_share", "google_plus_one", "twitter_share", "linked_in_share", - "disable_signup"]: - args[k] = cint(args.get(k) or 0) - - args.url = quote(str(get_request_site_address(full_address=True)), str("")) - args.encoded_title = quote(encode(args.title or ""), str("")) - args.shopping_cart_enabled = cint(webnotes.conn.get_default("shopping_cart_enabled")) - - return args @webnotes.whitelist() def update_profile(fullname, password=None, company_name=None, mobile_no=None, phone=None):