Skip to content

Commit a7c3bd2

Browse files
author
Roche Compaan
committed
Features added:
. Multilink properties are now displayed as comma separated values in a textbox . The add user link is now only visible to the admin user . Modified the mail gateway to reject submissions from unknown addresses if ANONYMOUS_ACCESS is denied
1 parent 401f8e3 commit a7c3bd2

File tree

6 files changed

+110
-26
lines changed

6 files changed

+110
-26
lines changed

roundup/cgi_client.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: cgi_client.py,v 1.85 2001-12-20 06:13:24 rochecompaan Exp $
18+
# $Id: cgi_client.py,v 1.86 2001-12-20 15:43:01 rochecompaan Exp $
1919

2020
__doc__ = """
2121
WWW request handler (also used in the stand-alone server).
@@ -120,10 +120,16 @@ def pagehead(self, title, message=None):
120120
else:
121121
user_info = _('<a href="login">Login</a>')
122122
if self.user is not None:
123-
add_links = _('''
123+
if self.user == 'admin':
124+
add_links = _('''
124125
| Add
125126
<a href="newissue">Issue</a>,
126127
<a href="newuser">User</a>
128+
''')
129+
else:
130+
add_links = _('''
131+
| Add
132+
<a href="newissue">Issue</a>
127133
''')
128134
else:
129135
add_links = ''
@@ -1059,11 +1065,18 @@ def pagehead(self, title, message=None):
10591065
else:
10601066
user_info = _('<a href="login">Login</a>')
10611067
if self.user is not None:
1062-
add_links = _('''
1068+
if self.user == 'admin':
1069+
add_links = _('''
10631070
| Add
10641071
<a href="newissue">Issue</a>,
10651072
<a href="newsupport">Support</a>,
10661073
<a href="newuser">User</a>
1074+
''')
1075+
else:
1076+
add_links = _('''
1077+
| Add
1078+
<a href="newissue">Issue</a>,
1079+
<a href="newsupport">Support</a>,
10671080
''')
10681081
else:
10691082
add_links = ''
@@ -1163,6 +1176,16 @@ def parsePropsFromForm(db, cl, form, nodeid=0):
11631176

11641177
#
11651178
# $Log: not supported by cvs2svn $
1179+
# Revision 1.85 2001/12/20 06:13:24 rochecompaan
1180+
# Bugs fixed:
1181+
# . Exception handling in hyperdb for strings-that-look-like numbers got
1182+
# lost somewhere
1183+
# . Internet Explorer submits full path for filename - we now strip away
1184+
# the path
1185+
# Features added:
1186+
# . Link and multilink properties are now displayed sorted in the cgi
1187+
# interface
1188+
#
11661189
# Revision 1.84 2001/12/18 15:30:30 rochecompaan
11671190
# Fixed bugs:
11681191
# . Fixed file creation and retrieval in same transaction in anydbm

roundup/htmltemplate.py

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: htmltemplate.py,v 1.48 2001-12-20 06:13:24 rochecompaan Exp $
18+
# $Id: htmltemplate.py,v 1.49 2001-12-20 15:43:01 rochecompaan Exp $
1919

2020
__doc__ = """
2121
Template engine.
@@ -178,23 +178,24 @@ def sortfunc(a, b, cl=linkcl):
178178
elif isinstance(propclass, hyperdb.Multilink):
179179
list = linkcl.list()
180180
list.sort(sortfunc)
181-
height = height or min(len(list), 7)
182-
l = ['<select multiple name="%s" size="%s">'%(property, height)]
183181
k = linkcl.labelprop()
184-
for optionid in list:
185-
option = linkcl.get(optionid, k)
186-
s = ''
187-
if optionid in value:
188-
s = 'selected '
189-
if showid:
190-
lab = '%s%s: %s'%(propclass.classname, optionid, option)
182+
l = []
183+
# special treatment for nosy list
184+
if property == 'nosy':
185+
input_value = []
186+
else:
187+
input_value = value
188+
for v in value:
189+
lab = linkcl.get(v, k)
190+
if property != 'nosy':
191+
l.append('<a href="issue%s">%s: %s</a>'%(v,v,lab))
191192
else:
192-
lab = option
193-
if size is not None and len(lab) > size:
194-
lab = lab[:size-3] + '...'
195-
l.append('<option %svalue="%s">%s</option>'%(s, optionid, lab))
196-
l.append('</select>')
197-
s = '\n'.join(l)
193+
input_value.append(lab)
194+
if size is None:
195+
size = '10'
196+
l.insert(0,'<input name="%s" size="%s" value="%s">'%(property,
197+
size, ','.join(input_value)))
198+
s = "<br>\n".join(l)
198199
else:
199200
s = 'Plain: bad propclass "%s"'%propclass
200201
return s
@@ -884,6 +885,16 @@ def render(self, form):
884885

885886
#
886887
# $Log: not supported by cvs2svn $
888+
# Revision 1.48 2001/12/20 06:13:24 rochecompaan
889+
# Bugs fixed:
890+
# . Exception handling in hyperdb for strings-that-look-like numbers got
891+
# lost somewhere
892+
# . Internet Explorer submits full path for filename - we now strip away
893+
# the path
894+
# Features added:
895+
# . Link and multilink properties are now displayed sorted in the cgi
896+
# interface
897+
#
887898
# Revision 1.47 2001/11/26 22:55:56 richard
888899
# Feature:
889900
# . Added INSTANCE_NAME to configuration - used in web and email to identify

roundup/mailgw.py

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class node. Any parts of other types are each stored in separate files
7373
an exception, the original message is bounced back to the sender with the
7474
explanatory message given in the exception.
7575
76-
$Id: mailgw.py,v 1.44 2001-12-18 15:30:34 rochecompaan Exp $
76+
$Id: mailgw.py,v 1.45 2001-12-20 15:43:01 rochecompaan Exp $
7777
'''
7878

7979

@@ -87,6 +87,9 @@ class MailGWError(ValueError):
8787
class MailUsageError(ValueError):
8888
pass
8989

90+
class UnAuthorized(Exception):
91+
""" Access denied """
92+
9093
class Message(mimetools.Message):
9194
''' subclass mimetools.Message so we can retrieve the parts of the
9295
message...
@@ -148,6 +151,12 @@ def handle_Message(self, message):
148151
m.append('\n\nMail Gateway Help\n=================')
149152
m.append(fulldoc)
150153
m = self.bounce_message(message, sendto, m)
154+
except UnAuthorized, value:
155+
# just inform the user that he is not authorized
156+
sendto = [sendto[0][1]]
157+
m = ['']
158+
m.append(str(value))
159+
m = self.bounce_message(message, sendto, m)
151160
except:
152161
# bounce the message back to the sender with the error message
153162
sendto = [sendto[0][1]]
@@ -366,7 +375,21 @@ def handle_message(self, message):
366375
#
367376
# handle the users
368377
#
369-
author = self.db.uidFromAddress(message.getaddrlist('from')[0])
378+
379+
# Don't create users if ANONYMOUS_ACCESS is denied
380+
if self.ANONYMOUS_ACCESS == 'deny':
381+
create = 0
382+
else:
383+
create = 1
384+
author = self.db.uidFromAddress(message.getaddrlist('from')[0],
385+
create=create)
386+
if not author:
387+
raise UnAuthorized, '''
388+
You are not a registered user.
389+
390+
Unknown address: %s
391+
'''%message.getaddrlist('from')[0][1]
392+
370393
# reopen the database as the author
371394
username = self.db.user.get(author, 'username')
372395
self.db = self.instance.open(username)
@@ -638,6 +661,15 @@ def parseContent(content, blank_line=re.compile(r'[\r\n]+\s*[\r\n]+'),
638661

639662
#
640663
# $Log: not supported by cvs2svn $
664+
# Revision 1.44 2001/12/18 15:30:34 rochecompaan
665+
# Fixed bugs:
666+
# . Fixed file creation and retrieval in same transaction in anydbm
667+
# backend
668+
# . Cgi interface now renders new issue after issue creation
669+
# . Could not set issue status to resolved through cgi interface
670+
# . Mail gateway was changing status back to 'chatting' if status was
671+
# omitted as an argument
672+
#
641673
# Revision 1.43 2001/12/15 19:39:01 rochecompaan
642674
# Oops.
643675
#

roundup/roundupdb.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: roundupdb.py,v 1.34 2001-12-17 03:52:48 richard Exp $
18+
# $Id: roundupdb.py,v 1.35 2001-12-20 15:43:01 rochecompaan Exp $
1919

2020
__doc__ = """
2121
Extending hyperdb with types specific to issue-tracking.
@@ -71,8 +71,11 @@ def uidFromAddress(self, address, create=1):
7171
users = self.user.stringFind(username=address)
7272

7373
# couldn't match address or username, so create a new user
74-
return self.user.create(username=address, address=address,
75-
realname=realname)
74+
if create:
75+
return self.user.create(username=address, address=address,
76+
realname=realname)
77+
else:
78+
return 0
7679

7780
_marker = []
7881
# XXX: added the 'creator' faked attribute
@@ -492,6 +495,13 @@ def generateChangeNote(self, nodeid, oldvalues):
492495

493496
#
494497
# $Log: not supported by cvs2svn $
498+
# Revision 1.34 2001/12/17 03:52:48 richard
499+
# Implemented file store rollback. As a bonus, the hyperdb is now capable of
500+
# storing more than one file per node - if a property name is supplied,
501+
# the file is called designator.property.
502+
# I decided not to migrate the existing files stored over to the new naming
503+
# scheme - the FileClass just doesn't specify the property name.
504+
#
495505
# Revision 1.33 2001/12/16 10:53:37 richard
496506
# take a copy of the node dict so that the subsequent set
497507
# operation doesn't modify the oldvalues structure

roundup/templates/classic/interfaces.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: interfaces.py,v 1.9 2001-11-26 23:00:53 richard Exp $
18+
# $Id: interfaces.py,v 1.10 2001-12-20 15:43:01 rochecompaan Exp $
1919

2020
import instance_config
2121
from roundup import cgi_client, mailgw
@@ -38,9 +38,13 @@ class MailGW(mailgw.MailGW):
3838
ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL
3939
ADMIN_EMAIL = instance_config.ADMIN_EMAIL
4040
MAILHOST = instance_config.MAILHOST
41+
ANONYMOUS_ACCESS = instance_config.ANONYMOUS_ACCESS
4142

4243
#
4344
# $Log: not supported by cvs2svn $
45+
# Revision 1.9 2001/11/26 23:00:53 richard
46+
# This config stuff is getting to be a real mess...
47+
#
4448
# Revision 1.8 2001/10/22 03:25:01 richard
4549
# Added configuration for:
4650
# . anonymous user access and registration (deny/allow)

roundup/templates/extended/interfaces.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: interfaces.py,v 1.13 2001-11-26 23:00:53 richard Exp $
18+
# $Id: interfaces.py,v 1.14 2001-12-20 15:43:01 rochecompaan Exp $
1919

2020
import instance_config
2121
from roundup import cgi_client, mailgw
@@ -38,9 +38,13 @@ class MailGW(mailgw.MailGW):
3838
ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL
3939
ADMIN_EMAIL = instance_config.ADMIN_EMAIL
4040
MAILHOST = instance_config.MAILHOST
41+
ANONYMOUS_ACCESS = instance_config.ANONYMOUS_ACCESS
4142

4243
#
4344
# $Log: not supported by cvs2svn $
45+
# Revision 1.13 2001/11/26 23:00:53 richard
46+
# This config stuff is getting to be a real mess...
47+
#
4448
# Revision 1.12 2001/10/22 03:25:01 richard
4549
# Added configuration for:
4650
# . anonymous user access and registration (deny/allow)

0 commit comments

Comments
 (0)