mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
netcmd/ldapcmp: promote re object to global
Then we can reuse the re obj. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
7d9282bf7c
commit
26f0992c24
@ -37,6 +37,8 @@ from samba.netcmd import (
|
||||
Option,
|
||||
)
|
||||
|
||||
RE_RANGED_RESULT = re.compile("^([^;]+);range=(\d+)-(\d+|\*)$")
|
||||
|
||||
|
||||
class LDAPBase(object):
|
||||
|
||||
@ -138,9 +140,7 @@ class LDAPBase(object):
|
||||
It resolved ranged results e.g. member;range=0-1499
|
||||
"""
|
||||
|
||||
r = re.compile("^([^;]+);range=(\d+)-(\d+|\*)$")
|
||||
|
||||
m = r.match(key)
|
||||
m = RE_RANGED_RESULT.match(key)
|
||||
if m is None:
|
||||
return key
|
||||
|
||||
@ -151,9 +151,7 @@ class LDAPBase(object):
|
||||
It resolved ranged results e.g. member;range=0-1499
|
||||
"""
|
||||
|
||||
r = re.compile("^([^;]+);range=(\d+)-(\d+|\*)$")
|
||||
|
||||
m = r.match(key)
|
||||
m = RE_RANGED_RESULT.match(key)
|
||||
if m is None:
|
||||
# no range, just return the values
|
||||
return vals
|
||||
@ -175,7 +173,7 @@ class LDAPBase(object):
|
||||
fvals = None
|
||||
|
||||
for key in res.keys():
|
||||
m = r.match(key)
|
||||
m = RE_RANGED_RESULT.match(key)
|
||||
|
||||
if m is None:
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user