[filter] Fonction pour récupérer une structure de donnée manipulable en python
This commit is contained in:
parent
cb4ac3ca18
commit
aa573c3c35
2 changed files with 11 additions and 6 deletions
|
@ -60,8 +60,9 @@ def toldapfilter(l):
|
|||
txt = "".join(c for c in pyparsing.printables if c not in '()&|!=')
|
||||
expr = pyparsing.nestedExpr("(", ")", pyparsing.Word(txt) | pyparsing.oneOf("& | != ="))
|
||||
|
||||
def human_to_ldap(data):
|
||||
data='(%s)' % data
|
||||
l=expr.parseString(data).asList()
|
||||
return "(%s)" % toldapfilter(collapse(toprefix(prioritize(l))))
|
||||
def human_to_list(data):
|
||||
if data:
|
||||
return collapse(toprefix(prioritize(expr.parseString("(%s)" % data).asList())))
|
||||
|
||||
def human_to_ldap(data):
|
||||
return "(%s)" % toldapfilter(human_to_list(data))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue