def loadDict(self, d):
    for key in d:
        if (key in self._allowedKeys):
            if (key in self._structure):
                if issubclass(self._structure[key][0], Proxy):
                    try:
                        exec(('self.%s = typeworld.api.%s()' % (key, self._structure[key][0].dataType.__name__)))
                    except Exception:
                        exec(('self.%s = %s()' % (key, self._structure[key][0].dataType.__name__)))
                    exec(('self.%s.loadDict(d[key])' % key))
                elif issubclass(self._structure[key][0], ListProxy):
                    _list = self.__getattr__(key)
                    _list.value = []
                    for item in d[key]:
                        o = self._structure[key][0].dataType.dataType()
                        if hasattr(o, 'loadDict'):
                            o.loadDict(item)
                            _list.append(o)
                        else:
                            _list.append(item)
                    exec('self._content[key] = _list')
                else:
                    self.set(key, d[key])
def loadDict(self, d):
    for key in d:
        if (key in self._allowedKeys):
            if (key in self._structure):
                if issubclass(self._structure[key][0], Proxy):
                    try:
                        exec(('self.%s = typeworld.api.%s()' % (key, self._structure[key][0].dataType.__name__)))
                    except Exception:
                        exec(('self.%s = %s()' % (key, self._structure[key][0].dataType.__name__)))
                    exec(('self.%s.loadDict(d[key])' % key))
                elif issubclass(self._structure[key][0], ListProxy):
                    _list = self.__getattr__(key)
                    _list.value = []
                    for item in d[key]:
                        o = self._structure[key][0].dataType.dataType()
                        if hasattr(o, 'loadDict'):
                            o.loadDict(item)
                            _list.append(o)
                        else:
                            _list.append(item)
                    exec('self._content[key] = _list')
                else:
                    self.set(key, d[key])