Example #1
0
def index(request):
    return render_to_response(
        'ngeo_browse_server_index.html', {
            "version": get_version(),
        },
        context_instance=RequestContext(request)
    )
Example #2
0
def index(request):
    return render_to_response(
        'ngeo_browse_server_index.html', {
            "version": get_version(),
        },
        context_instance=RequestContext(request)
    )
Example #3
0
def status(request):
    status = get_status()

    try:
        # GET means "status"
        if request.method == "GET":
            return JsonResponse({
                "timestamp":
                dt.datetime.now().replace(microsecond=0).isoformat(),
                "state":
                status.state(),
                "softwareversion":
                get_version(),
                "queues": [
                    # TODO: find relevant status queues
                    #{"name": "request1",
                    #"counters": [{
                    #    "name": "counter1",
                    #    "value": 2
                    #}, {
                    #    "name": "counter2",
                    #    "value": 2
                    #}]}
                ]
            })

        # PUT means "control"
        elif request.method == "PUT":
            # set status
            values = json.load(request)
            command = values["command"]

            try:
                status.command(command)
                return JsonResponse({"result": "SUCCESS"})
            except AttributeError:
                fault_string = "Invalid command '%s'." % command
            except NotImplemented, e:
                fault_string = "Command '%s' is not supported." % command
            except Exception, e:
                fault_string = str(e)
Example #4
0
def status(request):
    status = get_status()

    try:
        # GET means "status"
        if request.method == "GET":
            return JsonResponse(
                {
                    "timestamp": dt.datetime.now().replace(microsecond=0).isoformat(),
                    "state": status.state(),
                    "softwareversion": get_version(),
                    "queues": [
                        # TODO: find relevant status queues
                        # {"name": "request1",
                        # "counters": [{
                        #    "name": "counter1",
                        #    "value": 2
                        # }, {
                        #    "name": "counter2",
                        #    "value": 2
                        # }]}
                    ],
                }
            )

        # PUT means "control"
        elif request.method == "PUT":
            # set status
            values = json.load(request)
            command = values["command"]

            try:
                status.command(command)
                return JsonResponse({"result": "SUCCESS"})
            except AttributeError:
                fault_string = "Invalid command '%s'." % command
            except NotImplemented, e:
                fault_string = "Command '%s' is not supported." % command
            except Exception, e:
                fault_string = str(e)
Example #5
0
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#-------------------------------------------------------------------------------

import os

from setuptools import setup

from ngeo_browse_server import get_version

version = get_version()

def read(fname):
    return open(os.path.join(os.path.dirname(__file__), fname)).read()

def fullsplit(path, result=None):
    """
    Split a pathname into components (the opposite of os.path.join) in a
    platform-neutral way.
    """
    if result is None:
        result = []
    head, tail = os.path.split(path)
    if head == '':
        return [tail] + result
    if head == path:
Example #6
0
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#-------------------------------------------------------------------------------

import os

from setuptools import setup

from ngeo_browse_server import get_version

version = get_version()


def read(fname):
    return open(os.path.join(os.path.dirname(__file__), fname)).read()


def fullsplit(path, result=None):
    """
    Split a pathname into components (the opposite of os.path.join) in a
    platform-neutral way.
    """
    if result is None:
        result = []
    head, tail = os.path.split(path)
    if head == '':