summaryrefslogtreecommitdiff
path: root/Mailman/Pending.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* _load(), _save(): Now that we're saving instances in the pendingbwarsaw2002-03-141-10/+35
| | | | | | | | | | database, we need to use pickle instead of marshal. Pickle's more reliable and portable anyway. We can do auto-upgrade from marshal to pickle. If the .pck file isn't found, we'll read the .db file. But we always write the .pck file and if that's successful we can delete the .db file. We also do the standard "write a .tmp file and rotate with os.rename()" dance.
* Added RE_ENABLE key for thru-the-web re-enabling of disabledbwarsaw2001-12-271-0/+2
| | | | memberships.
* new(): Slight code cleanup; _ALLKEYS holds a list of 1-tuples of allbwarsaw2001-10-211-5/+5
| | | | | the valid Pending types. (They're 1-tuples so that the assert is more robust).
* confirm(): If we're purging this cookie, we should remove its entry inbwarsaw2001-08-161-0/+5
| | | | | | | | the evictions dictionary too. _save(): Go through and delete any evictions keys which don't appear in the pending dictionary (i.e. we're cleaning up after ourselves due to the above bug).
* Add a new confirmation type, for held messages.bwarsaw2001-07-301-0/+2
|
* confirm(): Add optional argument `expunge' defaulting to true. Thisbwarsaw2001-07-191-4/+10
| | | | | | is a flag specifying whether pending entries should be removed from the database or not, and will be used with the revamped confirmation web ui.
* Added another confirmable action: a change of address request.bwarsaw2001-05-311-2/+7
| | | | | | | | Specifically, CHANGE_OF_ADDRESS: new constant for this type of confirmable request. new(): Add CHANGE_OF_ADDRESS to the assert.
* Changes to the new pending.db file format:bwarsaw2001-04-021-7/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Entry eviction times are stored as a sub-dictionary under a separate key called `evictions'. This leaves the cookie data as whatever was given to the new() function. The keys of the eviction dictionary are the cookies and the values are the time at which the entry should be removed. - Another new key `version' for future backwards compatibility <wink>. - Each entry for the cookie should have a op key as its first element, which currently should be either Pending.SUBSCRIPTION or Pending.UNSUBSCRIPTION. new(): Make sure the `evictions' dictionary is present. confirm(): Don't strip off the last element of the tuple. _load(): If there's no pending.db file, return a dictionary containing an empty `evictions' sub-dictionary. _save(): Check the eviction times in the `evictions' sub-dictionary. Also, add the schema `version' entry. _update(): Fix the conversion from pending_subscriptions.db to pending.db file format so that SUBSCRIPTION entries include a default language. Also move the eviction times (which in the old format are the time the request was made) to the `evictions' sub-dictionary and add the PENDING_REQUEST_LIFE value.
* Rewritten and simplified. There's no need to make the logic livebwarsaw2001-03-261-107/+100
| | | | | | | | | | | | | | | | | | | | | inside a class; use the module as if a singleton instance. The pending database is now stored in data/pending.db. new(): Stores a new cookie in the pending.db with the key an sha hexdigest based on the current time, a random number and the content. The timestamp is now the point in the future at which this entry can be evicted. confirm(): Given a cookie, return the data (with the timestamp stripped off), or None if the cookie is missing from the database. _load(), _save(): Rewritten and simplified low-level marshal/unmarshal of the database. Assumes lock is acquired. _update(): For use by the bin/update script to convert from pending_subscription.db to pending.db (the old keys ought to be compatible).
* Update the copyright lines to include the years 1999 & 2000.bwarsaw2000-03-211-1/+1
|
* __assert_lock(): LockFile.AlreadyCalledLockedError =>bwarsaw1999-08-201-1/+1
| | | | LockFile.AlreadyLockedError
* flock => LockFile everywherebwarsaw1999-08-201-4/+4
|
* Redid pending.py to:klm1998-10-221-41/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Eliminate an unlocked window, where another process could also load the db, then save after the current process and stomp its changes. All transactions are now atomically locked. 2. Implement periodic culling of the db, to remove old entries. Otherwise (i assume) unclaimed entries would just accumulate forever. 3. Simplified the interface so you can only put in new entries and retrieve them. Cookie handling is implicit. All external functionality is now all in two methods of the 'Pending' class object. Details: 1. Atomicity: it used to be that the lock would only be set during the write phase. Now, the db load and save handling is not exposed - it is taken care of in the two exposed methods, which take care of the locking around the load/save sequence. Pending().new(stuff...) places an item's data in the db, returning its cookie. Pending().confirmed(cookie) returns a tuple for the data, removing the item from the db. It returns None if the cookie is not registered. 2. Periodically, on saves that occur longer than (module var) CULL_INTERVAL after the last save, the db is checked for stale items, and they're removed. Items are stale if they're older than the value of the new default config var, PENDING_REQUEST_LIFE. (The timestamp on the db is new, but old versions lacking it will just be culled on the first save, and have it added.) 3. Two methods provide all the functionality: Pending().new(stuff...) places an item in the db, returning a cookie for it. Pending().confirmed(cookie) returns the item, removing it from the db - or it returns None if the item is not found.
* set_pending(): wrap the code between the lock and the unlock in abwarsaw1998-07-221-4/+8
| | | | try/finally, with unlocking being done in the finally clause.
* Added GPL, removed VERIFY_FMTbwarsaw1998-06-191-20/+17
|
* Added support for flock.pyviega1998-06-131-9/+4
|
* MISC_DIR => DATA_DIRbwarsaw1998-05-291-1/+1
|
* Integrated Scott's confirmation stuff into mailcmd, and fixed a few thingsviega1998-05-291-2/+2
| | | | in pending...
* Added Scott's mm_pending.py file to the distribution.viega1998-05-291-0/+76