
* Pour une plus grande modularité, event a été refactorisé, ce qui a impliqué de réécrire le fonctionnement des services. * Maintenant, y a plus qu'à tester.
38 lines
975 B
Python
38 lines
975 B
Python
#!/bin/bash /usr/scripts/python.sh
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
This module provides a basic service class to other services. It should *NOT*
|
|
be referenced in configuration of trigger.
|
|
"""
|
|
|
|
class BasicService(object):
|
|
"""Basic service handler. Other services should inherit fron this one.
|
|
|
|
"""
|
|
|
|
changes_trigger = {}
|
|
|
|
@classmethod
|
|
def get_changes(cls, body, diff):
|
|
"""Looks for changes and creates messages to send back
|
|
|
|
"""
|
|
# list of all messages to send.
|
|
msg_list = []
|
|
|
|
# lists all functions to call
|
|
func_list = set()
|
|
for (attrib, functions) in cls.changes_trigger.iteritems():
|
|
if attrib in diff:
|
|
func_list.update(functions)
|
|
for function in func_list:
|
|
msg_list.append(function(body, diff))
|
|
return msg_list
|
|
|
|
@classmethod
|
|
def regen(cls, body):
|
|
"""This method is referenced to avoid uncaught exceptions
|
|
|
|
"""
|
|
pass
|