Source code for isomer.events.objectmanager

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

# Isomer - The distributed application framework
# ==============================================
# Copyright (C) 2011-2020 Heiko 'riot' Weinen <riot@c-base.org> and others.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

"""


Module: Events
==============

Major Isomer event declarations


"""

from circuits.core import Event

from isomer.logger import isolog, events

# from isomer.ui.clientobjects import User
from isomer.events.system import authorized_event


# Object Management


[docs]class objectevent(Event): """A unspecified objectevent"""
[docs] def __init__(self, uuid, schema, client, *args, **kwargs): super(objectevent, self).__init__(*args, **kwargs) self.uuid = uuid self.schema = schema self.client = client isolog( "Object event created: ", self.__doc__, self.__dict__, lvl=events, emitter="OBJECT-EVENT", )
[docs]class objectchange(objectevent): """A stored object has been successfully modified"""
[docs]class objectcreation(objectevent): """A new object has been successfully created"""
[docs]class objectdeletion(objectevent): """A stored object has been successfully deleted"""
# Backend-side object change
[docs]class updatesubscriptions(Event): """A backend component needs to write changes to an object. Clients that are subscribed should be notified etc. """
[docs] def __init__(self, schema, data, *args, **kwargs): super(updatesubscriptions, self).__init__(*args, **kwargs) self.schema = schema self.data = data isolog( "Object event created: ", self.__doc__, self.__dict__, lvl=events, emitter="OBJECT-EVENT", )
[docs]class getlist(authorized_event): """A client requires a schema to validate data or display a form"""
[docs]class get(authorized_event): """A client requires a schema to validate data or display a form"""
[docs]class put(authorized_event): """A client requires a schema to validate data or display a form"""
[docs]class change(authorized_event): """A client requires a schema to validate data or display a form"""
[docs]class delete(authorized_event): """A client requires a schema to validate data or display a form"""
[docs]class subscribe(authorized_event): """A client requires a schema to validate data or display a form"""
[docs]class unsubscribe(authorized_event): """A client requires a schema to validate data or display a form"""
[docs]class remove_role(authorized_event): pass
[docs]class add_role(authorized_event): pass