~sambuddhabasu1/mailman/fix_mailman_run_error

« back to all changes in this revision

Viewing changes to src/mailman/model/docs/requests.rst

  • Committer: Barry Warsaw
  • Date: 2014-11-01 16:49:15 UTC
  • mfrom: (7251.1.38 abhilash)
  • Revision ID: barry@list.org-20141101164915-06wqfmya6wf47n6n
Database
--------
 * The ORM layer, previously implemented with Storm, has been replaced by
   SQLAlchemy, thanks to the fantastic work by Abhilash Raj and Aurélien
   Bompard.  Alembic is now used for all database schema migrations.
 * The new logger `mailman.database` logs any errors at the database layer.

API
---
 * Several changes to the internal API:
   - `IListManager.mailing_lists` is guaranteed to be sorted in List-ID order.
   - `IDomains.mailing_lists` is guaranteed to be sorted in List-ID order.
   - Iteration over domains via the `IDomainManager` is guaranteed to be sorted
     by `IDomain.mail_host` order.
   - `ITemporaryDatabase` interface and all implementations are removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
The list's requests database starts out empty.
37
37
 
38
 
    >>> requests.count
 
38
    >>> print(requests.count)
39
39
    0
40
40
    >>> dump_list(requests.held_requests)
41
41
    *Empty*
68
68
 
69
69
We can see the total number of requests being held.
70
70
 
71
 
    >>> requests.count
 
71
    >>> print(requests.count)
72
72
    3
73
73
 
74
74
We can also see the number of requests being held by request type.
75
75
 
76
 
    >>> requests.count_of(RequestType.subscription)
 
76
    >>> print(requests.count_of(RequestType.subscription))
77
77
    1
78
 
    >>> requests.count_of(RequestType.unsubscription)
 
78
    >>> print(requests.count_of(RequestType.unsubscription))
79
79
    1
80
80
 
81
81
We can also see when there are multiple held requests of a particular type.
82
82
 
83
 
    >>> requests.hold_request(RequestType.held_message, 'hold_4')
 
83
    >>> print(requests.hold_request(RequestType.held_message, 'hold_4'))
84
84
    4
85
 
    >>> requests.count_of(RequestType.held_message)
 
85
    >>> print(requests.count_of(RequestType.held_message))
86
86
    2
87
87
 
88
88
We can ask the requests database for a specific request, by providing the id
132
132
To make it easier to find specific requests, the list requests can be iterated
133
133
over by type.
134
134
 
135
 
    >>> requests.count_of(RequestType.held_message)
 
135
    >>> print(requests.count_of(RequestType.held_message))
136
136
    3
137
137
    >>> for request in requests.of_type(RequestType.held_message):
138
138
    ...     key, data = requests.get_request(request.id)
154
154
Once a specific request has been handled, it can be deleted from the requests
155
155
database.
156
156
 
157
 
    >>> requests.count
 
157
    >>> print(requests.count)
158
158
    5
159
159
    >>> requests.delete_request(2)
160
 
    >>> requests.count
 
160
    >>> print(requests.count)
161
161
    4
162
162
 
163
163
Request 2 is no longer in the database.
167
167
 
168
168
    >>> for request in requests.held_requests:
169
169
    ...     requests.delete_request(request.id)
170
 
    >>> requests.count
 
170
    >>> print(requests.count)
171
171
    0