sobjects/supervising.py
changeset 6582 8eb7883b4223
parent 6142 8bc6eac1fac1
child 8190 2a3c1b787688
equal deleted inserted replaced
6581:4a3b264589dc 6582:8eb7883b4223
    16 # You should have received a copy of the GNU Lesser General Public License along
    16 # You should have received a copy of the GNU Lesser General Public License along
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 """some hooks and views to handle supervising of any data changes"""
    18 """some hooks and views to handle supervising of any data changes"""
    19 
    19 
    20 __docformat__ = "restructuredtext en"
    20 __docformat__ = "restructuredtext en"
       
    21 _ = unicode
    21 
    22 
    22 from cubicweb import UnknownEid
    23 from cubicweb import UnknownEid
    23 from cubicweb.selectors import none_rset
    24 from cubicweb.selectors import none_rset
    24 from cubicweb.schema import display_name
    25 from cubicweb.schema import display_name
    25 from cubicweb.view import Component
    26 from cubicweb.view import Component
   131         msg = self._cw._('deleted %(etype)s #%(eid)s (%(title)s)')
   132         msg = self._cw._('deleted %(etype)s #%(eid)s (%(title)s)')
   132         etype = display_name(self._cw, etype).lower()
   133         etype = display_name(self._cw, etype).lower()
   133         self.w(msg % locals())
   134         self.w(msg % locals())
   134 
   135 
   135     def change_state(self, (entity, fromstate, tostate)):
   136     def change_state(self, (entity, fromstate, tostate)):
   136         msg = self._cw._('changed state of %(etype)s #%(eid)s (%(title)s)')
   137         _ = self._cw._
       
   138         msg = _('changed state of %(etype)s #%(eid)s (%(title)s)')
   137         self.w(u'%s\n' % (msg % self._entity_context(entity)))
   139         self.w(u'%s\n' % (msg % self._entity_context(entity)))
   138         self.w(_('  from state %(fromstate)s to state %(tostate)s\n' %
   140         self.w(_('  from state %(fromstate)s to state %(tostate)s\n' %
   139                  {'fromstate': _(fromstate.name), 'tostate': _(tostate.name)}))
   141                  {'fromstate': _(fromstate.name), 'tostate': _(tostate.name)}))
   140         self.w(u'  %s' % entity.absolute_url())
   142         self.w(u'  %s' % entity.absolute_url())
   141 
   143