예제 #1
0
 def get(self):
     pluginsDict = dict((key, request.args.get(key))
                        for key in request.args.keys())
     for plugin in pluginsDict:
         setPluginState(plugin, pluginsDict[plugin])
         if pluginsDict[plugin].lower() == u'true' and isPluginEnabled(
                 plugin, getApp()) == False:
             dirs = os.walk("plugins").next()
             if plugin not in dirs[1]:
                 raise PluginDoesNotExistException(plugin)
             else:
                 enablePlugin(getApi(), plugin)
예제 #2
0
 def testGetApi(self):
     obj1 = getApi()
     obj2 = getApi()
     self.assertEqual(obj1, obj2)
예제 #3
0
파일: main.py 프로젝트: geo2tag/geo2tag
def addResources():
    getApi().representations = DEFAULT_REPRESENTATIONS
    getApi().add_resource(ChannelsListResource, getPathWithPrefix(
        '/service/<string:serviceName>/channel'))
    getApi().add_resource(ChannelResource, getPathWithPrefix(
        '/service/<string:serviceName>/channel/<string:channelId>'))
    getApi().add_resource(PointResource, getPathWithPrefix(
        '/service/<string:serviceName>/point/<string:pointId>'))
    getApi().add_resource(PointListResource, getPathWithPrefix(
        '/service/<string:serviceName>/point'))
    getApi().add_resource(LogoutResource, getPathWithPrefix('/logout'))
    getApi().add_resource(LoginResource, getPathWithPrefix('/login'))
    getApi().add_resource(LoginGoogleResource, getPathWithPrefix(
        '/login/google'))
    getApi().add_resource(LoginFacebookResource,
                          getPathWithPrefix('/login/facebook'))
    getApi().add_resource(DebugLoginResource, getPathWithPrefix(
        '/login/debug'))
    getApi().add_resource(TestsResource, getPathWithPrefix('/tests'))
    getApi().add_resource(AdminServiceListResource, getPathWithPrefix(
        '/admin/service'))
    getApi().add_resource(AdminServiceResource, getPathWithPrefix(
        '/admin/service/<service_id>'))
    getApi().add_resource(
        MapResource,
        getPathWithPrefix('/service/<string:serviceName>/map'))
    getApi().add_resource(
        GetAllPluginsWithStatusResource,
        getPathWithPrefix('/plugin'))
    getApi().add_resource(
        ManagePluginsResource,
        getPathWithPrefix('/manage_plugins'))
    getApi().add_resource(
        InternalTestsResource,
        getPathWithPrefix('/internal_tests'))
    getApi().add_resource(
        AdminResource,
        getPathWithPrefix('/admin'))
    getApi().add_resource(
        AdminLogResource,
        getPathWithPrefix('/admin/log'))
    getApi().add_resource(
        ServiceResource,
        getPathWithPrefix('/service/<string:serviceName>'))
    getApi().add_resource(
        StatusResource,
        getPathWithPrefix('/status'))
    getApi().add_resource(
        ServiceListResource,
        getPathWithPrefix('/service'))
    getApi().add_resource(
        DebugInfoResource,
        getPathWithPrefix('/debug_info'))
    getApi().add_resource(
        LogResource,
        getPathWithPrefix('/service/<string:serviceName>/log'),
        getPathWithPrefix('/log'))
    getApi().add_resource(
        UserFindResource,
        getPathWithPrefix('/user/<string:user_id>'))
    getApi().add_resource(
        PluginConfigResource,
        getPathWithPrefix('/plugin_config/<string:pluginName>'))
    getApi().add_resource(
        UserListResource,
        getPathWithPrefix('/user'))
    getApi().add_resource(
        MacrosTestsResource,
        getPathWithPrefix('/macros_tests'))
    getApi().add_resource(
        MetadataResource,
        getPathWithPrefix(
            '/service/<string:serviceName>/metadata/<string:metadata_id>'))
    getApi().add_resource(
        MetadataListResource,
        getPathWithPrefix(
            '/service/<string:serviceName>/metadata'))
    getApi().add_resource(AdminPluginListResource, getPathWithPrefix(
        '/admin/plugin'))
    getApi().add_resource(AdminPluginConfigResource, getPathWithPrefix(
        '/admin/plugin/config/<string:pluginName>'))
    getApi().add_resource(IconResource, getPathWithPrefix(
        '/service/<string:serviceName>/get_icon'))

    # end of the list of imported resources

    atexit.register(closeConnection)

    initApp(getApi())
예제 #4
0
 def testGetApi(self):
     obj1 = getApi()
     obj2 = getApi()
     self.assertEqual(obj1, obj2)
예제 #5
0
def addResources():
    getApi().representations = DEFAULT_REPRESENTATIONS
    getApi().add_resource(ChannelsListResource, getPathWithPrefix(
        '/service/<string:serviceName>/channel'))
    getApi().add_resource(ChannelResource, getPathWithPrefix(
        '/service/<string:serviceName>/channel/<string:channelId>'))
    getApi().add_resource(PointResource, getPathWithPrefix(
        '/service/<string:serviceName>/point/<string:pointId>'))
    getApi().add_resource(PointListResource, getPathWithPrefix(
        '/service/<string:serviceName>/point'))
    getApi().add_resource(LogoutResource, getPathWithPrefix('/logout'))
    getApi().add_resource(LoginResource, getPathWithPrefix('/login'))
    getApi().add_resource(LoginGoogleResource, getPathWithPrefix(
        '/login/google'))
    getApi().add_resource(LoginFacebookResource,
                          getPathWithPrefix('/login/facebook'))
    getApi().add_resource(DebugLoginResource, getPathWithPrefix(
        '/login/debug'))
    getApi().add_resource(TestsResource, getPathWithPrefix('/tests'))
    getApi().add_resource(AdminServiceListResource, getPathWithPrefix(
        '/admin/service'))
    getApi().add_resource(AdminServiceResource, getPathWithPrefix(
        '/admin/service/<service_id>'))
    getApi().add_resource(
        MapResource,
        getPathWithPrefix('/service/<string:serviceName>/map'))
    getApi().add_resource(
        GetAllPluginsWithStatusResource,
        getPathWithPrefix('/plugin'))
    getApi().add_resource(
        ManagePluginsResource,
        getPathWithPrefix('/manage_plugins'))
    getApi().add_resource(
        InternalTestsResource,
        getPathWithPrefix('/internal_tests'))
    getApi().add_resource(
        AdminResource,
        getPathWithPrefix('/admin'))
    getApi().add_resource(
        AdminLogResource,
        getPathWithPrefix('/admin/log'))
    getApi().add_resource(
        ServiceResource,
        getPathWithPrefix('/service/<string:serviceName>'))
    getApi().add_resource(
        StatusResource,
        getPathWithPrefix('/status'))
    getApi().add_resource(
        ServiceListResource,
        getPathWithPrefix('/service'))
    getApi().add_resource(
        DebugInfoResource,
        getPathWithPrefix('/debug_info'))
    getApi().add_resource(
        LogResource,
        getPathWithPrefix('/service/<string:serviceName>/log'),
        getPathWithPrefix('/log'))
    getApi().add_resource(
        UserFindResource,
        getPathWithPrefix('/user/<string:user_id>'))
    getApi().add_resource(
        PluginConfigResource,
        getPathWithPrefix('/plugin_config/<string:pluginName>'))
    getApi().add_resource(
        UserListResource,
        getPathWithPrefix('/user'))
    getApi().add_resource(
        MacrosTestsResource,
        getPathWithPrefix('/macros_tests'))
    getApi().add_resource(
        MetadataResource,
        getPathWithPrefix(
            '/service/<string:serviceName>/metadata/<string:metadata_id>'))
    getApi().add_resource(
        MetadataListResource,
        getPathWithPrefix(
            '/service/<string:serviceName>/metadata'))
    # end of the list of imported resources

    atexit.register(closeConnection)

    initApp(getApi())