From 526a60b517c5271e2e15bf4576ff8b84938021b4 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 16 Jul 2013 15:14:13 +0530 Subject: [PATCH] [minor] fixed patch --- patches/may_2013/p06_make_notes.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/patches/may_2013/p06_make_notes.py b/patches/may_2013/p06_make_notes.py index 597468a9d4..1cc9bc3e7c 100644 --- a/patches/may_2013/p06_make_notes.py +++ b/patches/may_2013/p06_make_notes.py @@ -6,18 +6,21 @@ def execute(): for question in webnotes.conn.sql("""select * from tabQuestion""", as_dict=True): if question.question: - name = question.question[:180] - if webnotes.conn.exists("Note", name): - webnotes.delete_doc("Note", name) - note = webnotes.bean({ - "doctype":"Note", - "title": name, - "content": "
".join([markdown2.markdown(c) for c in webnotes.conn.sql_list(""" - select answer from tabAnswer where question=%s""", question.name)]), - "owner": question.owner, - "creation": question.creation, - "public": 1 - }).insert() + try: + name = question.question[:180] + if webnotes.conn.exists("Note", name): + webnotes.delete_doc("Note", name) + note = webnotes.bean({ + "doctype":"Note", + "title": name, + "content": "
".join([markdown2.markdown(c) for c in webnotes.conn.sql_list(""" + select answer from tabAnswer where question=%s""", question.name)]), + "owner": question.owner, + "creation": question.creation, + "public": 1 + }).insert() + except NameError: + pass webnotes.delete_doc("DocType", "Question") webnotes.delete_doc("DocType", "Answer")