Skip to content

Commit 4f0935e

Browse files
author
Richard Jones
committed
login may now be for a single session
trackers may hide exceptions from web users (they will be mailed to the tracker admin)
1 parent e585acd commit 4f0935e

File tree

9 files changed

+103
-17
lines changed

9 files changed

+103
-17
lines changed

CHANGES.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
This file contains the changes to the Roundup system over time. The entries
22
are given with the most recent entry first.
33

4-
2006-02-06 1.0.2
4+
2006-02-06 1.1.0
55
Feature:
66
- trackers may configure custom stop-words for the full-text indexer
7+
- login may now be for a single session
8+
- trackers may hide exceptions from web users (they will be mailed to the
9+
tracker admin)
710

811
Fixed:
912
- fixes in scripts/import_sf.py

doc/customizing.txt

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Customising Roundup
33
===================
44

5-
:Version: $Revision: 1.192 $
5+
:Version: $Revision: 1.193 $
66

77
.. This document borrows from the ZopeBook section on ZPT. The original is at:
88
http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
@@ -163,6 +163,26 @@ Section **tracker**
163163
email -- ``issue_tracker``
164164
Email address that mail to roundup should go to.
165165

166+
Section **web**
167+
http_auth -- ``yes``
168+
Whether to use HTTP Basic Authentication, if present.
169+
Roundup will use either the REMOTE_USER or HTTP_AUTHORIZATION
170+
variables supplied by your web server (in that order).
171+
Set this option to 'no' if you do not wish to use HTTP Basic
172+
Authentication in your web interface.
173+
174+
use_browser_language -- ``yes``
175+
Whether to use HTTP Accept-Language, if present.
176+
Browsers send a language-region preference list.
177+
It's usually set in the client's browser or in their
178+
Operating System.
179+
Set this option to 'no' if you want to ignore it.
180+
181+
debug -- ``no``
182+
Setting this option makes Roundup display error tracebacks
183+
in the user's browser rather than emailing them to the
184+
tracker admin."),
185+
166186
Section **rdbms**
167187
Settings in this section are used by Postgresql and MySQL backends only
168188

@@ -4494,6 +4514,24 @@ Setting up a "wizard" (or "druid") for controlled adding of issues
44944514
you're done (the standard context/submit method can do this for you).
44954515

44964516

4517+
Debugging Trackers
4518+
==================
4519+
4520+
There are three switches in tracker configs that turn on debugging in
4521+
Roundup:
4522+
4523+
1. web :: debug
4524+
2. mail :: debug
4525+
3. logging :: level
4526+
4527+
See the config.ini file or the `tracker configuration`_ section above for
4528+
more information.
4529+
4530+
Additionally, the ``roundup-server.py`` script has its own debugging mode
4531+
in which it reloads edited templates immediately when they are changed,
4532+
rather than requiring a web server restart.
4533+
4534+
44974535
-------------------
44984536

44994537
Back to `Table of Contents`_

doc/upgrading.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,22 @@ steps.
1313

1414
.. contents::
1515

16+
Migrating from 1.0 to 1.1
17+
=========================
18+
19+
1.1 Login for Session Only
20+
--------------------------
21+
22+
In 1.1, web logins are alive for the length of a session only, *unless* you
23+
add the following to the login form in your tracker's ``page.html``::
24+
25+
<input type="checkbox" name="remember" id="remember">
26+
<label for="remember" i18n:translate="">Remember me?</label><br>
27+
28+
See the classic tracker ``page.html`` if you're unsure where this should
29+
go.
30+
31+
1632
Migrating from 0.8.x to 1.0
1733
===========================
1834

roundup/cgi/actions.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#$Id: actions.py,v 1.56 2006-01-27 03:30:38 richard Exp $
1+
#$Id: actions.py,v 1.57 2006-02-08 03:47:28 richard Exp $
22

33
import re, cgi, StringIO, urllib, Cookie, time, random, csv, codecs
44

@@ -735,7 +735,7 @@ def finishRego(self):
735735
user=user, last_use=time.time())
736736
else:
737737
# new session cookie
738-
self.client.set_cookie(user)
738+
self.client.set_cookie(user, expire=None)
739739

740740
# nice message
741741
message = self._('You are now registered, welcome!')
@@ -913,7 +913,10 @@ def handle(self):
913913
self.client.opendb(self.client.user)
914914

915915
# set the session cookie
916-
self.client.set_cookie(self.client.user)
916+
if self.form.get('remember'):
917+
self.client.set_cookie(self.client.user, expire=86400*365)
918+
else:
919+
self.client.set_cookie(self.client.user, expire=None)
917920

918921
# If we came from someplace, go back there
919922
if self.form.has_key('__came_from'):

roundup/cgi/client.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.219 2006-01-25 02:59:27 richard Exp $
1+
# $Id: client.py,v 1.220 2006-02-08 03:47:28 richard Exp $
22

33
"""WWW request handler (also used in the stand-alone server).
44
"""
@@ -46,6 +46,10 @@ def clean_message_callback(match, ok={'a':1,'i':1,'b':1,'br':1}):
4646
return match.group(1)
4747
return '&lt;%s&gt;'%match.group(2)
4848

49+
error_message = '''<h1>An error has occurred</h1>
50+
<p>A problem was encountered processing your request. The tracker maintainers
51+
have been notified of the problem.</p>'''
52+
4953
class Client:
5054
'''Instantiate to handle one CGI request.
5155
@@ -302,8 +306,11 @@ def inner_main(self):
302306
self.error_message.append(self._('Form Error: ') + str(e))
303307
self.write_html(self.renderContext())
304308
except:
305-
# everything else
306-
self.write_html(cgitb.html(i18n=self.translator))
309+
if self.db.config.WEB_DEBUG:
310+
self.write_html(cgitb.html(i18n=self.translator))
311+
else:
312+
self.mailer.exception_message()
313+
return self.write_html(error_message)
307314

308315
def clean_sessions(self):
309316
"""Age sessions, remove when they haven't been used for a week.
@@ -854,9 +861,10 @@ def header(self, headers=None, response=None):
854861
for entry in headers.items():
855862
self.request.send_header(*entry)
856863
for ((path, name), (value, expire)) in self.add_cookies.items():
857-
self.request.send_header('Set-Cookie',
858-
"%s=%s; expires=%s; Path=%s;"
859-
% (name, value, Cookie._getdate(expire), path))
864+
cookie = "%s=%s; Path=%s;"%(name, value, path)
865+
if expire is not None:
866+
cookie += " expires=%s;"%Cookie._getdate(expire)
867+
self.request.send_header('Set-Cookie', cookie)
860868
self.request.end_headers()
861869
self.headers_done = 1
862870
if self.debug:
@@ -875,6 +883,7 @@ def add_cookie(self, name, value, expire=86400*365, path=None):
875883
If value is empty (meaning "delete cookie"),
876884
expiration time is forced in the past
877885
and this argument is ignored.
886+
If None, the cookie will expire at end-of-session.
878887
If omitted, the cookie will be kept for a year.
879888
path:
880889
cookie path (optional)
@@ -886,7 +895,7 @@ def add_cookie(self, name, value, expire=86400*365, path=None):
886895
expire = -1
887896
self.add_cookies[(path, name)] = (value, expire)
888897

889-
def set_cookie(self, user):
898+
def set_cookie(self, user, expire=None):
890899
"""Set up a session cookie for the user.
891900
892901
Also store away the user's login info against the session.
@@ -913,7 +922,7 @@ def set_cookie(self, user):
913922
self.db.commit()
914923

915924
# add session cookie
916-
self.add_cookie(self.cookie_name, self.session)
925+
self.add_cookie(self.cookie_name, self.session, expire=expire)
917926

918927
def make_user_anonymous(self):
919928
''' Make us anonymous

roundup/configuration.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Roundup Issue Tracker configuration support
22
#
3-
# $Id: configuration.py,v 1.32 2006-02-06 21:00:44 richard Exp $
3+
# $Id: configuration.py,v 1.33 2006-02-08 03:47:28 richard Exp $
44
#
55
__docformat__ = "restructuredtext"
66

@@ -495,9 +495,13 @@ class NullableFilePathOption(NullableOption, FilePathOption):
495495
(BooleanOption, 'use_browser_language', "yes",
496496
"Whether to use HTTP Accept-Language, if present.\n"
497497
"Browsers send a language-region preference list.\n"
498-
"It's usually set in the client's browser or in his\n"
498+
"It's usually set in the client's browser or in their\n"
499499
"Operating System.\n"
500500
"Set this option to 'no' if you want to ignore it."),
501+
(BooleanOption, "debug", "no",
502+
"Setting this option makes Roundup display error tracebacks\n"
503+
"in the user's browser rather than emailing them to the\n"
504+
"tracker admin."),
501505
)),
502506
("rdbms", (
503507
(Option, 'name', 'roundup',

roundup/mailer.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""Sending Roundup-specific mail over SMTP.
22
"""
33
__docformat__ = 'restructuredtext'
4-
# $Id: mailer.py,v 1.14 2006-02-02 04:14:29 richard Exp $
4+
# $Id: mailer.py,v 1.15 2006-02-08 03:47:28 richard Exp $
55

6-
import time, quopri, os, socket, smtplib, re
6+
import time, quopri, os, socket, smtplib, re, sys, traceback
77

88
from cStringIO import StringIO
99
from MimeWriter import MimeWriter
@@ -143,6 +143,15 @@ def bounce_message(self, bounced_message, to, error,
143143

144144
self.smtp_send(to, message)
145145

146+
def exception_message(self):
147+
'''Send a message to the admins with information about the latest
148+
traceback.
149+
'''
150+
subject = '%s: %s'%(self.config.TRACKER_NAME, sys.exc_info()[1])
151+
to = [self.config.ADMIN_EMAIL]
152+
content = traceback.format_exc()
153+
self.standard_message(to, subject, content)
154+
146155
def smtp_send(self, to, message):
147156
"""Send a message over SMTP, using roundup's config.
148157

templates/classic/html/page.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ <h2><span metal:define-slot="body_title">body title</span></h2>
100100
<input size="10" name="__login_name"><br>
101101
<input size="10" type="password" name="__login_password"><br>
102102
<input type="hidden" name="@action" value="Login">
103+
<input type="checkbox" name="remember" id="remember">
104+
<label for="remember" i18n:translate="">Remember me?</label><br>
103105
<input type="submit" value="Login" i18n:attributes="value"><br>
104106
<input type="hidden" name="__came_from" tal:attributes="value string:${request/base}${request/env/PATH_INFO}">
105107
<span tal:replace="structure request/indexargs_form" />

templates/minimal/html/page.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ <h2><span metal:define-slot="body_title">body title</span></h2>
4141
<input size="10" name="__login_name"><br>
4242
<input size="10" type="password" name="__login_password"><br>
4343
<input type="hidden" name="@action" value="Login">
44+
<input type="checkbox" name="remember" id="remember">
45+
<label for="remember" i18n:translate="">Remember me?</label><br>
4446
<input type="submit" value="Login" i18n:attributes="value">
4547
<input type="hidden" name="__came_from" tal:attributes="value string:${request/base}${request/env/PATH_INFO}">
4648
<span tal:replace="structure request/indexargs_form" />

0 commit comments

Comments
 (0)