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:
Alvaro Lopez Garcia
2015-03-05 11:24:02 +01:00
parent cab5f1374a
commit bbfeddf63e
4 changed files with 25 additions and 25 deletions

View File

@@ -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
View 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

View File

@@ -14,11 +14,11 @@
# License for the specific language governing permissions and limitations
# under the License.
import ooi.api
from ooi.api import base
import ooi.wsgi
class ComputeController(ooi.api.BaseController):
class Controller(base.Controller):
def index(self, req):
tenant_id = req.environ["keystone.token_auth"].user.project_id
req.path_info = "/%s/servers" % tenant_id
@@ -26,4 +26,4 @@ class ComputeController(ooi.api.BaseController):
def create_resource(app):
return ooi.wsgi.Resource(ComputeController(app))
return ooi.wsgi.Resource(Controller(app))

View File

@@ -14,12 +14,12 @@
# License for the specific language governing permissions and limitations
# under the License.
import ooi.api
from ooi.api import base
from ooi.occi.infrastructure import compute
import ooi.wsgi
class Controller(ooi.api.BaseController):
class Controller(base.Controller):
def index(self, req):
l = []
l.extend(compute.ComputeResource.actions)