示例#1
0
    def test_get(self):
        '''
        another way to limit access is to arrange setup_tree function that
        will determine tree parameters (roots and leafs) according to user permissions
        '''

        api = rest('api', __name__, {'o': O(a='a name', b={'c':'d'})}, roots=OView)
        self.app.application.register_blueprint(api, url_prefix='/api')
        self.assertTrue('\n'.join(self.app.get('/api/o').response) == 'a name')
        self.assertTrue('\n'.join(self.app.get('/api/o/b').response) == 'd')
示例#2
0
 def test_post(self):
     api = rest('api', __name__, {'o': O(a='a name', b={'c':'d'})}, roots=OView)
     self.app.application.register_blueprint(api, url_prefix='/api')
     self.assertTrue('\n'.join(self.app.post('/api/o/b', data={'a':1, 'b':2}).response) == '12')
示例#3
0
AmpleMarkup(web)

with web.app_context():
    from treemap import *


def get_objects():
    return DatasetsDict(current_app)


datasets = rest(
    'dataset',
    __name__,
    get_objects,
    template_base='dataset-tree-page.html',
    xhr_template_base='xml-fragment.xml',
    roots=DatasetView,
    tree_class=EmbeddedAssetsTree,
    super_root_class=TreeRootView,
    leaf_classes = (DatasourceView,)
    )

editor = rest(
    'editor',
    __name__,
    get_objects,
    template_base='editor-page.xml',
    xhr_template_base='xml-fragment.xml',
    roots=DatasetView,
    # tree_class=EmbeddedAssetsTree,
    super_root_class=TreeRootView,
示例#4
0
web.config.from_object(Config)
AmpleMarkup(web)

with web.app_context():
    from treemap import *


def get_objects():
    return DatasetsDict(current_app)


datasets = rest('dataset',
                __name__,
                get_objects,
                template_base='dataset-tree-page.html',
                xhr_template_base='xml-fragment.xml',
                roots=DatasetView,
                tree_class=EmbeddedAssetsTree,
                super_root_class=TreeRootView,
                leaf_classes=(DatasourceView, ))

editor = rest(
    'editor',
    __name__,
    get_objects,
    template_base='editor-page.xml',
    xhr_template_base='xml-fragment.xml',
    roots=DatasetView,
    # tree_class=EmbeddedAssetsTree,
    super_root_class=TreeRootView,
    leaf_classes=())