| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| |
|
|
|
|
|
|
|
|
|
|
|
| |
necessary to deal with the simplified user model. Eradicate more references
to rosters and roster sets.
Give Users a repr. Also give them a belongs_to() link to Preferences, but
change the user manager to not give a user preferences by default (the lookup
schema should properly handle users with no preferences now).
Also, when creating a user, set their real_name to the empty string if no
real_name argument was given to create_user(). Update the IUserManager
interface's create_user() method to match the implementation.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
they were previously known are now gone. Rosters, rather than being a
database entity that collects users, is now just a filter on the member
database. This way, we can use generic rosters to search for regular members,
digest members, owners, or moderators. More advanced rosters can do all kinds
of other membership queries. But rosters no longer need to be a database
entity.
Users have a name, password, optional preferences, and a set of addresses, but
users are not subscribed to mailing lists.
Addresses have the email address, some verification information, and optional
preferences.
Members tie an address to a mailing list, through a role, with optional
preferences.
Other changes here include:
MailList.fqdn_listname() moved to the MailingList model entity.
Added MemberRole enum and SystemDefaultPreferences to Mailman.constants.
Profiles are renamed to Preferences (same with the interface), but the files
are not yet moved. This happens later.
We mostly don't need has_*() relationships on the entity classes, because we
generally don't need the reverse relationship. Use belongs_to() because that
creates the foreign key, even though the wording seems counter intuitive.
IAddress.subscribe() added.
Tell Elixir to use shortnames for all tables.
Remove the OldStyleMembership fields from MailingList.
Remove all the interface elements and database fields that talk about rosters
and rostersets.
Convert Version entity to has_field().
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
classes live in Mailman/databae/model now.
Remove the TestDecorate test class from test_handlers.py and move them into a
doctest called decorate.txt (with harness in test_decorate.py).
Remove the dependence on SafeDict from the Decorate handler because I can now
use string.Template object to safely fill in header and footer templates.
Eventually I want to completely remove SafeDict from Mailman, but it's still
used in a few other places.
This also means that only $-strings will be supported in headers and footers,
and the import script will have to convert %-strings to $-strings. Also,
'_internal_name' is no longer a supported header/footer substitution
variable. Use $real_name or $list_name now. Added $fqdn_listname as a
substitution variable. Update the DEFAULT_MSG_FOOTER accordingly.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
confident the Elixir branch is ready to become mainline. Also, fewer branches
makes for an easier migration to a dvcs.
Don't expect much of the old test suite to work, or even for much of the old
functionality to work. The changes here are disruptive enough to break higher
level parts of Mailman. But that's okay because I am slowly building up a new
and improved test suite, which will lead to a functional system again.
For now, only the doctests in Mailman/docs (and their related test harnesses)
will pass, but they all do pass. Note that Mailman/docs serve as system
documentation first and unit tests second. You should be able to read the
doctest files to understand the underlying data model.
Other changes included in this merge:
- Added the Mailman.ext extension package.
- zope.interfaces uses to describe major components
- SQLAlchemy/Elixir used as the database model
- Top level doinstall target renamed to justinstall
- 3rd-party packages are now installed in pythonlib/lib/python to be more
compliant with distutils standards. This allows us to use just --home
instead of all the --install-* options.
- No longer need to include the email package or pysqlite, as Python 2.5 is
required (and comes with both packages).
- munepy package is included, for Python enums
- IRosterSets are added as a way to manage a collection of IRosters. Roster
sets are named so that we can maintain the indirection between mailing lists
and rosters, where the two are maintained in different storages.
- IMailingListRosters: remove_*_roster() -> delete_*_roster()
- Remove IMember interface.
- Utils.list_names() -> config.list_manager.names
- fqdn_listname() takes an optional hostname argument.
- Added a bunch of new exceptions used throughout the new interfaces.
- Make LockFile a context manager for use with the 'with' statement.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
instantiated MailList object via the mapper extension's populate_instance()
method. This based on information from the SQLAlchemy folks.
Add more useful output for LockFile debugging.
Add checks in loginit.py's emit() method (and .flush()) so that if the stream
has been closed, log messages will go to stderr. This happens under the test
suite with SQLAlchemy, because SA keeps references to the MailList objects
which it doesn't seem like we can clear before Python exits. So if say the
lock logger is at debug level, when the lock object gets cleared at Python
shutdown, the stream will have been closed by the time LockFile.__del__() gets
called. This change avoids the traceback at the expense of a little extra
stderr output.
MailList.__lock -> MailList._lock
MailList.__timestamp -> MailList._timestamp
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
DBContext.api_load(). This is where it really ought to be based on the
internal semantics of .Load()/.Lock().
MailListMapperExtension.populate_instance(): Checking the state of the isnew
flag is not sufficient to know whether the MailList object we're getting is
brand spankin' new or not. It turns out that when we session.expire() the
MailList object, the next time SA loads this from the db, the
populate_instance() will get called with isnew=True, even though the object
really isn't new. Instead, check to make sure InitTempVars() isn't
incorrectly called twice. Note that I might move this test, but I wanted to
check in something that works, and then see if this is what we expect from the
SA guys (this flag appears underdocumented).
LockFile.py: Add some additional debugging.
|
| |
|
|
|
|
|
|
|
|
|
| |
expire the object. This way, when the MailList attributes are next accessed,
the ORM will reload them from the database, getting any new values possibly
set in other processes.
This works better than trying to use always_refresh=True on the mapper, or
trying to do a reload() because both of those approaches blow away locks. I'm
not sure why this, but I suspect that it's because the identity map is handing
us back a different object, rather than invalidating the object's attributes.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Mailman/Queue/Switchboard.py:
listname is returned in unicode.
( '\x80' + 'a' is OK, '\x80' + u'a' is NG)
Mailman/Utils.py:
Utils.oneline() is extended for returning unicode string.
Mailman/Digester.py:
next_post_number is not used anywhere.
Mailman/database/listdata.py:
Attributes added (esp. for non web u/i)
Mailman/bin/senddigests.py:
Initialization
Mailman/Handlers/ToDigest.py:
Internal string calculation is done in unicode. So, several fixes.
StringIO is used because cStringIO doesn't have encoding attribute.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
column in the database for this list of strings. We use SQLAlchemy's
many-to-many relationship, however because of this, you cannot simply append
new unicodes to .available_languages. You need to wrap the language code in a
Language instance and append that instance to the list.
In order to handle this, I added a property MailList.language_codes which
returns a list of the code strings (not Language instances). Also new are
MailList.set_languages() for setting (i.e. overriding) the set of available
languages for the list; and add_language() which takes a single language code,
wraps it, and appends it. The code does not and should not use
.available_languages directory any more.
MailList.GetAvailableLanguages() is removed. The 'available_languages' column
is removed from the Listdata table.
Add a getValue() to Mailman.Gui.Language in order to unwrap the language codes
stored in the database's association table. Modify _setValue() to do the
wrapping.
In dbcontext.py, don't import * from the sqlalchemy package. It contains a
'logging' name which is not the standard Python logging package. I also added
essentially a bag of attributes class called Tables which will hold references
to all the SA tables that are created. Update the make_table() API to take an
instance of Tables.
Added a close() method to DBContext. This is needed for the updated unit test
suite.
Changed bin/import.py so that when available_languages is being set, it calls
MailList.set_languages() instead of trying to set that attribute directly.
Updated some language idioms while I was at it.
More eradication of mm_cfg in favor of the config object and the Defaults
module.
In testall.py, call initialize() instead of loginit.initialize().
Promote MAX_RESTARTS into a Defaults.py.in variable. This is because the unit
tests will knock that value down to something not so annoying should one of
the qrunner-required tests traceback.
Several other important changes to the unit test suite (which now completely
succeeds again!):
- Set the uid and gid of the temporary mailman.cfg and tmp*.db files to the
Mailman user and group as specified in the config object.
- Make sure that all of the tests point to a SQLite database file that was
created with the tempfile module. This way we don't pollute our main
database with data that is getting created during the unit tests.
- In the TestBase.setUp() method, be sure to close the existing dbcontext,
clear out the mappers, and then reconnect the dbcontext with the new
SQLALCHEMY_ENGINE_URL pointing to the tempfile. However, we don't need to
reload the MailList instance any more.
- Make all tests work, except for the tests that require crypt. That upgrade
path will not be available in this version of Mailman.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
during early initialization so that we're guaranteed to get the right value
regardless of the shell umask used to invoke the command line script. While
we're at it, we can remove almost all individual umask settings previously in
the code, and make file permissions consistently -rw-rw---- (IOW, files are no
longer other readable).
The only subsystem that wasn't changed was the archiver, because it uses its
own umask settings to ensure that private archives have the proper
permissions. Eventually we'll mess with this, but if it ain't broken...
Note that check_perms complains about directory permissions, but I think
check_perms can be fixed (or perhaps, even removed?!). If we decide to use
LMTPRunner and HTTPRunner exclusively then no outside process will be touching
our files potentially with the incorrect permissions, umask, owner, or group.
If we control all of our own touch points then I think we can lock out
'other'.
Another open question is whether Utils.set_global_password() can have its
umask setting removed. It locks permissions down so even the group can't
write to the site password file, but the default umask of 007 might be good
enough even for this file.
Utils.makedirs() now takes an optional mode argument, which defaults to 02775
for backward compatibility. First, the default mode can probably be changed
to 02770 (see above). Second, all code that was tweaking the umask in order
to do a platform compatible os.mkdir() has now been refactored to use
Utils.makedirs().
Another tricky thing was getting SQLite via SQLAlchemy to create its
data/mailman.db file with the proper permissions. From the comment in
dbcontext.py:
# XXX By design of SQLite, database file creation does not honor
# umask. See their ticket #1193:
# http://www.sqlite.org/cvstrac/tktview?tn=1193,31
More details in that file, but the work around is to essentially 'touch' the
database file if 'sqlite' is the scheme of the SQLAlchemy URL. This little
pre-touch sets the right umask honoring permission and won't hurt if the file
already exists. SQLite will happily keep the existing permissions, and in
fact that ticket referenced above recommends doing things this way.
In the Mailman.database.initialize(), create a global lock that prevents more
than one process from entering this init function at the same time. It's
probably not strictly necessary given that I believe all the operations in
dbcontext.connect() are multi-processing safe, but it also doesn't seem to
hurt and prevents race conditions regardless of the database's own
safeguards (or lack thereof).
Make sure nightly_gzip.py calls initialize().
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
header_filters and topics (both list topics and user topic selections).
Everything else seems to work pretty well.
dbcontext.py: Don't key the mlist transactions off of mlist.fqdn_listname
because this can change. For example, if you "bin/withlist -l mylist" and
then "m.host_name = 'new.example.com'" the fqdn_listname property will change
and the commit machinery won't be able to find the correct transaction.
Instead, store the fqdn_listname as it's seen during the api_lock() call back
on the mailing list under the _txnkey attribute. Use that attribute in
api_save() and api_unlock().
Upgrade to SQLAlchemy 0.3.3
Port from MM2.1 the support for multiple password schemes.
Change the MailList's repr to use the fqdn_listname.
|
|
|
https://mailman.svn.sourceforge.net/svnroot/mailman/branches/tmp-sqlalchemy-branch
................
r8114 | bwarsaw | 2006-12-06 00:16:54 -0500 (Wed, 06 Dec 2006) | 44 lines
Initial take on using SQLAlchemy to store list data in lieu of Python pickles.
While all the list data (including OldStyleMemberships attributes) are stored
in the database, many attributes are stored as PickleTypes binary data. This
isn't idea but it gets things working until a more sophisticated schema can be
developed.
MailList class is now a new-style class, as is required by SQLAlchemy. This
makes several things, er, interesting. Rip out all the low-level pickle
reading and writing stuff. Hook SA transaction events into Lock() and
Unlock(). Move the hooking of the _memberadaptor into InitTempVars(), which
gets called by the SQLAlchemy hooks (MailList.__init__() never is).
Add an initialize.py module which centralizes all the initialization bits that
command line scripts have to do, including configuration, logging, and atabase
initialization.
This change also converts bin/withlist to mmshell wrapper.
Update to SQLAlchemy 0.3.1.
Revamp paths.py.in considerably. There were several problems with the old
way. We no longer disable default loading of site-packages so we don't need
to add Python's site-packages back to sys.path. Also, because
site.addsitedir() causes things like .pth paths to be /appended/ to sys.path,
they actually won't override any site-installed packages. E.g. if SQLAlchemy
is installed in the system Python, our version will not override. IIUC,
setuptools-based packages can be configured to work properly in the face of
package versions, however not all packages we currently depend on are
setuptools-based. So instead, we steal a bit of stuff from site.py but change
things so the prepend .pth stuff to sys.path.
Update several modules to use True/False and whitespace normalization.
Convert from mm_cfg to config object. Modernize a few coding constructs.
Add a couple of exceptions to handle database problems.
In the export script, include the widget type in the elements. This helped in
my stupid little throw away conversion script, but I think it will be more
generally useful.
Add an interact.py module which refactors interactive interpreter access.
Mostly this is used by withlist -i, but it lets us import Mailman.interact and
drop into a prompt just about anywhere (e.g. debugging).
................
r8115 | bwarsaw | 2006-12-07 09:13:56 -0500 (Thu, 07 Dec 2006) | 22 lines
Start to flesh out more of the SQLAlchemy mechanisms.
Added a MailList.__new__() which hooks instantiation to use a query on
dbcontext to get an existing mailing list. A 'no-args' call means we're doing
a Create(), though eventually that will change too.
For now, disable the CheckVersion() call. Eventually this will be folded into
schema migration.
list_exists(): Rewrite to use the dbcontext query to determine if the named
mailing list exists or not. Requires the fqdn_listname.
Eradicate two failed member adaptors: BDBMemberAdaptor and SAMemberships.
Change the way the DBContext holds onto tables. It now keeps a dictionary
mapping the table's name to the SA Table instance. This makes it easier to
look up and use the individual tables.
Add 'web_page_url' as an attribute managed by SA, and remove a debugging
print.
................
r8116 | bwarsaw | 2006-12-11 07:27:47 -0500 (Mon, 11 Dec 2006) | 29 lines
Rework the whole dbcontext and transaction framework. SA already handles
nested transactions so we don't have to worry about them. However, we do have
the weird situation where some transactions are tied to MailList
.Lock()/.Unlock()/.Save() and some are tied to non-mlist actions. So now we
use an @txn decorator to put methods in a session transaction, but then we
also hook into the above MailList methods as possibly sub-transactions. We
use a weakref subclass to manage the MailList interface, with a dictionary
mapping MailList fqdn_listnames against transactions. The weakrefs come in by
giving us a callback when a MailList gets derefed such that we're guaranteed
to rollback any outstanding transaction.
Also, we have one global DBContext instance but rather than force the rest of
Mailman to deal with context objects, instead we expose API methods on that
object into the Mailman.database module, which the rest of the code will use.
Such methods must be prepended with 'api_' to get exposed this way.
bin/rmlist now works with the SA-backend. I refactored the code here so that
other code (namely, the test suite) can more easily and consistently remove a
mailing list. This isn't the best place for it ultimately, but it's good
enough for now.
New convenience functions Utils.split_listname(), .fqdn_listname().
Convert testall to use Mailman.initialize.initialize(). Not all tests work,
but I'm down to only 8 failures and 7 errors. Also, do a better job of
recovering from failures in setUp().
MailList.__new__() now takes keyword arguments.
................
r8117 | bwarsaw | 2006-12-11 22:58:06 -0500 (Mon, 11 Dec 2006) | 7 lines
Unit test repairs; even though the unit tests are still pretty fragile,
everything now passes with the SQLAlchemy storage of list data.
Added missing 'personalize' column. Converted mailmanctl and qrunner to
initialize() interface. Fixed _cookie_path() to not fail if SCRIPT_NAME is
not in the environment.
................
r8118 | bwarsaw | 2006-12-27 18:45:41 -0500 (Wed, 27 Dec 2006) | 21 lines
Utils.list_names(): Use a database query to get all the list names.
dbcontext.py: Added api_get_list_names() to support Utils.list_names().
listdata.py: Added two additional MailList attributes which need to be stored
in the database. The first is 'admin_member_chunksize' which isn't modifiable
from the web. The second is 'password' which holds the list's password.
HTMLFormatObject: item strings can now be unicodes.
bin/list_lists.py: Must call initialize() to get the database properly
initialized, not just config.load(). This will be a common theme.
SecurityManager.py:
- Remove md5 and crypt support
- Added mailman.debug logger, though it will be only used during
debugging.
- The 'secret' can be a unicode now.
- A few coding style updates; repr() instead of backticks, 'key in dict'
instead of 'dict.has_key(key)'
................
r8119 | bwarsaw | 2006-12-27 19:13:09 -0500 (Wed, 27 Dec 2006) | 2 lines
genaliases.py: config.load() -> initialize()
................
r8120 | bwarsaw | 2006-12-27 19:17:26 -0500 (Wed, 27 Dec 2006) | 9 lines
Blocked revisions 8113 via svnmerge
........
r8113 | bwarsaw | 2006-12-05 23:54:30 -0500 (Tue, 05 Dec 2006) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-8112" from
https://mailman.svn.sourceforge.net/svnroot/mailman/branches/tmp-sqlalchemy-branch
........
................
r8121 | bwarsaw | 2006-12-28 23:34:52 -0500 (Thu, 28 Dec 2006) | 20 lines
Remove SIGTERM handling from all the CGI scripts. This messes with HTTPRunner
because when you issue "mailmanctl stop" after the signal handler has been
installed, the process will get a SIGTERM, the signal handler will run, and
the process will exit with a normal zero code. This will cause mailmanctl to
try to restart the HTTPRunner.
I don't think we need that stuff at all when running under wsgi with a
SQLAlchemy backend. If mailmanctl kills the HTTPRunner in the middle of the
process, I believe (but have not tested) that the transaction should get
properly rolled back at process exit. We need to make sure about this, and
also we need to test the signal handling functionality under traditional CGI
environment (if we even still want to support that).
Also, make sure that we don't try to initialize the loggers twice in qrunner.
This was the cause of all the double entries in logs/qrunner.
Fix a coding style nit in mailmanctl.py.
De-DOS-ify line endings in loginit.py.
................
|