[damned-lies] Prevent shadowing State.name model field with class attribute
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Prevent shadowing State.name model field with class attribute
- Date: Sat, 25 Mar 2017 14:38:31 +0000 (UTC)
commit 7d1cd896c5c617f8fb6be058a9b698764e5d0661
Author: Claude Paroz <claude 2xlibre net>
Date: Sat Mar 25 15:33:43 2017 +0100
Prevent shadowing State.name model field with class attribute
vertimus/models.py | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/vertimus/models.py b/vertimus/models.py
index 071f870..397afc2 100644
--- a/vertimus/models.py
+++ b/vertimus/models.py
@@ -46,8 +46,8 @@ class State(models.Model):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
- if self.name == 'None' and getattr(self.__class__, 'name', 'None') != 'None':
- self.name = self.__class__.name
+ if self.name == 'None' and getattr(self.__class__, '_name', 'None') != 'None':
+ self.name = self.__class__._name
self.__class__ = {
'None' : StateNone,
'Translating' : StateTranslating,
@@ -75,7 +75,7 @@ class State(models.Model):
return None
def change_state(self, state_class, person=None):
- self.name = state_class.name
+ self.name = state_class._name
self.person = person
self.__class__ = state_class
self.save()
@@ -122,7 +122,7 @@ class State(models.Model):
class StateNone(State):
- name = 'None'
+ _name = 'None'
description = _('Inactive')
class Meta:
@@ -139,7 +139,7 @@ class StateNone(State):
class StateTranslating(State):
- name = 'Translating'
+ _name = 'Translating'
description = _('Translating')
class Meta:
@@ -155,7 +155,7 @@ class StateTranslating(State):
class StateTranslated(State):
- name = 'Translated'
+ _name = 'Translated'
description = _('Translated')
class Meta:
@@ -178,7 +178,7 @@ class StateTranslated(State):
class StateProofreading(State):
- name = 'Proofreading'
+ _name = 'Proofreading'
description = _('Proofreading')
class Meta:
@@ -195,7 +195,7 @@ class StateProofreading(State):
class StateProofread(State):
- name = 'Proofread'
+ _name = 'Proofread'
# Translators: This is a status, not a verb
description = _('Proofread')
@@ -217,7 +217,7 @@ class StateProofread(State):
class StateToReview(State):
- name = 'ToReview'
+ _name = 'ToReview'
description = _('To Review')
class Meta:
@@ -232,7 +232,7 @@ class StateToReview(State):
class StateToCommit(State):
- name = 'ToCommit'
+ _name = 'ToCommit'
description = _('To Commit')
class Meta:
@@ -250,7 +250,7 @@ class StateToCommit(State):
class StateCommitting(State):
- name = 'Committing'
+ _name = 'Committing'
description = _('Committing')
class Meta:
@@ -269,7 +269,7 @@ class StateCommitting(State):
class StateCommitted(State):
- name = 'Committed'
+ _name = 'Committed'
description = _('Committed')
class Meta:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]