[python-ldap] modifyModlist : are old and new values get compared somehow ?

Benjamin Dauvergne bdauvergne at entrouvert.com
Tue Dec 1 09:03:05 EST 2015


Le 12/01, mh at ow2.org a écrit :
>    A side question : when I print str(mod), I see the constant value as
>    number : is there a way to see that constant as constant name  ?(ie :
>    MOD_XXX)

No those constants are just variables, you would have to reverse them yourself by doing something
like:

        def get_mode_constant_name(value):
            for varname in dir(ldap):
                if varname.startwith('MOD_') and getattr(ldap, varname) == value:
                    return varname

But this question is more related to general Python programming.

-- 
Benjamin Dauvergne - Tel Entrouvert: 01 43 35 01 35 - Tel perso: 01 84 16 24 53


More information about the python-ldap mailing list