當前位置: 首頁>>代碼示例>>Python>>正文


Python LdapCherry._get_user方法代碼示例

本文整理匯總了Python中ldapcherry.LdapCherry._get_user方法的典型用法代碼示例。如果您正苦於以下問題:Python LdapCherry._get_user方法的具體用法?Python LdapCherry._get_user怎麽用?Python LdapCherry._get_user使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ldapcherry.LdapCherry的用法示例。


在下文中一共展示了LdapCherry._get_user方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testGetUser

# 需要導入模塊: from ldapcherry import LdapCherry [as 別名]
# 或者: from ldapcherry.LdapCherry import _get_user [as 別名]
 def testGetUser(self):
     app = LdapCherry()
     loadconf('./tests/cfg/ldapcherry_test.ini', app)
     expected = {
         'password': u'passwordsmith',
         'cn': u'Sheri Smith',
         'uid': u'ssmith',
         'name': u'smith',
         'email': [u'[email protected]',
                  u'[email protected]',
                  u'[email protected]'
             ],
         }
     ret = app._get_user('ssmith')
     assert expected == ret
開發者ID:kakwa,項目名稱:ldapcherry,代碼行數:17,代碼來源:test_LdapCherry.py

示例2: ValueError

# 需要導入模塊: from ldapcherry import LdapCherry [as 別名]
# 或者: from ldapcherry.LdapCherry import _get_user [as 別名]
        if section not in result:
            result[section] = {}
        for option in self.options(section):
            value = self.get(section, option, raw=raw, vars=vars)
            try:
                value = cherrypy.lib.reprconf.unrepr(value)
            except Exception:
                x = sys.exc_info()[1]
                msg = ("Config error in section: %r, option: %r, "
                       "value: %r. Config values must be valid Python." %
                       (section, option, value))
                raise ValueError(msg, x.__class__.__name__, x.args)
            result[section][option] = value
    return result
cherrypy.lib.reprconf.Parser.as_dict = new_as_dict


def loadconf(configfile, instance):
    app = cherrypy.tree.mount(instance, '/', configfile)
    cherrypy.config.update(configfile)
    instance.reload(app.config)

app = LdapCherry()
loadconf('./tests/cfg/ldapcherry.ini', app)
ret = app._get_user('ssmith')
print ret

}

form = {'groups': {}, 'attrs': {'password1': u'password☭', 'password2': u'password☭', 'shell': u'/bin/zsh', 'cn': u'Test ☭ Test', 'name': u'Test ☭', 'uidNumber': u'1000', 'gidNumber': u'1000', 'home': u'/home/test', 'first-name': u'Test ☭', 'email': u'[email protected]', 'uid': u'test'}, 'roles': {'admin-lv3': u'on', 'admin-lv2': u'on', 'users': u'on'}}
開發者ID:kakwa,項目名稱:ldapcherry,代碼行數:32,代碼來源:debug_lc.py


注:本文中的ldapcherry.LdapCherry._get_user方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。