From c4296eca23fa373dbb92b161395ff210df732037 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 13 Sep 2013 13:02:48 +0530 Subject: [PATCH] minors --- README.md | 25 +++++++++++++------ .../page/data_import_tool/data_import_tool.py | 13 ++++------ core/page/desktop/desktop.js | 6 ++++- public/js/wn/misc/user.js | 2 +- webnotes/webutils.py | 3 +++ wnf.py | 9 +++++++ 6 files changed, 40 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 154f68aec9..a6eb09709d 100644 --- a/README.md +++ b/README.md @@ -8,20 +8,29 @@ Projects: [erpnext](http://erpnext.org) | [webnotes/erpnext](https://github.com/ To start a new project, in the application root: -Note: +Install: -1. wnframework must be called as `lib` -1. your application must be called as `app` +1. Install webnotes and treemapper -Finally: + $ git clone git@github.com:webnotes/wnframework lib + $ git clone git@github.com:webnotes/[your app] app + $ lib/wnf.py --make_conf + $ lib/wnf.py --reinstall - $ git clone git@github.com:webnotes/wnframework lib - $ git clone git@github.com:webnotes/[your app] app - $ lib/wnf.py --make_conf - $ lib/wnf.py --reinstall +1. Setup Apache Conf enjoy! + +#### Export + +Before pushing, export install fixtures + + $ lib/wnf.py --export_doclist "Website Settings" - app/startup/website_settings.json + $ lib/wnf.py --export_doclist "Style Settings" - app/startup/style_settings.json + $ lib/wnf.py --export_csv "Tree Species" app/startup/Tree_Species.csv + $ lib/wnf.py --export_csv "Tree Family" app/startup/Tree_Family.csv + ## wnf.py `$ lib/wnf.py --help` for more info diff --git a/core/page/data_import_tool/data_import_tool.py b/core/page/data_import_tool/data_import_tool.py index 0f2dbf514a..128fc1c9c1 100644 --- a/core/page/data_import_tool/data_import_tool.py +++ b/core/page/data_import_tool/data_import_tool.py @@ -33,12 +33,9 @@ def get_doctype_options(): webnotes.model.doctype.get(doctype))) @webnotes.whitelist() -def get_template(): +def get_template(doctype=None, parent_doctype=None, all_doctypes="No", with_data="No"): webnotes.check_admin_or_system_manager() - doctype = webnotes.form_dict.doctype - parenttype = webnotes.form_dict.parent_doctype - all_doctypes = webnotes.form_dict.all_doctypes=="Yes" - with_data = webnotes.form_dict.with_data + all_doctypes = all_doctypes=="Yes" column_start_end = {} if all_doctypes: @@ -52,8 +49,8 @@ def get_template(): w.writerow(['Data Import Template']) w.writerow([data_keys.main_table, doctype]) - if parenttype != doctype: - w.writerow([data_keys.parent_table, parenttype]) + if parent_doctype != doctype: + w.writerow([data_keys.parent_table, parent_doctype]) else: w.writerow(['']) @@ -199,7 +196,7 @@ def get_template(): w.writerow(row) w = UnicodeWriter() - key = 'parent' if parenttype != doctype else 'name' + key = 'parent' if parent_doctype != doctype else 'name' add_main_header() diff --git a/core/page/desktop/desktop.js b/core/page/desktop/desktop.js index 8800e3881a..a0e9e07441 100644 --- a/core/page/desktop/desktop.js +++ b/core/page/desktop/desktop.js @@ -37,7 +37,11 @@ wn.core.pages.desktop.render = function() { \
%(label)s
\ ', module)).click(function() { - wn.set_route($(this).attr("data-link")); + var link = $(this).attr("data-link"); + if(link.substr(0, 1)==="/") { + window.open(link.substr(1)) + } + wn.set_route(link); }).css({ cursor:"pointer" }).appendTo("#icon-grid"); diff --git a/public/js/wn/misc/user.js b/public/js/wn/misc/user.js index 78652194f1..171e9ceaf7 100644 --- a/public/js/wn/misc/user.js +++ b/public/js/wn/misc/user.js @@ -110,7 +110,7 @@ $.extend(wn.user, { ret = m; break; default: - ret = null; + ret = m; } return ret; }) diff --git a/webnotes/webutils.py b/webnotes/webutils.py index a5a4da6b2f..eeb745ea56 100644 --- a/webnotes/webutils.py +++ b/webnotes/webutils.py @@ -54,6 +54,7 @@ def render_page(page_name): def build_page(page_name): from jinja2 import Environment, FileSystemLoader + from markdown2 import markdown if not webnotes.conn: webnotes.connect() @@ -102,7 +103,9 @@ def build_page(page_name): context.update(module.get_context()) context.update(get_website_settings()) + jenv = Environment(loader = FileSystemLoader(basepath)) + jenv.filters["markdown"] = markdown context["base_template"] = jenv.get_template(webnotes.get_config().get("base_template")) template_name = page_options['template'] diff --git a/wnf.py b/wnf.py index cc0b302f38..b677995c63 100755 --- a/wnf.py +++ b/wnf.py @@ -286,6 +286,9 @@ def setup_options(): parser.add_option('--export_doclist', nargs=3, metavar="DOCTYPE NAME PATH", help="""Export doclist as json to the given path, use '-' as name for Singles.""") + parser.add_option('--export_csv', nargs=2, metavar="DOCTYPE PATH", + help="""Dump DocType as csv.""") + parser.add_option('--import_doclist', nargs=1, metavar="PATH", help="""Import (insert/update) doclist. If the argument is a directory, all files ending with .json are imported""") @@ -533,6 +536,12 @@ def run(): d["__islocal"] = 1 outfile.write(json.dumps(doclist, default=json_handler, indent=1, sort_keys=True)) + elif options.export_csv: + from core.page.data_import_tool.data_import_tool import get_template + with open(options.export_csv[1], "w") as csvfile: + get_template(doctype=options.export_csv[0], all_doctypes="Yes", with_data="Yes") + csvfile.write(webnotes.response.result) + elif options.import_doclist: import json if os.path.isdir(options.import_doclist):