|
Lines 42-54
from ucsschool.importer.utils.logging import get_logger
Link Here
|
| 42 |
|
42 |
|
| 43 |
|
43 |
|
| 44 |
class UsernameHandler(object): |
44 |
class UsernameHandler(object): |
| 45 |
replacement_variable_pattern = re.compile(r"\[.*?\]") |
45 |
|
| 46 |
allowed_chars = string.ascii_letters + string.digits + "." |
46 |
allowed_chars = string.ascii_letters + string.digits + "." |
| 47 |
|
47 |
|
| 48 |
def __init__(self, username_max_length): |
48 |
def __init__(self, username_max_length): |
| 49 |
self.username_max_length = username_max_length |
49 |
self.username_max_length = username_max_length |
| 50 |
self.logger = get_logger() |
50 |
self.logger = get_logger() |
| 51 |
self.connection, self.position = get_admin_connection() |
51 |
self.connection, self.position = get_admin_connection() |
|
|
52 |
self.replacement_variable_pattern = re.compile(r'\[(%s)\]' % '|'.join(map(re.escape, self.counter_variable_to_function.keys()))) |
| 52 |
|
53 |
|
| 53 |
def add_to_ldap(self, username, first_number): |
54 |
def add_to_ldap(self, username, first_number): |
| 54 |
assert isinstance(username, basestring) |
55 |
assert isinstance(username, basestring) |