~didrocks/unity/altf10

« back to all changes in this revision

Viewing changes to grackle/store.py

  • Committer: Curtis Hovey
  • Date: 2012-03-17 22:45:15 UTC
  • Revision ID: curtis.hovey@canonical.com-20120317224515-r2n23tqc8cx7cul4
Only store the unique information needed by grackle.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
__metaclass__ = type
1
2
__all__ = [
 
3
    'make_json_message',
2
4
    'MemoryStore',
 
5
    'SUPPORTED_DISPLAY_TYPES',
 
6
    'SUPPORTED_ORDERS',
3
7
    ]
4
8
 
5
9
import email
7
11
from urlparse import parse_qs
8
12
 
9
13
from grackle.error import (
 
14
    ArchiveIdExists,
10
15
    ArchiveIdNotFound,
11
16
    MessageIdNotFound,
12
17
    UnparsableDateRange,
81
86
    def is_multipart(message):
82
87
        return isinstance(message['body'], list)
83
88
 
 
89
    def put_archive(self, archive_id, raw_archive=None):
 
90
        # XXX sinzui 2012-02-29: this needs to raise an error
 
91
        # if the th archive_id is invalid, or the raw archive is not mbox.
 
92
        if archive_id in self.message_archives:
 
93
            raise ArchiveIdExists()
 
94
        self.message_archives[archive_id] = []
 
95
 
84
96
    def put_message(self, archive_id, message_id, raw_message):
85
97
        # XXX sinzui 2012-02-29: this needs to raise an error
86
98
        # if the th archive_id is invalid, message_id is not base32