SF.net SVN: tmda: [2148] trunk/tmda
[email protected] Fri, 23 Feb 2007 12:20:10 -0800
| Newsgroups | gmane.mail.spam.tmda.cvs |
|---|---|
| Message-ID | <[email protected]> |
Revision: 2148
http://svn.sourceforge.net/tmda/?rev=2148&view=rev
Author: jasonrm
Date: 2007-02-23 12:20:10 -0800 (Fri, 23 Feb 2007)
Log Message:
-----------
* New feature courtesy of Vitor Espindola. A new configuration
variable, TIMEOUT_UNITS, to give users the ability to customize the
timeout unit value strings in the templates instead of using the
English defaults of "years", "months", "weeks", "days", "hours",
"minutes", and "seconds". e.g,
TIMEOUT_UNITS = {
'Y' : "anos",
'M' : "meses",
'w' : "semanas",
'd' : "dias",
'h' : "horas",
'm' : "minutos",
's' : "segundos"
}
Modified Paths:
--------------
trunk/tmda/NEWS
trunk/tmda/TMDA/ChangeLog
trunk/tmda/TMDA/Defaults.py
trunk/tmda/TMDA/Util.py
trunk/tmda/htdocs/config-vars.html
Modified: trunk/tmda/NEWS
===================================================================
--- trunk/tmda/NEWS 2007-02-23 19:21:29 UTC (rev 2147)
+++ trunk/tmda/NEWS 2007-02-23 20:20:10 UTC (rev 2148)
@@ -7,6 +7,13 @@
TMDA 1.1.11 "Ladyburn" --
+* New feature courtesy of Vitor Espindola. A new configuration
+ variable, TIMEOUT_UNITS, to give users the ability to customize the
+ timeout unit value strings in the templates instead of using the
+ English defaults of "years", "months", "weeks", "days", "hours",
+ "minutes", and "seconds". For more information, see
+ http://wiki.tmda.net/ConfigurationVariables#TIMEOUT_UNITS
+
* Virtual domain improvements to tmda-pending courtesy of Lloyd
Zusman. A '--vhost-script' command-line option has been added to
match tmda-ofmipd and tmda-filter. Also two new options have been
Modified: trunk/tmda/TMDA/ChangeLog
===================================================================
--- trunk/tmda/TMDA/ChangeLog 2007-02-23 19:21:29 UTC (rev 2147)
+++ trunk/tmda/TMDA/ChangeLog 2007-02-23 20:20:10 UTC (rev 2148)
@@ -1,3 +1,11 @@
+2007-02-23 Jason R. Mastaler <[email protected]>
+
+ * Util.py (format_timeout): Use Defaults.TIMEOUT_UNITS.
+
+ * Defaults.py: (TIMEOUT_UNITS): New variable to give users the
+ ability to customize the timeout strings for languages other than
+ English. Contributed by Vitor Espindola.
+
2006-12-07 Jason R. Mastaler <[email protected]>
* Pending.py (Message.release): Add the IP address and browser
Modified: trunk/tmda/TMDA/Defaults.py
===================================================================
--- trunk/tmda/TMDA/Defaults.py 2007-02-23 19:21:29 UTC (rev 2147)
+++ trunk/tmda/TMDA/Defaults.py 2007-02-23 20:20:10 UTC (rev 2148)
@@ -1511,6 +1511,34 @@
if not vars().has_key('USERNAME'):
USERNAME = Util.getusername()
+# TIMEOUT_UNITS
+# Dictionary that contains translations of timeout unit strings. This
+# dictionary must contains the keys Y,M,w,d,h,m,s with respective
+# internationalized strings as values.
+#
+# Examples:
+#
+# TIMEOUT_UNITS = {
+# 'Y' : "anos",
+# 'M' : "meses",
+# 'w' : "semanas",
+# 'd' : "dias",
+# 'h' : "horas",
+# 'm' : "minutos",
+# 's' : "segundos"}
+#
+# Default is English values.
+if not vars().has_key('TIMEOUT_UNITS'):
+ TIMEOUT_UNITS = {
+ 'Y' : "years",
+ 'M' : "months",
+ 'w' : "weeks",
+ 'd' : "days",
+ 'h' : "hours",
+ 'm' : "minutes",
+ 's' : "seconds"
+ }
+
# X_TMDA_IN_SUBJECT
# With this variable set to True, tmda-inject will parse the Subject
# header looking for `X-TMDA' actions, and then remove them before
Modified: trunk/tmda/TMDA/Util.py
===================================================================
--- trunk/tmda/TMDA/Util.py 2007-02-23 19:21:29 UTC (rev 2147)
+++ trunk/tmda/TMDA/Util.py 2007-02-23 20:20:10 UTC (rev 2148)
@@ -244,20 +244,8 @@
if not match:
return timeout
(num, unit) = match.groups()
- if unit == 'Y':
- timeout = num + " years"
- elif unit == 'M':
- timeout = num + " months"
- elif unit == 'w':
- timeout = num + " weeks"
- elif unit == 'd':
- timeout = num + " days"
- elif unit == 'h':
- timeout = num + " hours"
- elif unit == 'm':
- timeout = num + " minutes"
- else:
- timeout = num + " seconds"
+ import Defaults
+ timeout = num + " " + Defaults.TIMEOUT_UNITS[unit]
if int(num) == 1:
timeout = timeout[:-1]
return timeout
Modified: trunk/tmda/htdocs/config-vars.html
===================================================================
--- trunk/tmda/htdocs/config-vars.html 2007-02-23 19:21:29 UTC (rev 2147)
+++ trunk/tmda/htdocs/config-vars.html 2007-02-23 20:20:10 UTC (rev 2148)
@@ -201,15 +201,17 @@
<td><a href="#TERSE_SUMMARY_HEADERS">TERSE_SUMMARY_HEADERS</a></td>
</tr>
<tr>
+<td><a href="#TIMEOUT_UNITS">TIMEOUT_UNITS</a></td>
<td><a href="#TMDAINJECT">TMDAINJECT</a></td>
-<td><a href="#USERNAME">USERNAME</a></td>
</tr>
<tr>
+<td><a href="#USERNAME">USERNAME</a></td>
<td><a href="#USEVIRTUALDOMAINS">USEVIRTUALDOMAINS</a></td>
-<td><a href="#VIRTUALDOMAINS">VIRTUALDOMAINS</a></td>
</tr>
<tr>
+<td><a href="#VIRTUALDOMAINS">VIRTUALDOMAINS</a></td>
<td><a href="#X_TMDA_IN_SUBJECT">X_TMDA_IN_SUBJECT</a></td>
+</tr>
</table>
<dl>
@@ -1625,6 +1627,27 @@
<br><br>
Default is the Fullname followed by Subject.
<dt><hr>
+<a name="TIMEOUT_UNITS"><h4>TIMEOUT_UNITS</h4></a>
+<dd>
+Dictionary that contains translations of timeout unit strings. This
+dictionary must contains the keys Y,M,w,d,h,m,s with respective
+internationalized strings as values.
+<br><br>
+Examples:
+<br><br>
+<code>TIMEOUT_UNITS = {</code><br>
+<blockquote>
+<code> 'Y' : "anos",</code><br>
+<code> 'M' : "meses",</code><br>
+<code> 'w' : "semanas",</code><br>
+<code> 'd' : "dias",</code><br>
+<code> 'h' : "horas",</code><br>
+<code> 'm' : "minutos",</code><br>
+<code> 's' : "segundos"}</code>
+</blockquote>
+<br>
+Default is English values.
+<dt><hr>
<a name="TMDAINJECT"><h4>TMDAINJECT</h4></a>
<dd>
A string containing one or more of the following letters which toggle
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.