From fd18fc798626d6afd7f556f6373fe328655ed7f4 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 19 Mar 2013 13:02:46 +0530 Subject: [PATCH] print format standard - start --- website/helpers/print.py | 35 ------------------------------ website/templates/pages/print.html | 2 +- website/utils.py | 2 +- 3 files changed, 2 insertions(+), 37 deletions(-) delete mode 100644 website/helpers/print.py diff --git a/website/helpers/print.py b/website/helpers/print.py deleted file mode 100644 index 41eb82c1af..0000000000 --- a/website/helpers/print.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (c) 2012 Web Notes Technologies Pvt Ltd. -# License: GNU General Public License (v3). For more information see license.txt - -from __future__ import unicode_literals -import webnotes -from webnotes import _ - -def get_args(): - if not webnotes.form_dict.doctype or not webnotes.form_dict.name \ - or not webnotes.form_dict.format: - return { - "body": """

Error

-

Parameters doctype, name and format required

-
%s
""" % repr(webnotes.form_dict) - } - - obj = webnotes.get_obj(webnotes.form_dict.doctype, webnotes.form_dict.name) - return { - "body": get_html(obj.doc, obj.doclist) - } - -def get_html(doc, doclist): - from jinja2 import Environment - from core.doctype.print_style.print_style import get_print_style - from core.doctype.print_format.print_format import get_print_format - - template = Environment().from_string(get_print_format(webnotes.form_dict.format)) - - args = { - "doc": doc, - "doclist": doclist, - "print_style": get_print_style() - } - html = template.render(args) - return html diff --git a/website/templates/pages/print.html b/website/templates/pages/print.html index 21fb9a22b1..a8decdf660 100644 --- a/website/templates/pages/print.html +++ b/website/templates/pages/print.html @@ -3,7 +3,7 @@ - {{ doc and (doc.name + " - " + doc.doctype) or "Error" }} + Print Format diff --git a/website/utils.py b/website/utils.py index 4d9cee979e..811a40dcab 100644 --- a/website/utils.py +++ b/website/utils.py @@ -44,7 +44,7 @@ page_settings_map = { "contact": "Contact Us Settings", "blog": "website.helpers.blog.get_blog_template_args", "writers": "website.helpers.blog.get_writers_args", - "print": "website.helpers.print.get_args" + "print": "core.doctype.print_format.print_format.get_args" } no_cache = ["message", "print"]