Exemplo n.º 1
0
            page=page,
            limit=limit
        )

    @jsonp
    def post(self):
        return jsonify_status_code(
            code=405,
            message='HTTP method POST is not allowed for this URL'
        )


Payments_view = Payments.as_view('payments')
api.add_url_rule(
    '/payments',
    view_func=Payments_view,
    methods=['GET', 'POST']
)

PaymentsList_view = PaymentsList.as_view('payments_list')
api.add_url_rule(
    '/payments/list',
    view_func=PaymentsList_view,
    methods=['GET', 'POST']
)

PaymentsCount_view = PaymentsCount.as_view('payments_count')
api.add_url_rule(
    '/payments/count',
    view_func=PaymentsCount_view,
    methods=['GET', 'POST']
Exemplo n.º 2
0
    @jsonp
    def delete(self, id):
        if not id:
            return jsonify_status_code(400, message='Id is required')

        try:
            MyModel.objects.get(id=id).delete()
        except MyModel.DoesNotExist:
            return jsonify_status_code(410,
                    message='MyModel with id %s not found' % id)

        return jsonify_status_code(204, message='Deleted')

my_model_view = MyModelAPI.as_view('my_model_api')
api.add_url_rule('/my-model',
        view_func=my_model_view, methods=['GET', 'POST', ])
api.add_url_rule('/my-model/<string:id>',
        view_func=my_model_view, methods=['DELETE', 'GET', 'PUT', ])


class SessionAPI(MethodView):
    @jsonp
    def get(self):
        if not current_user.is_authenticated():
            return jsonify_status_code(410)
        return jsonify_status_code(200,
                username=current_user.username,
                email=current_user.email,
                admin=current_user.has_admin_access())

    @jsonp
Exemplo n.º 3
0
try:
    from flask import Module
    from app_server.views.user.login import Login
    from app_server.views.user.logout import Logout
    from app_server.views.user.register import Register
    from app_server.views.user.members import Members
    from app_server.views.user.administration import Administration
    from app_server.views.user.edit import Edit
except ImportError as error_message:
    MESSAGE = '\n{0}\n{1}\n'.format(__file__, error_message)
    sys.exit(MESSAGE)  # Force close python ATS ##############################

__author__ = 'Vladimir Roncevic'
__copyright__ = 'Copyright 2017, Free software to use and distributed it.'
__credits__ = ['Vladimir Roncevic']
__license__ = 'GNU General Public License (GPL)'
__version__ = '1.4.0'
__maintainer__ = 'Vladimir Roncevic'
__email__ = '*****@*****.**'
__status__ = 'Updated'

user = Module(__name__)

user.add_url_rule('/login/', view_func=Login.as_view('login'))
user.add_url_rule('/register/', view_func=Register.as_view('register'))
user.add_url_rule('/logout/', view_func=Logout.as_view('logout'))
user.add_url_rule('/members/', view_func=Members.as_view('members'))
user.add_url_rule('/administration/',
                  view_func=Administration.as_view('administration'))
user.add_url_rule('/edit/<username>', view_func=Edit.as_view('edit'))
Exemplo n.º 4
0
                '_id': _id
            }
        )

        return jsonify_status_code(
            code=200,
            data=data
        )

    @jsonp
    def post(self, _id):
        return jsonify_status_code(
            code=405,
            message='HTTP method POST is not allowed for this URL'
        )


CreateUnikernel_view = CreateUnikernel.as_view('create_unikernel')
api.add_url_rule(
    '/api/unikernel/create',
    view_func=CreateUnikernel_view,
    methods=['GET', 'POST']
)

DetailsUnikernel_view = DetailsUnikernel.as_view('details_unikernel')
api.add_url_rule(
    '/api/unikernel/<_id>',
    view_func=DetailsUnikernel_view,
    methods=['GET', 'POST']
)
Exemplo n.º 5
0
                    backend_instance.register(
                        content['config'],
                        content['unikernel']
                    )

                    Q.enqueue(
                        backend_instance.configure
                    )

                    Q.enqueue(
                        backend_instance.compile
                    )

                    Q.enqueue(
                        backend_instance.start
                    )

                    return jsonify_status_code(
                        code=200,
                        message='Unikernel execution started successfully',
                        _id=_id
                    )


CreateUnikernel_view = CreateUnikernel.as_view('create_unikernel')
api.add_url_rule(
    '/unikernel/create',
    view_func=CreateUnikernel_view,
    methods=['GET', 'POST']
)
Exemplo n.º 6
0
     along with this program. If not, see <http://www.gnu.org/licenses/>.
 Info
     Define url rule views.
'''

import sys

try:
    from flask import Module
    from app_server.views.base.home import Home
    from app_server.views.base.contact import Contact
    from app_server.views.base.about import About
except ImportError as error_message:
    MESSAGE = '\n{0}\n{1}\n'.format(__file__, error_message)
    sys.exit(MESSAGE)  # Force close python ATS ##############################

__author__ = 'Vladimir Roncevic'
__copyright__ = 'Copyright 2017, Free software to use and distributed it.'
__credits__ = ['Vladimir Roncevic']
__license__ = 'GNU General Public License (GPL)'
__version__ = '1.4.0'
__maintainer__ = 'Vladimir Roncevic'
__email__ = '*****@*****.**'
__status__ = 'Updated'

base = Module(__name__)

base.add_url_rule('/', view_func=Home.as_view('home'))
base.add_url_rule('/contact/', view_func=Contact.as_view('contact'))
base.add_url_rule('/about/', view_func=About.as_view('about'))