@frappe.whitelist()
def getdoc(doctype, name, user=None):
 if (not (doctype and name)):
  raise Exception, u'doctype and name required!'
 if (not name):
  name = doctype
 if (not frappe.db.exists(doctype, name)):
  return []
 try:
  doc = frappe.get_doc(doctype, name)
  run_onload(doc)
  if (not doc.has_permission(u'read')):
   raise frappe.PermissionError, (u'read', doctype, name)
  doc.apply_fieldlevel_read_permissions()
  get_docinfo(doc)
 except Exception:
  frappe.errprint(frappe.utils.get_traceback())
  frappe.msgprint(_(u'Did not load'))
  raise
 if (doc and (not name.startswith(u'_'))):
  frappe.get_user().update_recent(doctype, name)
 doc.add_seen()
 frappe.response.docs.append(doc)

@ frappe . whitelist ( ) def getdoc ( doctype , name , user = None ) : if ( not ( doctype and name ) ) : raise Exception , u'doctype and name required!' if ( not name ) : name = doctype if ( not frappe . db . exists ( doctype , name ) ) : return [ ] try : doc = frappe . get_doc ( doctype , name ) run_onload ( doc ) if ( not doc . has_permission ( u'read' ) ) : raise frappe . PermissionError , ( u'read' , doctype , name ) doc . apply_fieldlevel_read_permissions ( ) get_docinfo ( doc ) except Exception : frappe . errprint ( frappe . utils . get_traceback ( ) ) frappe . msgprint ( _ ( u'Did not load' ) ) raise if ( doc and ( not name . startswith ( u'_' ) ) ) : frappe . get_user ( ) . update_recent ( doctype , name ) doc . add_seen ( ) frappe . response . docs . append ( doc )
get the doc string or comments for an object .