Reorganize controllers
- Rename ooi.api.compute.ComputeController to ooi.api.compute.Controller - Move ooi.api.BaseController to ooi.api.base.Controller
This commit is contained in:
@@ -1,20 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# Copyright 2015 Spanish National Research Council
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
|
|
||||||
class BaseController(object):
|
|
||||||
def __init__(self, app):
|
|
||||||
self.app = app
|
|
||||||
|
|||||||
20
ooi/api/base.py
Normal file
20
ooi/api/base.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2015 Spanish National Research Council
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
|
class Controller(object):
|
||||||
|
def __init__(self, app):
|
||||||
|
self.app = app
|
||||||
@@ -14,11 +14,11 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import ooi.api
|
from ooi.api import base
|
||||||
import ooi.wsgi
|
import ooi.wsgi
|
||||||
|
|
||||||
|
|
||||||
class ComputeController(ooi.api.BaseController):
|
class Controller(base.Controller):
|
||||||
def index(self, req):
|
def index(self, req):
|
||||||
tenant_id = req.environ["keystone.token_auth"].user.project_id
|
tenant_id = req.environ["keystone.token_auth"].user.project_id
|
||||||
req.path_info = "/%s/servers" % tenant_id
|
req.path_info = "/%s/servers" % tenant_id
|
||||||
@@ -26,4 +26,4 @@ class ComputeController(ooi.api.BaseController):
|
|||||||
|
|
||||||
|
|
||||||
def create_resource(app):
|
def create_resource(app):
|
||||||
return ooi.wsgi.Resource(ComputeController(app))
|
return ooi.wsgi.Resource(Controller(app))
|
||||||
|
|||||||
@@ -14,12 +14,12 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import ooi.api
|
from ooi.api import base
|
||||||
from ooi.occi.infrastructure import compute
|
from ooi.occi.infrastructure import compute
|
||||||
import ooi.wsgi
|
import ooi.wsgi
|
||||||
|
|
||||||
|
|
||||||
class Controller(ooi.api.BaseController):
|
class Controller(base.Controller):
|
||||||
def index(self, req):
|
def index(self, req):
|
||||||
l = []
|
l = []
|
||||||
l.extend(compute.ComputeResource.actions)
|
l.extend(compute.ComputeResource.actions)
|
||||||
|
|||||||
Reference in New Issue
Block a user