Fix in Bean

This commit is contained in:
Anand Doshi 2014-02-14 17:30:22 +05:30
parent 482e55ec33
commit 2bfe4cbf38
3 changed files with 60 additions and 43 deletions

View file

@ -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"
}
],
]

View file

@ -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)

View file

@ -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 }