Exemplo n.º 1
0
    def __init__(self, *args, **kwargs):
        # Super
        odict.__init__(self, *args, **kwargs)

        # Initialize services.
        self['tbsos'] = TBSOSService()
        self['freemium'] = FreemiumService()
Exemplo n.º 2
0
    def __init__(self, key_model, value_model, *args, **kwargs):
        # Get key model.
        if type(key_model) != types.TypeType:
            raise Exception("%s: bad key_model (not instantiable): '%s'" % \
                 ( self.__class__.__name__, str(key_model) ) )
        self.key_model = key_model

        # Get value model.
        if type(value_model) != types.TypeType:
            raise Exception("%s: bad value_model (not instantiable): '%s'" % \
                 ( self.__class__.__name__, str(value_model) ) )
        self.value_model = value_model

        # Get key import callable.
        self.import_key_call = None
        if kwargs.has_key('import_key_call'):
            if not callable(kwargs['import_key_call']):
                raise Exception("import_key_call parameter is not callable.")
            self.import_key_call = kwargs['import_key_call']
            del kwargs['import_key_call']

        # Get value import callable.
        self.import_value_call = None
        if kwargs.has_key('import_value_call'):
            if not callable(kwargs['import_value_call']):
                raise Exception("import_value_call parameter is not callable.")
            self.import_value_call = kwargs['import_value_call']
            del kwargs['import_value_call']

        # Super.
        odict.__init__(self, *args, **kwargs)

        # Replace keys and values with validated ones.
        for key, value in self.items():
            key = self._validate_key(key)
            value = self._validate_value(value)
            self[key] = value
Exemplo n.º 3
0
    def __init__(self, key_model, value_model, *args, **kwargs):
        # Get key model.
        if type(key_model) != types.TypeType:
           raise Exception("%s: bad key_model (not instantiable): '%s'" % \
                ( self.__class__.__name__, str(key_model) ) )
        self.key_model = key_model

        # Get value model.
        if type(value_model) != types.TypeType:
           raise Exception("%s: bad value_model (not instantiable): '%s'" % \
                ( self.__class__.__name__, str(value_model) ) )
        self.value_model = value_model

        # Get key import callable.
        self.import_key_call = None
        if kwargs.has_key('import_key_call'):
            if not callable(kwargs['import_key_call']):
                raise Exception("import_key_call parameter is not callable.")
            self.import_key_call = kwargs['import_key_call']
            del kwargs['import_key_call']

        # Get value import callable.
        self.import_value_call = None
        if kwargs.has_key('import_value_call'):
            if not callable(kwargs['import_value_call']):
                raise Exception("import_value_call parameter is not callable.")
            self.import_value_call = kwargs['import_value_call']
            del kwargs['import_value_call']

        # Super.
        odict.__init__(self, *args, **kwargs)

        # Replace keys and values with validated ones.
        for key, value in self.items():
            key = self._validate_key(key)
            value = self._validate_value(value)
            self[key] = value
Exemplo n.º 4
0
 def __init__(self, doc=None):
     odict.__init__(self)
     self.doc = doc
Exemplo n.º 5
0
 def __init__(self, doc=None):
     odict.__init__(self)
     self.doc = doc