Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

vigiboard / vigiboard / controllers / plugins / __init__.py @ 3b537383

History | View | Annotate | Download (2.47 KB)

1
# -*- coding: utf-8 -*-
2
# vim:set expandtab tabstop=4 shiftwidth=4:
3
################################################################################
4
#
5
# Copyright (C) 2007-2011 CS-SI
6
#
7
# This program is free software; you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License version 2 as
9
# published by the Free Software Foundation.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
################################################################################
20

    
21
"""
22
Module complémentaire générique.
23
"""
24

    
25
from pylons.i18n import ugettext as _
26

    
27
class VigiboardRequestPlugin(object):
28
    """
29
    Classe que les plugins de VigiBoard doivent étendre.
30
    """
31

    
32
    def __init__ (self, table = None, join = None, outerjoin = None,
33
            filters = None, groupby = None, orderby = None, name = '',
34
            style = None, object_name = ""):
35
        self.table = table
36
        self.join = join
37
        self.outerjoin = outerjoin
38
        self.filter = filters
39
        self.orderby = orderby
40
        self.name = name
41
        self.groupby = groupby
42
        self.style = style
43
        self.object_name = object_name
44

    
45
    def get_value(self, idcorrevent, *args, **kwargs):
46
        """
47
        Cette méthode est appelée lorsque l'on demande la valeur du plugin
48
        grâce à la méthode get_plugin_value du L{RootController} de VigiBoard.
49

50
        Cette méthode DEVRAIT être surchargée dans les classes dérivées.
51

52
        @param idcorrevent: Identifiant du C{CorrEvent} à interroger.
53
        @type idcorrevent: C{int}
54
        @return: Dictionnaire contenant la ou les valeur(s) correspondantes.
55
        @rtype: C{dict}
56
        """
57
        pass
58

    
59
    def get_generated_columns_count(self):
60
        """
61
        Cette méthode renvoie le nombre de colonnes ajoutées dans le tableau
62
        des événements par ce plugin. Par défaut, on suppose que chaque plugin
63
        n'ajoute qu'une seule colonne au tableau.
64

65
        Cette méthode PEUT être surchargée dans les classes dérivées.
66

67
        @return: Nombre de colonnes ajoutées par ce plugin.
68
        @rtype: C{int}
69
        """
70
        return 1