transaction.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 03 Feb 2016 14:23:17 +0100
changeset 11091 29aebc1edd29
parent 10666 7f6b5f023884
permissions -rw-r--r--
[repository] drop usage of no more necessary eschema_eid function since the previous cset, we are guaranteed that repository's entity schema will have their eid attribute properly set, so we don't have anymore to check everytime if some entity schema's .eid attributes is set or not (and retrieve it if not). Related to #10450092
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10235
684215aca046 Remove remote repository-access-through-pyro support
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9052
diff changeset
     1
# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
5421
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4913
diff changeset
     2
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4913
diff changeset
     3
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4913
diff changeset
     4
# This file is part of CubicWeb.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4913
diff changeset
     5
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4913
diff changeset
     6
# CubicWeb is free software: you can redistribute it and/or modify it under the
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4913
diff changeset
     7
# terms of the GNU Lesser General Public License as published by the Free
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4913
diff changeset
     8
# Software Foundation, either version 2.1 of the License, or (at your option)
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4913
diff changeset
     9
# any later version.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4913
diff changeset
    10
#
5424
8ecbcbff9777 replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5421
diff changeset
    11
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
5421
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4913
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4913
diff changeset
    13
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4913
diff changeset
    14
# details.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4913
diff changeset
    15
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4913
diff changeset
    16
# You should have received a copy of the GNU Lesser General Public License along
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4913
diff changeset
    17
# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
10235
684215aca046 Remove remote repository-access-through-pyro support
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 9052
diff changeset
    18
""" undoable transaction objects. """
4913
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    19
__docformat__ = "restructuredtext en"
10666
7f6b5f023884 [py3k] replace '_ = unicode' in global scope (closes #7589459)
Rémi Cardona <remi.cardona@logilab.fr>
parents: 10360
diff changeset
    20
from cubicweb import _
4913
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    21
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    22
from cubicweb import RepositoryError
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    23
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    24
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    25
ACTION_LABELS = {
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    26
    'C': _('entity creation'),
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    27
    'U': _('entity update'),
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    28
    'D': _('entity deletion'),
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    29
    'A': _('relation add'),
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    30
    'R': _('relation removal'),
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    31
    }
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    32
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    33
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    34
class NoSuchTransaction(RepositoryError):
8265
9747ab9230ad [repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents: 5426
diff changeset
    35
    # Used by CubicWebException
9747ab9230ad [repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents: 5426
diff changeset
    36
    msg = _("there is no transaction #%s")
4913
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    37
8265
9747ab9230ad [repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents: 5426
diff changeset
    38
    def __init__(self, txuuid):
10360
1fdbe2ea63d8 [transactions] cleanup after the dbapi removal
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 10235
diff changeset
    39
        super(NoSuchTransaction, self).__init__(txuuid)
8265
9747ab9230ad [repo, undo] Finish repository-side implementation of the undo feature (closes #893940)
Anthony Truchet <anthony.truchet@logilab.fr>
parents: 5426
diff changeset
    40
        self.txuuid = txuuid
4913
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    41
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    42
class Transaction(object):
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    43
    """an undoable transaction"""
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    44
10360
1fdbe2ea63d8 [transactions] cleanup after the dbapi removal
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 10235
diff changeset
    45
    def __init__(self, cnx, uuid, time, ueid):
1fdbe2ea63d8 [transactions] cleanup after the dbapi removal
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 10235
diff changeset
    46
        self.cnx = cnx
4913
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    47
        self.uuid = uuid
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    48
        self.datetime = time
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    49
        self.user_eid = ueid
9052
4cba5f2cd57b [repoapi] introduce a basic ClientConnection class
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 8266
diff changeset
    50
4cba5f2cd57b [repoapi] introduce a basic ClientConnection class
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 8266
diff changeset
    51
    def _execute(self, *args, **kwargs):
4cba5f2cd57b [repoapi] introduce a basic ClientConnection class
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 8266
diff changeset
    52
        """execute a query using either the req or the cnx"""
10360
1fdbe2ea63d8 [transactions] cleanup after the dbapi removal
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 10235
diff changeset
    53
        return self.cnx.execute(*args, **kwargs)
9052
4cba5f2cd57b [repoapi] introduce a basic ClientConnection class
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 8266
diff changeset
    54
4913
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    55
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    56
    def __repr__(self):
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    57
        return '<Transaction %s by %s on %s>' % (
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    58
            self.uuid, self.user_eid, self.datetime)
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    59
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    60
    def user(self):
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    61
        """return the user entity which has done the transaction,
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    62
        none if not found.
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    63
        """
10360
1fdbe2ea63d8 [transactions] cleanup after the dbapi removal
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 10235
diff changeset
    64
        return self.cnx.find('CWUser', eid=self.user_eid).one()
4913
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    65
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    66
    def actions_list(self, public=True):
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    67
        """return an ordered list of action effectued during that transaction
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    68
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    69
        if public is true, return only 'public' action, eg not ones triggered
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    70
        under the cover by hooks.
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    71
        """
10360
1fdbe2ea63d8 [transactions] cleanup after the dbapi removal
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 10235
diff changeset
    72
        return self.cnx.transaction_actions(self.uuid, public)
4913
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    73
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    74
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    75
class AbstractAction(object):
10360
1fdbe2ea63d8 [transactions] cleanup after the dbapi removal
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 10235
diff changeset
    76
4913
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    77
    def __init__(self, action, public, order):
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    78
        self.action = action
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    79
        self.public = public
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    80
        self.order = order
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    81
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    82
    @property
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    83
    def label(self):
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    84
        return ACTION_LABELS[self.action]
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    85
8266
704dda5c07f7 [undo, transactions] Adds a property in the transaction API. (closes #2202953)
Anthony Truchet <anthony.truchet@logilab.fr>
parents: 8265
diff changeset
    86
    @property
704dda5c07f7 [undo, transactions] Adds a property in the transaction API. (closes #2202953)
Anthony Truchet <anthony.truchet@logilab.fr>
parents: 8265
diff changeset
    87
    def ertype(self):
704dda5c07f7 [undo, transactions] Adds a property in the transaction API. (closes #2202953)
Anthony Truchet <anthony.truchet@logilab.fr>
parents: 8265
diff changeset
    88
        """ Return the entity or relation type this action is related to"""
704dda5c07f7 [undo, transactions] Adds a property in the transaction API. (closes #2202953)
Anthony Truchet <anthony.truchet@logilab.fr>
parents: 8265
diff changeset
    89
        raise NotImplementedError(self)
704dda5c07f7 [undo, transactions] Adds a property in the transaction API. (closes #2202953)
Anthony Truchet <anthony.truchet@logilab.fr>
parents: 8265
diff changeset
    90
4913
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    91
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    92
class EntityAction(AbstractAction):
10360
1fdbe2ea63d8 [transactions] cleanup after the dbapi removal
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 10235
diff changeset
    93
4913
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    94
    def __init__(self, action, public, order, etype, eid, changes):
10360
1fdbe2ea63d8 [transactions] cleanup after the dbapi removal
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 10235
diff changeset
    95
        super(EntityAction, self).__init__(action, public, order)
4913
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    96
        self.etype = etype
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    97
        self.eid = eid
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    98
        self.changes = changes
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
    99
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
   100
    def __repr__(self):
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
   101
        return '<%s: %s %s (%s)>' % (
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
   102
            self.label, self.eid, self.changes,
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
   103
            self.public and 'dbapi' or 'hook')
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
   104
8266
704dda5c07f7 [undo, transactions] Adds a property in the transaction API. (closes #2202953)
Anthony Truchet <anthony.truchet@logilab.fr>
parents: 8265
diff changeset
   105
    @property
704dda5c07f7 [undo, transactions] Adds a property in the transaction API. (closes #2202953)
Anthony Truchet <anthony.truchet@logilab.fr>
parents: 8265
diff changeset
   106
    def ertype(self):
704dda5c07f7 [undo, transactions] Adds a property in the transaction API. (closes #2202953)
Anthony Truchet <anthony.truchet@logilab.fr>
parents: 8265
diff changeset
   107
        """ Return the entity or relation type this action is related to"""
704dda5c07f7 [undo, transactions] Adds a property in the transaction API. (closes #2202953)
Anthony Truchet <anthony.truchet@logilab.fr>
parents: 8265
diff changeset
   108
        return self.etype
704dda5c07f7 [undo, transactions] Adds a property in the transaction API. (closes #2202953)
Anthony Truchet <anthony.truchet@logilab.fr>
parents: 8265
diff changeset
   109
4913
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
   110
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
   111
class RelationAction(AbstractAction):
10360
1fdbe2ea63d8 [transactions] cleanup after the dbapi removal
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 10235
diff changeset
   112
4913
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
   113
    def __init__(self, action, public, order, rtype, eidfrom, eidto):
10360
1fdbe2ea63d8 [transactions] cleanup after the dbapi removal
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 10235
diff changeset
   114
        super(RelationAction, self).__init__(action, public, order)
4913
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
   115
        self.rtype = rtype
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
   116
        self.eid_from = eidfrom
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
   117
        self.eid_to = eidto
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
   118
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
   119
    def __repr__(self):
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
   120
        return '<%s: %s %s %s (%s)>' % (
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
   121
            self.label, self.eid_from, self.rtype, self.eid_to,
083b4d454192 server/web api for accessing to deleted_entites
Katia Saurfelt <katia.saurfelt@logilab.fr>
parents:
diff changeset
   122
            self.public and 'dbapi' or 'hook')
8266
704dda5c07f7 [undo, transactions] Adds a property in the transaction API. (closes #2202953)
Anthony Truchet <anthony.truchet@logilab.fr>
parents: 8265
diff changeset
   123
704dda5c07f7 [undo, transactions] Adds a property in the transaction API. (closes #2202953)
Anthony Truchet <anthony.truchet@logilab.fr>
parents: 8265
diff changeset
   124
    @property
704dda5c07f7 [undo, transactions] Adds a property in the transaction API. (closes #2202953)
Anthony Truchet <anthony.truchet@logilab.fr>
parents: 8265
diff changeset
   125
    def ertype(self):
704dda5c07f7 [undo, transactions] Adds a property in the transaction API. (closes #2202953)
Anthony Truchet <anthony.truchet@logilab.fr>
parents: 8265
diff changeset
   126
        """ Return the entity or relation type this action is related to"""
704dda5c07f7 [undo, transactions] Adds a property in the transaction API. (closes #2202953)
Anthony Truchet <anthony.truchet@logilab.fr>
parents: 8265
diff changeset
   127
        return self.rtype