Source

restontrac / trac-dev / restontrac / tracrest / tickets.py

Full commit
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

# Copyright 2012 José Angel Franco Navarro <jangel.franco at gmail.com>
# Copyright 2013 Olemis Lang <olemis at gmail.com>
#
#   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.


r"""Publish Trac data via a REST-ful interface

RESTful interface built on top of Trac RpcPlugin

Copyright 2012 José Angel Franco Navarro <jangel.franco at gmail.com>
Copyright 2013 Olemis Lang <olemis at gmail.com>
Licensed under the Apache License
"""

from resources import RestResourceBase

class TicketResource(RestResourceBase):

    def __init__(self):
        self.setup("tickets","ticket")

    def list(self):
        """To list all tickets when executed a
           GET request to /tickets url
        """
        return []

    def read(self, request, *args, **kwargs):
        """Method to handle Http GET request
           to /tickets/{id}
        """
        return handler.get()

    def create(self, request, *args, **kwargs):
        """Method to handle Http POST requests
           This will in general by translated into
           a CREATE routine in CRUD terms
           Specializations must implement specific logic
           if not, unsupported opperation http error
           will be returned to the client
        """
        NotImplementedError()

    def update(self, request, *args, **kwargs):
        """Method to handle Http POST requests
           This will in general by translated into
           an UPDATE routine in CRUD terms
           Specializations must implement specific logic
           if not, unsupported opperation http error
           will be returned to the client
        """
        NotImplementedError()

    def update_diff(self, request, *args, **kwargs):
        """Method to handle Http PATCH requests
           This will in general by translated into
           an UPDATE routine in CRUD terms
        """
        #TODO evaluate if this operation must be supported

    def delete(self, request, *args, **kwargs):
        """Method to handle Http DELETE requests
           This will in general by translated into
           a DELETE routine in CRUD terms
           Specializations must implement specific logic
           if not, unsupported opperation http error
           will be returned to the client
        """
        NotImplementedError()