# Path: ldapcherry/pyyamlwrapper.py
# def loadNoDump(stream):
#     loader = MyLoader(stream)
#     try:
#         return loader.get_single_data()
#     finally:
#         loader.dispose()
# 
# Path: ldapcherry/pyyamlwrapper.py
# class DumplicatedKey(Exception):
#     def __init__(self, host, key):
#         self.host = host
#         self.key = key


import os
import sys
import re
import yaml
from ldapcherry.pyyamlwrapper import loadNoDump
from ldapcherry.pyyamlwrapper import DumplicatedKey
from ldapcherry.exceptions import *
    from sets import Set as set

    def check_attr(self, attr, value):
        attrid = attr
        if attrid not in self.attributes:
            raise AttrNotDefined(attrid)
        attr_type = self.attributes[attrid]['type']
        if attr_type == 'string':
            return
        elif attr_type == 'textfield':
            return
        elif attr_type == 'email':
            if self._is_email(value):
                return
            else:
                raise WrongAttrValue(attrid, attr_type)
        elif attr_type == 'int':
            try:
                int(value)
                return
            except ValueError:
                raise WrongAttrValue(attrid, attr_type)
        elif attr_type == 'stringlist':
            if value in self.attributes[attrid]['values']:
                return
            else:
                raise WrongAttrValue(attrid, attr_type)
        elif attr_type == 'fix':
            if value != self.attributes[attrid]['value']:
                raise WrongAttrValue(attrid, attr_type)
        elif attr_type == 'password':

# Path: ldapcherry/pyyamlwrapper.py
# def loadNoDump(stream):
#     loader = MyLoader(stream)
#     try:
#         return loader.get_single_data()
#     finally:
#         loader.dispose()
# 
# Path: ldapcherry/pyyamlwrapper.py
# class DumplicatedKey(Exception):
#     def __init__(self, host, key):
#         self.host = host
#         self.key = key


# Path: ldapcherry/attributes.py
import os
import sys
import re
import yaml
from ldapcherry.pyyamlwrapper import loadNoDump
from ldapcherry.pyyamlwrapper import DumplicatedKey
from ldapcherry.exceptions import *
    from sets import Set as set


    def check_attr(self, attr, value):
        attrid = attr
        if attrid not in self.attributes:
            raise AttrNotDefined(attrid)
        attr_type = self.attributes[attrid]['type']
        if attr_type == 'string':
            return
        elif attr_type == 'textfield':
            return
        elif attr_type == 'email':
            if self._is_email(value):
                return
            else:
                raise WrongAttrValue(attrid, attr_type)
        elif attr_type == 'int':
            try:
                int(value)
                return
            except ValueError:
                raise WrongAttrValue(attrid, attr_type)
        elif attr_type == 'stringlist':
            if value in self.attributes[attrid]['values']:
                return
            else:
                raise WrongAttrValue(attrid, attr_type)
        elif attr_type == 'fix':
            if value != self.attributes[attrid]['value']:
                raise WrongAttrValue(attrid, attr_type)
        elif attr_type == 'password':

            return