summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f5f7ab1)
raw | patch | inline | side by side (parent: f5f7ab1)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sat, 5 Jan 2002 02:22:32 +0000 (02:22 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sat, 5 Jan 2002 02:22:32 +0000 (02:22 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@497 57a73879-2fb5-44c3-a270-3262357dd7e2
cgi-bin/roundup.cgi | patch | blob | history | |
roundup-mailgw | patch | blob | history | |
roundup-server | patch | blob | history | |
roundup/cgitb.py | patch | blob | history |
diff --git a/cgi-bin/roundup.cgi b/cgi-bin/roundup.cgi
index f1d55180e65c1500889337e9147273d2dc4384e9..93c1ebd5cdbfa3de3d42bfa5cc266435a872bfa8 100755 (executable)
--- a/cgi-bin/roundup.cgi
+++ b/cgi-bin/roundup.cgi
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: roundup.cgi,v 1.22 2001-12-13 00:20:01 richard Exp $
+# $Id: roundup.cgi,v 1.23 2002-01-05 02:19:03 richard Exp $
# python version check
from roundup import version_check
+from roundup.i18n import _
#
## Configuration
from roundup import cgitb
except:
print "Content-Type: text/html\n"
- print "Failed to import cgitb.<pre>"
+ print _("Failed to import cgitb.<pre>")
s = StringIO.StringIO()
traceback.print_exc(None, s)
print cgi.escape(s.getvalue()), "</pre>"
request.send_header('Content-Type', 'text/html')
request.end_headers()
w = request.write
- w('<html><head><title>Roundup instances index</title></head>\n')
- w('<body><h1>Roundup instances index</h1><ol>\n')
+ w(_('<html><head><title>Roundup instances index</title></head>\n'))
+ w(_('<body><h1>Roundup instances index</h1><ol>\n'))
homes = ROUNDUP_INSTANCE_HOMES.keys()
homes.sort()
for instance in homes:
- w('<li><a href="%s/%s/index">%s</a>\n'%(
- os.environ['SCRIPT_NAME'], urllib.quote(instance),
- cgi.escape(instance)))
- w('</ol></body></html>')
+ w(_('<li><a href="%(instance_url)s/index">%(instance_name)s</a>\n')%{
+ 'instance_url': os.environ['SCRIPT_NAME']+'/'+urllib.quote(instance),
+ 'instance_name': cgi.escape(instance)})
+ w(_('</ol></body></html>'))
#
# Now do the actual CGI handling
#
# $Log: not supported by cvs2svn $
+# Revision 1.22 2001/12/13 00:20:01 richard
+# . Centralised the python version check code, bumped version to 2.1.1 (really
+# needs to be 2.1.2, but that isn't released yet :)
+#
# Revision 1.21 2001/12/02 05:06:16 richard
# . We now use weakrefs in the Classes to keep the database reference, so
# the close() method on the database is no longer needed.
diff --git a/roundup-mailgw b/roundup-mailgw
index 1e1f4b4527423d0f3cf58d6b7defeabbbee0fb6a..00905c0e6013613ad03d947315314a687e7b1a62 100755 (executable)
--- a/roundup-mailgw
+++ b/roundup-mailgw
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: roundup-mailgw,v 1.18 2001-12-13 00:20:01 richard Exp $
+# $Id: roundup-mailgw,v 1.19 2002-01-05 02:19:03 richard Exp $
# python version check
from roundup import version_check
import sys, os, re, cStringIO
from roundup.mailgw import Message
+from roundup.i18n import _
def do_pipe(handler):
'''Read a message from standard input and pass it to the mail handler.
'''
import getpass, poplib
if not user:
- user = raw_input('User: ')
+ user = raw_input(_('User: '))
if not password:
password = getpass.getpass()
def usage(args, message=None):
if message is not None:
print message
- print 'Usage: %s <instance home> [source spec]'%args[0]
- print '''
+ print _('Usage: %(program)s <instance home> [source spec]')%{'program': args[0]}
+ print _('''
The roundup mail gateway may be called in one of two ways:
. with an instance home as the only argument,
. with both an instance home and a mail spool file, or
pop server
are both valid. The username and/or password will be prompted for if
not supplied on the command-line.
-'''
+''')
return 1
def main(args):
# otherwise, figure what sort of mail source to handle
if len(args) < 4:
- return usage(args, 'Error: not enough source specification information')
+ return usage(args, _('Error: not enough source specification information'))
source, specification = args[2:]
if source == 'mailbox':
return do_mailbox(handler, specification)
if m:
return do_pop(handler, m.group('server'), m.group('user'),
m.group('pass'))
- return usage(args, 'Error: pop specification not valid')
+ return usage(args, _('Error: pop specification not valid'))
- return usage(args, 'Error: The source must be either "mailbox" or "pop"')
+ return usage(args, _('Error: The source must be either "mailbox" or "pop"'))
# call main
if __name__ == '__main__':
#
# $Log: not supported by cvs2svn $
+# Revision 1.18 2001/12/13 00:20:01 richard
+# . Centralised the python version check code, bumped version to 2.1.1 (really
+# needs to be 2.1.2, but that isn't released yet :)
+#
# Revision 1.17 2001/12/02 05:06:16 richard
# . We now use weakrefs in the Classes to keep the database reference, so
# the close() method on the database is no longer needed.
diff --git a/roundup-server b/roundup-server
index 1d204e01442ba95e960c461e75f6b3041c741a57..d7432d1177c4da3b0a37e157910c648dc2d2545a 100755 (executable)
--- a/roundup-server
+++ b/roundup-server
#
""" HTTP Server that serves roundup.
-Based on CGIHTTPServer in the Python library.
-
-$Id: roundup-server,v 1.23 2001-12-15 23:47:07 richard Exp $
-
+$Id: roundup-server,v 1.24 2002-01-05 02:19:03 richard Exp $
"""
# python version check
# Roundup modules of use here
from roundup import cgitb, cgi_client
import roundup.instance
+from roundup.i18n import _
#
## Configuration
self.send_header('Content-Type', 'text/html')
self.end_headers()
w = self.wfile.write
- w('<html><head><title>Roundup instances index</title></head>\n')
- w('<body><h1>Roundup instances index</h1><ol>\n')
+ w(_('<html><head><title>Roundup instances index</title></head>\n'))
+ w(_('<body><h1>Roundup instances index</h1><ol>\n'))
for instance in self.ROUNDUP_INSTANCE_HOMES.keys():
- w('<li><a href="%s/index">%s</a>\n'%(urllib.quote(instance),
- cgi.escape(instance)))
- w('</ol></body></html>')
+ w(_('<li><a href="%(instance_url)s/index">%(instance_name)s</a>\n')%{
+ 'instance_url': urllib.quote(instance),
+ 'instance_name': cgi.escape(instance)})
+ w(_('</ol></body></html>'))
def inner_run_cgi(self):
''' This is the inner part of the CGI handling
client.main()
def usage(message=''):
- if message: message = 'Error: %s\n\n'%message
- print '''%sUsage:
+ if message:
+ message = _('Error: %(error)s\n\n')%{'error': message}
+ print _('''%(message)sUsage:
roundup-server [-n hostname] [-p port] [name=instance home]*
-n: sets the host name
"roundup-admin init". You may specify any number of these name=home
pairs on the command-line. For convenience, you may edit the
ROUNDUP_INSTANCE_HOMES variable in the roundup-server file instead.
-'''%message
+'''%locals()
sys.exit(0)
def main():
try:
import pwd
except ImportError:
- raise ValueError, "Can't change users - no pwd module"
+ raise ValueError, _("Can't change users - no pwd module")
try:
uid = pwd.getpwnam(user)[2]
except KeyError:
- raise ValueError, "User %s doesn't exist"%user
+ raise ValueError, _("User %(user)s doesn't exist")%locals()
os.setuid(uid)
elif os.getuid() and user is not None:
- print 'WARNING: ignoring "-u" argument, not root'
+ print _('WARNING: ignoring "-u" argument, not root')
# People can remove this check if they're really determined
if not os.getuid() and user is None:
- raise ValueError, "Can't run as root!"
+ raise ValueError, _("Can't run as root!")
# handle instance specs
if args:
try:
name, home = arg.split('=')
except ValueError:
- raise ValueError, "Instances must be name=home"
+ raise ValueError, _("Instances must be name=home")
d[name] = home
RoundupRequestHandler.ROUNDUP_INSTANCE_HOMES = d
except SystemExit:
sys.argv = sys.argv[:1]
address = (hostname, port)
httpd = BaseHTTPServer.HTTPServer(address, RoundupRequestHandler)
- print 'Roundup server started on', address
+ print _('Roundup server started on %(address)s')%locals()
httpd.serve_forever()
if __name__ == '__main__':
#
# $Log: not supported by cvs2svn $
+# Revision 1.23 2001/12/15 23:47:07 richard
+# sys module went away...
+#
# Revision 1.22 2001/12/13 00:20:01 richard
# . Centralised the python version check code, bumped version to 2.1.1 (really
# needs to be 2.1.2, but that isn't released yet :)
diff --git a/roundup/cgitb.py b/roundup/cgitb.py
index cc9217b77912ea62406a87b1b78be2fc1f1a4af7..de017e42c7269c3ca601cdef5e4aca2796f3ef48 100644 (file)
--- a/roundup/cgitb.py
+++ b/roundup/cgitb.py
#
# This module was written by Ka-Ping Yee, <ping@lfw.org>.
#
-# $Id: cgitb.py,v 1.7 2001-11-22 15:46:42 jhermann Exp $
+# $Id: cgitb.py,v 1.8 2002-01-05 02:22:32 richard Exp $
__doc__ = """
Extended CGI traceback handler by Ka-Ping Yee, <ping@lfw.org>.
import sys, os, types, string, keyword, linecache, tokenize, inspect, pydoc
+from roundup.i18n import _
+
def breaker():
return ('<body bgcolor="#f0f0ff">' +
'<font color="#f0f0ff" size="-5"> > </font> ' +
'<font size=+1><strong>%s</strong>: %s</font>'%(str(etype), str(evalue)),
'#ffffff', '#aa55cc', pyver)
- head = head + ('<p>A problem occurred while running a Python script. '
+ head = head + (_('<p>A problem occurred while running a Python script. '
'Here is the sequence of function calls leading up to '
'the error, with the most recent (innermost) call first. '
- 'The exception attributes are:')
+ 'The exception attributes are:'))
indent = '<tt><small>%s</small> </tt>' % (' ' * 5)
traceback = []
if locals.has_key(name):
value = pydoc.html.repr(locals[name])
else:
- value = '<em>undefined</em>'
+ value = _('<em>undefined</em>')
name = '<strong>%s</strong>' % name
else:
if frame.f_globals.has_key(name):
value = pydoc.html.repr(frame.f_globals[name])
else:
- value = '<em>undefined</em>'
+ value = _('<em>undefined</em>')
name = '<em>global</em> <strong>%s</strong>' % name
lvals.append('%s = %s' % (name, value))
if lvals:
#
# $Log: not supported by cvs2svn $
+# Revision 1.7 2001/11/22 15:46:42 jhermann
+# Added module docstrings to all modules.
+#
# Revision 1.6 2001/09/29 13:27:00 richard
# CGI interfaces now spit up a top-level index of all the instances they can
# serve.