damned-lies r1375 - in trunk: . vertimus vertimus/tests
- From: stephaner svn gnome org
- To: svn-commits-list gnome org
- Subject: damned-lies r1375 - in trunk: . vertimus vertimus/tests
- Date: Tue, 20 Jan 2009 21:46:11 +0000 (UTC)
Author: stephaner
Date: Tue Jan 20 21:46:11 2009
New Revision: 1375
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1375&view=rev
Log:
2009-01-20 StÃphane Raimbault <stephane raimbault gmail com>
* vertimus/models.py:
* vertimus/tests/__init__.py: Add 'Inform of submission' for all
committers (and coordinators). Fixes bug #567394 but some cases
aren't perfect so we intend to provide a better version later.
Modified:
trunk/ChangeLog
trunk/vertimus/models.py
trunk/vertimus/tests/__init__.py
Modified: trunk/vertimus/models.py
==============================================================================
--- trunk/vertimus/models.py (original)
+++ trunk/vertimus/models.py Tue Jan 20 21:46:11 2009
@@ -100,8 +100,10 @@
def __unicode__(self):
return unicode(self.description)
- def _get_available_actions(self, action_names):
+ def _get_available_actions(self, person, action_names):
action_names.append('WC')
+ if person.is_committer(self.language.team) and 'IC' not in action_names:
+ action_names.append('IC')
return [eval('Action' + action_name)() for action_name in action_names]
def apply_action(self, action, person, comment=None, file=None):
@@ -141,7 +143,7 @@
if person.is_translator(self.language.team):
action_names = ['RT']
- return self._get_available_actions(action_names)
+ return self._get_available_actions(person, action_names)
class StateTranslating(StateAbstract):
@@ -154,7 +156,7 @@
if (self.person == person):
action_names = ['UT', 'UNDO']
- return self._get_available_actions(action_names)
+ return self._get_available_actions(person, action_names)
class StateTranslated(StateAbstract):
@@ -171,7 +173,7 @@
action_names.append('RT')
action_names.append('TR')
- return self._get_available_actions(action_names)
+ return self._get_available_actions(person, action_names)
class StateProofreading(StateAbstract):
@@ -185,7 +187,7 @@
if (self.person == person):
action_names = ['UP', 'TR', 'TC', 'UNDO']
- return self._get_available_actions(action_names)
+ return self._get_available_actions(person, action_names)
class StateProofread(StateAbstract):
@@ -198,7 +200,7 @@
else:
action_names = []
- return self._get_available_actions(action_names)
+ return self._get_available_actions(person, action_names)
class StateToReview(StateAbstract):
@@ -210,7 +212,7 @@
if person.is_translator(self.language.team):
action_names.append('RT')
- return self._get_available_actions(action_names)
+ return self._get_available_actions(person, action_names)
class StateToCommit(StateAbstract):
@@ -223,7 +225,7 @@
else:
action_names = []
- return self._get_available_actions(action_names)
+ return self._get_available_actions(person, action_names)
class StateCommitting(StateAbstract):
@@ -237,7 +239,7 @@
if (self.person == person):
action_names = ['IC', 'TR', 'UNDO']
- return self._get_available_actions(action_names)
+ return self._get_available_actions(person, action_names)
class StateCommitted(StateAbstract):
@@ -250,7 +252,7 @@
else:
action_names = []
- return self._get_available_actions(action_names)
+ return self._get_available_actions(person, action_names)
#
# Actions
Modified: trunk/vertimus/tests/__init__.py
==============================================================================
--- trunk/vertimus/tests/__init__.py (original)
+++ trunk/vertimus/tests/__init__.py Tue Jan 20 21:46:11 2009
@@ -125,9 +125,13 @@
action_names = [a.name for a in state.get_available_actions(self.pn)]
self.assertEqual(action_names, ['WC'])
- for p in (self.pt, self.pr, self.pc, self.pcoo):
+ for p in (self.pt, self.pr):
action_names = [a.name for a in state.get_available_actions(p)]
self.assertEqual(action_names, ['RT', 'WC'])
+
+ for p in (self.pc, self.pcoo):
+ action_names = [a.name for a in state.get_available_actions(p)]
+ self.assertEqual(action_names, ['RT', 'WC', 'IC'])
def test_state_translating(self):
sdb = StateDb(branch=self.b, domain=self.d, language=self.l, person=self.pt)
@@ -135,10 +139,14 @@
state = sdb.get_state()
self.assert_(isinstance(state, StateTranslating))
- for p in (self.pn, self.pr, self.pc, self.pcoo):
+ for p in (self.pn, self.pr):
action_names = [a.name for a in state.get_available_actions(p)]
self.assertEqual(action_names, ['WC'])
-
+
+ for p in (self.pc, self.pcoo):
+ action_names = [a.name for a in state.get_available_actions(p)]
+ self.assertEqual(action_names, ['WC', 'IC'])
+
# Same person
action_names = [a.name for a in state.get_available_actions(self.pt)]
self.assertEqual(action_names, ['UT', 'UNDO', 'WC'])
@@ -155,9 +163,12 @@
action_names = [a.name for a in state.get_available_actions(self.pt)]
self.assertEqual(action_names, ['RT', 'TR', 'WC'])
- for p in (self.pr, self.pc, self.pcoo):
+ action_names = [a.name for a in state.get_available_actions(self.pr)]
+ self.assertEqual(action_names, ['RP', 'RT', 'TR', 'WC'])
+
+ for p in (self.pc, self.pcoo):
action_names = [a.name for a in state.get_available_actions(p)]
- self.assertEqual(action_names, ['RP', 'RT', 'TR', 'WC'])
+ self.assertEqual(action_names, ['RP', 'RT', 'TR', 'WC', 'IC'])
def test_state_proofreading(self):
sdb = StateDb(branch=self.b, domain=self.d, language=self.l, person=self.pr)
@@ -165,10 +176,14 @@
state = sdb.get_state()
self.assert_(isinstance(state, StateProofreading))
- for p in (self.pn, self.pt, self.pc, self.pcoo):
+ for p in (self.pn, self.pt):
action_names = [a.name for a in state.get_available_actions(p)]
self.assertEqual(action_names, ['WC'])
+ for p in (self.pc, self.pcoo):
+ action_names = [a.name for a in state.get_available_actions(p)]
+ self.assertEqual(action_names, ['WC', 'IC'])
+
# Same person and reviewer
action_names = [a.name for a in state.get_available_actions(self.pr)]
self.assertEqual(action_names, ['UP', 'TR', 'TC', 'UNDO', 'WC'])
@@ -183,9 +198,12 @@
action_names = [a.name for a in state.get_available_actions(p)]
self.assertEqual(action_names, ['WC'])
- for p in (self.pr, self.pc, self.pcoo):
+ action_names = [a.name for a in state.get_available_actions(self.pr)]
+ self.assertEqual(action_names, ['TC', 'RP', 'TR', 'WC'])
+
+ for p in (self.pc, self.pcoo):
action_names = [a.name for a in state.get_available_actions(p)]
- self.assertEqual(action_names, ['TC', 'RP', 'TR', 'WC'])
+ self.assertEqual(action_names, ['TC', 'RP', 'TR', 'WC', 'IC'])
def test_state_to_review(self):
sdb = StateDb(branch=self.b, domain=self.d, language=self.l, person=self.pt)
@@ -196,10 +214,14 @@
action_names = [a.name for a in state.get_available_actions(self.pn)]
self.assertEqual(action_names, ['WC'])
- for p in (self.pt, self.pr, self.pc, self.pcoo):
+ for p in (self.pt, self.pr):
action_names = [a.name for a in state.get_available_actions(p)]
self.assertEqual(action_names, ['RT', 'WC'])
+ for p in (self.pc, self.pcoo):
+ action_names = [a.name for a in state.get_available_actions(p)]
+ self.assertEqual(action_names, ['RT', 'WC', 'IC'])
+
def test_state_to_commit(self):
sdb = StateDb(branch=self.b, domain=self.d, language=self.l, person=self.pr)
sdb.name = 'ToCommit'
@@ -212,7 +234,7 @@
for p in (self.pc, self.pcoo):
action_names = [a.name for a in state.get_available_actions(p)]
- self.assertEqual(action_names, ['RC', 'TR', 'WC'])
+ self.assertEqual(action_names, ['RC', 'TR', 'WC', 'IC'])
def test_state_committing(self):
sdb = StateDb(branch=self.b, domain=self.d, language=self.l, person=self.pc)
@@ -220,10 +242,13 @@
state = sdb.get_state()
self.assert_(isinstance(state, StateCommitting))
- for p in (self.pn, self.pt, self.pr, self.pcoo):
+ for p in (self.pn, self.pt, self.pr):
action_names = [a.name for a in state.get_available_actions(p)]
self.assertEqual(action_names, ['WC'])
+ action_names = [a.name for a in state.get_available_actions(self.pcoo)]
+ self.assertEqual(action_names, ['WC', 'IC'])
+
action_names = [a.name for a in state.get_available_actions(self.pc)]
self.assertEqual(action_names, ['IC', 'TR', 'UNDO', 'WC'])
@@ -239,7 +264,7 @@
for p in (self.pc, self.pcoo):
action_names = [a.name for a in state.get_available_actions(p)]
- self.assertEqual(action_names, ['BA', 'WC'])
+ self.assertEqual(action_names, ['BA', 'WC', 'IC'])
def test_action_wc(self):
state = StateDb(branch=self.b, domain=self.d, language=self.l, name='None').get_state()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]