From 2bfe4cbf38902a697384d6fb4cc038b0b4963dbf Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 14 Feb 2014 17:30:22 +0530 Subject: [PATCH] Fix in Bean --- frappe/core/doctype/profile/test_profile.py | 97 ++++++++++++--------- frappe/model/bean.py | 3 + frappe/templates/pages/login.py | 3 +- 3 files changed, 60 insertions(+), 43 deletions(-) diff --git a/frappe/core/doctype/profile/test_profile.py b/frappe/core/doctype/profile/test_profile.py index 1c83f3a961..94703ff4e7 100644 --- a/frappe/core/doctype/profile/test_profile.py +++ b/frappe/core/doctype/profile/test_profile.py @@ -57,46 +57,59 @@ class TestProfile(unittest.TestCase): self.assertEquals(len(p_meta.get({"fieldname": ["not in", ["first_name", "last_name"]]})), len(p_meta) - 2) -test_records = [[{ - "doctype":"Profile", - "email": "test@example.com", - "first_name": "_Test", - "new_password": "testpassword", - "enabled": 1 - }, { - "doctype":"UserRole", - "parentfield":"user_roles", - "role": "_Test Role" - }, { - "doctype":"UserRole", - "parentfield":"user_roles", - "role": "System Manager" - }], - [{ - "doctype":"Profile", - "email": "test1@example.com", - "first_name": "_Test1", - "new_password": "testpassword" - }], - [{ - "doctype":"Profile", - "email": "test2@example.com", - "first_name": "_Test2", - "new_password": "testpassword" - }], - [{ - "doctype":"Profile", - "email": "testdelete@example.com", - "first_name": "_Test", - "new_password": "testpassword", - "enabled": 1 - }, { - "doctype":"UserRole", - "parentfield":"user_roles", - "role": "_Test Role 2" - }, { - "doctype":"UserRole", - "parentfield":"user_roles", - "role": "System Manager" - }], +test_records = [ + [ + { + "doctype":"Profile", + "email": "test@example.com", + "first_name": "_Test", + "new_password": "testpassword", + "enabled": 1 + }, + { + "doctype":"UserRole", + "parentfield":"user_roles", + "role": "_Test Role" + }, + { + "doctype":"UserRole", + "parentfield":"user_roles", + "role": "System Manager" + } + ], + [ + { + "doctype":"Profile", + "email": "test1@example.com", + "first_name": "_Test1", + "new_password": "testpassword" + } + ], + [ + { + "doctype":"Profile", + "email": "test2@example.com", + "first_name": "_Test2", + "new_password": "testpassword" + } + ], + [ + { + "doctype":"Profile", + "email": "testdelete@example.com", + "first_name": "_Test", + "new_password": "testpassword", + "enabled": 1 + }, + { + "doctype":"UserRole", + "parentfield":"user_roles", + "role": "_Test Role 2" + }, + { + "doctype":"UserRole", + "parentfield":"user_roles", + "role": "System Manager" + } + ], ] \ No newline at end of file diff --git a/frappe/model/bean.py b/frappe/model/bean.py index 289c9cf6eb..7d03877a11 100644 --- a/frappe/model/bean.py +++ b/frappe/model/bean.py @@ -38,6 +38,9 @@ class Bean: if dt and dn: if isinstance(dn, dict): dn = frappe.conn.get_value(dt, dn, "name") + if dn is None: + raise frappe.DoesNotExistError + self.load_from_db(dt, dn) elif isinstance(dt, list): self.set_doclist(dt) diff --git a/frappe/templates/pages/login.py b/frappe/templates/pages/login.py index 26cb27e4ae..8e1cf85244 100644 --- a/frappe/templates/pages/login.py +++ b/frappe/templates/pages/login.py @@ -6,5 +6,6 @@ import frappe def get_context(context): # get settings from site config + context["title"] = "Login" if frappe.conf.get("fb_app_id"): - return { "fb_app_id": frappe.conf.fb_app_id, "title": "Login" } + return { "fb_app_id": frappe.conf.fb_app_id }