Predicate.py 3.76 KB
Newer Older
Jean-Paul Smets's avatar
Jean-Paul Smets committed
1 2 3
##############################################################################
#
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
Jean-Paul Smets's avatar
Jean-Paul Smets committed
4
#                    Jean-Paul Smets-Solanes <jp@nexedi.com>
Jean-Paul Smets's avatar
Jean-Paul Smets committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
##############################################################################


class Predicate:
    """
        Predicate properties and categories
Jean-Paul Smets's avatar
Jean-Paul Smets committed
33 34 35 36 37 38
        
        Predicate in ERP5 use a simplified form based on identity, range and
        set and range operations
        
        Other predicates must be implemented through scripts. Parameters
        can be provides to scripts (this reduces duplication of code)
Jean-Paul Smets's avatar
Jean-Paul Smets committed
39 40
    """

41
    _properties = (
Jean-Paul Smets's avatar
Jean-Paul Smets committed
42
        {   'id'          : 'criterion_property',
Jean-Paul Smets's avatar
Jean-Paul Smets committed
43
            'description' : 'The properties to test identity or range on',
Jean-Paul Smets's avatar
Jean-Paul Smets committed
44 45 46
            'type'        : 'tokens',
            'default'     : (),
            'mode'        : 'w' },
Sebastien Robin's avatar
Sebastien Robin committed
47 48
        {   'id'          : 'membership_criterion_base_category', # OR, we check if we have one
                                                                  # of theses categories
Jean-Paul Smets's avatar
Jean-Paul Smets committed
49 50 51 52
            'description' : 'The base categories to test',
            'type'        : 'tokens',
            'default'     : (),
            'mode'        : 'w' },
Sebastien Robin's avatar
Sebastien Robin committed
53 54
        {   'id'          : 'multimembership_criterion_base_category', # AND, we check we have all 
                                                                       # theses categories
Jean-Paul Smets's avatar
Jean-Paul Smets committed
55 56 57 58 59 60 61 62
            'description' : 'The base categories which allow multiple values and required AND test',
            'type'        : 'tokens',
            'default'     : (),
            'mode'        : 'w' },
        {   'id'          : 'membership_criterion_category',
            'description' : 'The predicate categories',
            'type'        : 'lines',
            'default'     : (),
63
            'mode'        : 'w' },
64 65 66 67 68 69 70
        {   'id'          : 'test_tales_expression',
            'description' : 'A Tales expression to implement a simple ' \
                            'condition in Python. Runtime context of this ' \
                            'expression will be the tested document',
            'type'        : 'string',
            'default'     : 'python: True',
            'mode'        : 'w' },
Jean-Paul Smets's avatar
Jean-Paul Smets committed
71 72
        {   'id'          : 'test_method_id',
            'description' : 'A python method to implement additional tests',
73
            'type'        : 'lines', # Only a list of method ids is feasable for lines
74
            'mode'        : 'w' },
75 76 77 78
        #{   'id'          : 'parameter_string', # XXX Not feasable for AND
        #    'description' : 'A string defining default values for parameters (python syntax)',
        #    'type'        : 'string',
        #    'mode'        : 'w' },                
Jean-Paul Smets's avatar
Jean-Paul Smets committed
79 80 81
        )