Exemplo n.º 1
0
    def createDataModel(self, encode, path, showAccessible, inCollection):
        '''
        Create the data model for the provided encode model.
        '''
        assert isinstance(encode, EncodeModel), 'Invalid encode model %s' % encode

        data = DataModel()
        if path:
            assert isinstance(path, Path), 'Invalid request path %s' % path
            data.path = path.findGetModel(encode.modelType)
            if inCollection: data.accessiblePath = data.path
            else: data.accessiblePath = path
            if showAccessible: self.processAccessible(data)

        for nameProp, encodeProp in encode.properties.items():
            if isinstance(encodeProp, EncodeModel):
                assert isinstance(encodeProp, EncodeModel)
                data.datas[nameProp] = self.createDataModel(encodeProp, path.findGetModel(encodeProp.modelType), False, False)

        return data
Exemplo n.º 2
0
    def createDataModel(self, encode, path, showAccessible):
        '''
        Create the data model for the provided encode model.
        '''
        assert isinstance(encode, EncodeModel), 'Invalid encode model %s' % encode

        data = DataModel()
        if path:
            assert isinstance(path, Path), 'Invalid request path %s' % path
            data.path = path.findGetModel(encode.modelType)
            if showAccessible:
                accessible = path.findGetAllAccessible()
                if accessible:
                    accessible = [(pathLongName(acc), acc) for acc in accessible]
                    accessible.sort(key=firstOf)
                    data.accessible = OrderedDict(accessible)

        for nameProp, encodeProp in encode.properties.items():
            if isinstance(encodeProp, EncodeModel):
                assert isinstance(encodeProp, EncodeModel)
                data.datas[nameProp] = self.createDataModel(encodeProp, path.findGetModel(encodeProp.modelType), False)

        return data
Exemplo n.º 3
0
    def createDataModel(self, encode, path, showAccessible, inCollection):
        '''
        Create the data model for the provided encode model.
        '''
        assert isinstance(encode, EncodeModel), 'Invalid encode model %s' % encode

        data = DataModel()
        if path:
            assert isinstance(path, Path), 'Invalid request path %s' % path
            data.path = findGetModel(path, encode.modelType)
            data.modelPaths[encode.modelType] = data.path
            if inCollection: data.accessiblePath = data.path
            else: data.accessiblePath = path
            if showAccessible: self.processAccessible(encode, data)

        for nameProp, encodeProp in encode.properties.items():
            if isinstance(encodeProp, EncodeModel):
                assert isinstance(encodeProp, EncodeModel)
                data.datas[nameProp] = self.createDataModel(encodeProp, findGetModel(path, encodeProp.modelType),
                                                            False, False)

        return data