summaryrefslogtreecommitdiff
path: root/service/pixelated/adapter/status.py
diff options
context:
space:
mode:
authorBruno Wagner <bwagner@thoughtworks.com>2014-10-15 15:55:53 +0200
committerBruno Wagner <bwagner@thoughtworks.com>2014-10-15 15:58:06 +0200
commitd4d0e86b25dc9c478c04d30cb6a86824332c2c7f (patch)
tree1bb49e6b71267026b4b4f55903a537dc69f057e5 /service/pixelated/adapter/status.py
parentfca5dc46de7d3cfb0d4c571f9e3040ad05e2cc54 (diff)
#107 Statuses are only used when delivering mails to the front-end, flags are used elsewhere
Diffstat (limited to 'service/pixelated/adapter/status.py')
-rw-r--r--service/pixelated/adapter/status.py50
1 files changed, 18 insertions, 32 deletions
diff --git a/service/pixelated/adapter/status.py b/service/pixelated/adapter/status.py
index 3807359c..5a11ee7b 100644
--- a/service/pixelated/adapter/status.py
+++ b/service/pixelated/adapter/status.py
@@ -17,40 +17,26 @@
class Status:
- class PixelatedStatus:
- SEEN = u'\\Seen'
- ANSWERED = u'\\Answered'
- DELETED = u'\\Deleted'
- RECENT = u'\\Recent'
-
- LEAP_FLAGS_STATUSES = {
- PixelatedStatus.SEEN: 'read',
- PixelatedStatus.ANSWERED: 'replied',
- PixelatedStatus.RECENT: 'recent'
+ SEEN = u'\\Seen'
+ ANSWERED = u'\\Answered'
+ DELETED = u'\\Deleted'
+ RECENT = u'\\Recent'
+
+ FLAGS_TO_STATUSES = {
+ SEEN: 'read',
+ ANSWERED: 'replied',
+ RECENT: 'recent'
}
- @classmethod
- def from_flag(cls, flag):
- return Status(cls.LEAP_FLAGS_STATUSES[flag])
+ @staticmethod
+ def from_flag(flag):
+ return Status.FLAGS_TO_STATUSES[flag]
- @classmethod
- def from_flags(cls, flags):
- return set(cls.from_flag(flag) for flag in flags if flag in cls.LEAP_FLAGS_STATUSES.keys())
+ @staticmethod
+ def from_flags(flags):
+ return set(Status.from_flag(flag) for flag in flags if flag in Status.FLAGS_TO_STATUSES.keys())
- @classmethod
- def to_flags(cls, statuses):
- statuses_to_flags = dict(zip(cls.LEAP_FLAGS_STATUSES.values(), cls.LEAP_FLAGS_STATUSES.keys()))
+ @staticmethod
+ def to_flags(statuses):
+ statuses_to_flags = dict(zip(Status.FLAGS_TO_STATUSES.values(), Status.FLAGS_TO_STATUSES.keys()))
return [statuses_to_flags[status] for status in statuses]
-
- def __init__(self, name):
- self.name = name
- self.ident = name.__hash__()
-
- def __eq__(self, other):
- return self.name == other.name
-
- def __hash__(self):
- return self.name.__hash__()
-
- def __repr__(self):
- return self.name