コード例 #1
0
ファイル: files_resource.py プロジェクト: codeguycool/CEC
    def __init__(self):
        self.model_instance = FilesModel()
        # self.view_instance = FilesView()

        self.GET = ResourceRouter(
            exe_insts = {  # Register Model.
                'addon': self.model_instance.get_addon,
                'addon_version': self.model_instance.get_addon_version
            },
            disp_insts = {
            }
        )

        self.POST = ResourceRouter(
                exe_insts = {
                    'addon': self.model_instance.upload_addon
                },
                disp_insts = {
                }
            )

        self.DELETE = ResourceRouter(
                exe_insts = {
                    'addon': self.model_instance.delete_addon
                },
                disp_insts = {
                }
            )
コード例 #2
0
    def __init__(self):
        self.model_instance = DbSyncModel()
        self.view_instance = DbSyncView()

        self.GET = CachedRouter(exe_insts={
            'last_timestamp':
            self.model_instance.get_last_timestamp,
            'task_status':
            self.model_instance.get_task_status,
            'patch_columns':
            self.model_instance.get_patch_columns
        },
                                disp_insts={
                                    'last_timestamp':
                                    self.view_instance.timestamp,
                                    'task_status':
                                    self.view_instance.task_done,
                                    'patch_columns': self.view_instance.columns
                                })

        self.POST = ResourceRouter(
            exe_insts={'patch_data': self.model_instance.patch_data},
            disp_insts={'patch_data': self.view_instance.message})

        self.PUT = ResourceRouter(exe_insts={
            'update_latest_movies':
            self.model_instance.update_latest_movies,
            'rebuild_keyword':
            self.model_instance.rebuild_keyword
        },
                                  disp_insts={
                                      'update_latest_movies':
                                      self.view_instance.rowcount,
                                      'rebuild_keyword':
                                      self.view_instance.message
                                  })
コード例 #3
0
ファイル: movies_resource.py プロジェクト: codeguycool/CEC
    def __init__(self):
        self.model_instance = MoviesModel()
        self.view_instance = MoviesView()

        self.GET = CachedRouter(
            exe_insts={
                '/': self.model_instance.get_movies,
                'titles': self.model_instance.get_movie_titles,
                'metadata': self.model_instance.get_metadata
            },
            disp_insts={'/': self.view_instance.movie_view},
            cache_all=True)

        self.POST = ResourceRouter(
            exe_insts={'count': self.model_instance.add_count}, disp_insts={})
コード例 #4
0
ファイル: resource_2.py プロジェクト: codeguycool/CEC
    def __init__(self):
        # Sample code.
        self.model_instance = MODEL()
        self.view_instance = VIEW()

        self.GET = ResourceRouter(  # Replace GET method.
            exe_insts = {  # Register Model.
                '/': self.model_instance.root,  # root resource.
                'api': self.model_instance.get_api,
                'api_2': self.model_instance.get_api_2
            },
            disp_insts = {  # Register View.
                '/': self.view_instance.root,
                'api': self.view_instance.get_api_view
            }
        )
コード例 #5
0
    def __init__(self):
        self.model_instance = AVsModel()
        self.view_instance = AVsView()

        self.GET = CachedRouter(  # Replace GET method.
            exe_insts = {  # Register Model.
                '/': self.model_instance.get_avs,
                'metadata': self.model_instance.get_metadata
            },
            disp_insts = {  # Register View.
                '/': self.view_instance.avs_view
            },
            cache_all = True
        )

        self.POST = ResourceRouter(
            exe_insts={'count': self.model_instance.add_count}, disp_insts={})