summaryrefslogtreecommitdiff
path: root/Mailman/i18n.py
Commit message (Collapse)AuthorAgeFilesLines
* Bite the bullet: rename the Mailman package to mailman.Barry Warsaw2008-02-271-185/+0
|
* PEP 292 style, $-strings are used by the translation service everywhere now.Barry Warsaw2008-02-181-15/+6
| | | | No more %-strings. Kill off all __i18n_templates__ hacks.
* Tweak copyright years.Barry Warsaw2008-02-071-1/+1
|
* Implement a context manager for Python 2.5's with statement, which isBarry Warsaw2007-09-191-0/+15
| | | | | | | | used where we used to do a try/except to temporarily change the global translation language. This makes the code shorter and cleaner. E.g. with i18n.using_language(another_language): # do something
* Major surgery to get the setuptools based installation passing all theBarry Warsaw2007-07-161-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | existing unit tests. Here's a summary of the changes. - Removed all dependent third party packages, since the setup.py file now claims all package dependencies such that they can be automatically installed from the cheeseshop. - Moved the misc directory into the Mailman package as Mailman/data. Moved templates and messages to Mailman subpackages. - Added an ILanguageManager interface, plus an implementation, so that we don't use Defaults.LC_DESCRIPTIONS directly anymore. Added a doctest for this interface and implementation. Defaults.LANGUAGES is moved into mailman.cfg. Defaults.LANGUAGE_DICT is moved to _DEFAULT_LANGUAGE_DATA, and LC_DESCRIPTIONS is removed. The calculation of the available and enabled languages is moved to the Configuration class, but this will probably still need work. Utils.GetLanguageDescr() and Utils.IsLanguage() are removed. I'd like to remove GetCharSet() eventually too, but there are too many uses of this currently, so I'm deferring it. - Utils.findtext(): Hacks added so that templates can be retrieved from the language catalog. The hack is that the template contents are used to find the translation, but in the one test case where this is actually flexed, the trailing newline in the file contents has to be trimmed. This is probably not right. - No more Defaults.py.in or mm_cfg.py! Defaults.py.in is moved to Defaults.py and is no longer created from a template file. The script called make_instance is added which creates an etc/mailman.cfg file from mailman.cfg.in (previously, mailman.cfg.sample) and /that/ file now has the small number of calculated values. In general, make_instance will not touch mailman.cfg if it exists, unless the --force option is given. CGIEXT is made the empty string by default (i.e. not generated). make_instance grows a --var-dir option. Fleshed out the --languages opton. - Defaults.py grows a DEFAULT_VAR_DIRECTORY variable, which is the default location of the 'var' directory. The Configuration class uses this as one of the directories it searches for its landmark, i.e. etc/mailman.cfg. RUNTIME_DIR is gone, as is VAR_PREFIX. - testall needs to write MAILMAN_USER, MAILMAN_UID, MAILMAN_GROUP, MAILMAN_GID, and LANGUAGES run time variables. - bin/withlist no longer needs to add config.BIN_DIR to sys.path, because in fact that variable doesn't exist any more. - Tweak the French catalog to make a test work. This is needed because of the conversion from %-strings to $-strings. - The setup.py now generates the .mo files before it does its thing. This will have to be fixed, but for now we must generate these files on setup build time instead of installation time. - Removed an unused interface.
* Test suite repair. All tests are now passing again.bwarsaw2007-03-211-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - In i18n.py, change this method so that everything it returns will be guaranteed to be a unicode. Mailman 2.2 will be unicode-safe, meaning all strings internally will be unicodes. The translation service is one boundary point were strings come from the outside, so ensure that they are unicodes and convert if necessary. This may break some things, but it's better to fix those situations than to continue to return 8-bit strings from _(). - In Mailman/testing/base.py, craft a fake module called Mailman.MTA.stub and stick no-op functions on stub.create() and stub.remove(). We really don't need the MTA modules for testing purposes (yet at least), and if you're using the default configuration, you'll get tons of cruft on stdout when the Manual MTA tries to add and remove mailing lists. Set up the test configuration environment to use this stub MTA module. - In test_handlers.py, remove an extraneous str(). - Convert ToDigest.py, Hold.py and Acknowledge.py to __i18n_templates__. (I'm pretty darn close to just making everything use $-strings by default.) - In CookHeaders.py, there's no need to unicode()-ify the subject since that should already be a unicode when passed from _(). - In MailList.py, we can use the str.capitalize() method.
* Restoreing i18n in 2.2tkikuchi2007-03-011-1/+3
| | | | | | | | - As the default type of string in mailman-2.2 was set to 'unicode', i18n codes became need to be fixed. - Fixed: admin web interface. Other web interfaces needs more verification. - Fixed: non-digest delivery. Stil to go: digest and archive.
* Update copyright years.bwarsaw2007-01-191-1/+1
|
* First crack at real virtual domain support, i.e. mailing lists with the samebwarsaw2006-07-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | name in more than one domain. - Totally eradicate MAILMAN_SITE_LIST, and in fact the entire need for a site list. The functions that the site list previously performed are either removed or supported in other ways. For example, instead of forwarding owner bounces to the site list, we now have a SITE_OWNER_ADDRESS which should point to a human, and such bounces are sent there instead. There's also a "no reply" email address that should be set up to go to devnull. For any message that never expects a reply, the sender is set to this address. - Remove the Site.py module. It was an experimental approach to trying to support virtual domains, and we're going to do it so much better now that this module is no longer necessary. Site._makedirs() -> Utils.makedir(). - VIRTUAL_HOST_OVERVIEW is completely removed, since now virtual hosts are always enabled. Virtual domains should be added to mailman.cfg by using the new add_domain() function. add_virtualhost() is gone. If no virtual domains are added explicitly, we add the default one that configure guessed (but we never add that if domains are added explicitly). - Utils.get_domain() -> Utils.get_request_domain() - withlist code cleanup and make sure that we load etc/mailman.cfg - A new base exception called MailmanException is added, from which all exceptions defined in Errors.py ultimately derive. MailmanError is retained and derives from MailmanException. - BadDomainSpecificationError is added. - Remove the -V/--virtual-host-overview option from list_lists and add instead -d/--domain and -f/--full. - bin/update probably works but needs more testing. - bin/newlist and bin/rmlist take fqdn list names, but default to the default domain if @whatever isn't given. newlist's -u/--urlhost and -e/--emailhost options are removed. The domain that the list is being added to must already exist. - Minor code cleanup in Message.py - Bump version to 2.2.0a1 - The Configuration object grows a .domain dictionary which maps email hosts to url hosts. The reverse mapping is supported, but not directly; use Configuration.get_email_host() instead. - Mailman/Cgi/create is converted from mm_cfg to config, and some minor code cleanup is performed. Also, convert to __i18n_templates__ = True. - New MailList APIs: + property .fqdn_listname + GetNoReplyEmail() + Create() API changes and refactoring.
* Massive conversion process so that Mailman can be run from a user specifiedbwarsaw2006-07-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | configuration file. While the full conversion is not yet complete, everything that seems to be required to run mailmanctl, qrunner, rmlist, and newlist have been updated. Basically, modules should no longer import mm_cfg, but instead they should import Mailman.configuration.config. The latter is an object that's guaranteed to exist, but not guaranteed to be initialized until some top-level script calls config.load(). The latter should be called with the argument to -C/--config which is a new convention the above scripts have been given. In most cases, where mm_cfg.<variable> is used config.<variable> can be used, but the exceptions are where the default value must be available before config.load() is called. Sometimes you can import Mailman.Default and get the variable from there, but other times the code has to be changed to work around this limitation. Take each on a case-by-case basis. Note that the various directories calculated from VAR_PREFIX, EXEC_PREFIX, and PREFIX are now calculated in config.py, not in Defaults.py. This way a configuration file can override the base directories and everything should work correctly. Other changes here include: - mailmanctl, qrunner, and update are switched to optparse and $-strings, and changed to the mmshell architecture - An etc directory has been added to /usr/local/mailman and a mailman.cfg.sample file is installed there. Sites should now edit an etc/mailman.cfg file to do their configurations, although the mm_cfg file is still honored. The formats of the two files are identical. - list_lists is given the -C/--config option - Some coding style fixes in bin/update, but not extensive - Get rid of nested scope hacks in qrunner.py - A start on getting EmailBase tests working (specifically test_message), although not yet complete.
* Move list_lists and list_members over to Mailman.bin package and rewrite tobwarsaw2006-04-291-9/+24
| | | | | | | | | | | | | | | | | use $-strings and optparse. A side effect of the rewrite is that list_members -d and -n now require their argument, whereas before they were optional (but that is counter to command line parsing standards and not supported by optparse). Now, instead of bare -n use '-n any' and instead of bare -d use '-d any'. Fix ReopenableFileHandler.emit() to ensure that all lines end in a newline. In i18n.py, create and use a subclass of string.Template so that dotted attribute paths are legal in $-strings. So for example, if you have an object 'foo' in one of the namespaces and that has an attribute 'bar', you can say "$foo.bar" to print the value of foo.bar. Should reduce the number of extraneous local variables just to do the attribute path traversal.
* Convert Mailman.bin.rmlist module to optparse, and do general cleanup.bwarsaw2006-04-281-8/+19
| | | | | | | | | | | | | | | | | Modify Mailman.i18n._() to understand string.Template style $-strings. The function now looks in the frame's locals and globals for a variable __i18n_templates__ which if True (defaults to False if missing) says that the string being translated uses $-strings instead of %-strings. newlist and rmlist both set __i18n_templates__ = True in their module globals. Rewrite ReopenableFileHandler to better ensure that nothing we log (even random 8-bit garbage) can cause an error in the logging subsystem. First, we open the underlying log file using a utf-8 codec, but if we get a UnicodeError when writing a log message to the stream, we encode the string with the 'string-escape' codec, which should pretty much makes any string data loggable.
* Remove most uses of the types module, in favor of isinstance checks againstbwarsaw2006-04-171-3/+2
| | | | | | the builtin types. Two still remain: a check against ClassType and a check against MethodType. Also, fix some hinky type comparisons to use isinstance() consistently.
* Improved fix for bug 1433673. When time.strptime returns tm_isdst = -1, usemsapiro2006-02-231-0/+4
| | | | time.localtime(time.mktime()) to try again.
* Fixed bug 1433673 by fixing ctime() to not use time.tzname[1] when tm_isdst ↵msapiro2006-02-191-4/+7
| | | | is -1.
* back porting from 2.1.6tkikuchi2005-08-281-1/+1
|
* FSF office has moved. chdcking in for MAIN branch.tkikuchi2005-08-271-1/+1
|
* _(): Encode any Unicode values in the interpolation dictionary backbwarsaw2003-03-121-4/+15
| | | | | | | | | into encoded 8-bit strings. Returning Unicode from here caused too much breakage, so we go in the other direction. Eventually, Mailman should use Unicode for everything (maybe). This should fix (one of) Peer's problems, and maybe the one recently reported by Dan Buchmann.
* ctime(): First try to parse the date if it's a string and only do thebwarsaw2002-12-091-19/+24
| | | | | fallback if ValueError occurs. Also default tzname to "Server Local Time" for want of a better default.
* ctime(): Include the local timezone name in the date string, as keyedbwarsaw2002-12-071-1/+3
| | | | off of the dst flag. This mirrors date(1) output.
* Integrating SF patch #594771, i18n'ified pipermail. Changes herebwarsaw2002-10-081-3/+49
| | | | | | | | include: ctime(): An i18n'd ctime for the archiver. Whitespace normalization.
* _(): If s is the empty string, just return it. Don't try to translatebwarsaw2002-05-031-0/+3
| | | | it or you'll get the catalog header!
* Update copyright years.bwarsaw2002-03-161-1/+1
|
* We can simplify the logic here because Python 2.1 is a minimumbwarsaw2002-03-161-26/+3
| | | | | | requirement, and that comes with sys._getframe(). _x(): Removed.
* Better support for command line scripts which want to set the defaultbwarsaw2001-05-181-5/+12
| | | | | | | | | | | language to the value of $LANGUAGE (or any of the other gettext module supported environment variables). Specifically, set_language(): Allow the `language' parameter to default to None, which tells gettext.translation() to use its own defaults. When the module global _translation is None, call set_language() with no arguments.
* get_translation(), set_translation(): Function which let you set andbwarsaw2001-03-021-0/+9
| | | | restore the translation context (via the global Translations object).
* set_language(): If the specified catalog file can't be found, gettextbwarsaw2001-02-281-2/+7
| | | | raises an IOError. Catch this and fall back to a NullTranslations().
* Get SafeDict from SafeDict not Utils.bwarsaw2001-02-151-2/+2
|
* intermediatebwarsaw2000-12-071-0/+75