Skip to content

Commit 25b3a0c

Browse files
author
Richard Jones
committed
handled some XXXs
1 parent d9d69d3 commit 25b3a0c

File tree

8 files changed

+97
-82
lines changed

8 files changed

+97
-82
lines changed

roundup/admin.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1818
#
19-
# $Id: admin.py,v 1.27 2002-09-10 07:07:16 richard Exp $
19+
# $Id: admin.py,v 1.28 2002-09-10 12:44:42 richard Exp $
2020

2121
import sys, os, getpass, getopt, re, UserDict, shlex, shutil
2222
try:
@@ -811,11 +811,11 @@ def do_retire(self, args):
811811

812812
def do_export(self, args):
813813
'''Usage: export [class[,class]] export_dir
814-
Export the database to tab-separated-value files.
814+
Export the database to colon-separated-value files.
815815
816816
This action exports the current data from the database into
817-
tab-separated-value files that are placed in the nominated destination
818-
directory. The journals are not exported.
817+
colon-separated-value files that are placed in the nominated
818+
destination directory. The journals are not exported.
819819
'''
820820
# we need the CSV module
821821
if csv is None:
@@ -862,9 +862,9 @@ class to import.
862862
The imported nodes will have the same nodeid as defined in the
863863
import file, thus replacing any existing content.
864864
865-
XXX The new nodes are added to the existing database - if you want to
866-
XXX create a new database using the imported data, then create a new
867-
XXX database (or, tediously, retire all the old data.)
865+
The new nodes are added to the existing database - if you want to
866+
create a new database using the imported data, then create a new
867+
database (or, tediously, retire all the old data.)
868868
'''
869869
if len(args) < 1:
870870
raise UsageError, _('Not enough arguments supplied')

roundup/backends/back_anydbm.py

Lines changed: 4 additions & 4 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: back_anydbm.py,v 1.74 2002-09-10 08:04:56 richard Exp $
18+
#$Id: back_anydbm.py,v 1.75 2002-09-10 12:44:42 richard Exp $
1919
'''
2020
This module defines a backend that saves the hyperdatabase in a database
2121
chosen by anydbm. It is guaranteed to always be available in python
@@ -1001,7 +1001,7 @@ def get(self, nodeid, propname, default=_marker, cache=1):
10011001

10021002
return d[propname]
10031003

1004-
# XXX not in spec
1004+
# not in spec
10051005
def getnode(self, nodeid, cache=1):
10061006
''' Return a convenience wrapper for the node.
10071007
@@ -1368,7 +1368,7 @@ def lookup(self, keyvalue):
13681368
cldb.close()
13691369
raise KeyError, keyvalue
13701370

1371-
# XXX: change from spec - allows multiple props to match
1371+
# change from spec - allows multiple props to match
13721372
def find(self, **propspec):
13731373
'''Get the ids of nodes in this class which link to the given nodes.
13741374
@@ -1881,7 +1881,7 @@ def index(self, nodeid):
18811881
self.db.indexer.add_text((self.classname, nodeid, 'content'), content,
18821882
mime_type)
18831883

1884-
# XXX deviation from spec - was called ItemClass
1884+
# deviation from spec - was called ItemClass
18851885
class IssueClass(Class, roundupdb.IssueClass):
18861886
# Overridden methods:
18871887
def __init__(self, db, classname, **properties):

roundup/cgi/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.26 2002-09-10 03:01:18 richard Exp $
1+
# $Id: client.py,v 1.27 2002-09-10 12:44:42 richard Exp $
22

33
__doc__ = """
44
WWW request handler (also used in the stand-alone server).
@@ -317,7 +317,7 @@ def renderTemplate(self, name, extension, **kwargs):
317317
''' Return a PageTemplate for the named page
318318
'''
319319
pt = getTemplate(self.instance.config.TEMPLATES, name, extension)
320-
# XXX handle PT rendering errors here more nicely
320+
# catch errors so we can handle PT rendering errors more nicely
321321
try:
322322
# let the template render figure stuff out
323323
return pt.render(self, None, None, **kwargs)

roundup/cgi/templating.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def __repr__(self):
222222
def __getitem__(self, item):
223223
''' return an HTMLProperty instance
224224
'''
225-
#print 'getitem', (self, item)
225+
#print 'HTMLClass.getitem', (self, item)
226226

227227
# we don't exist
228228
if item == 'id':
@@ -378,7 +378,7 @@ def __repr__(self):
378378
def __getitem__(self, item):
379379
''' return an HTMLProperty instance
380380
'''
381-
#print 'getitem', (self, item)
381+
#print 'HTMLItem.getitem', (self, item)
382382
if item == 'id':
383383
return self._nodeid
384384

@@ -411,7 +411,12 @@ def submit(self, label="Submit Changes"):
411411
return ' <input type="hidden" name=":action" value="edit">\n'\
412412
' <input type="submit" name="submit" value="%s">'%label
413413

414-
# XXX this probably should just return the history items, not the HTML
414+
def journal(self, direction='descending'):
415+
''' Return a list of HTMLJournalEntry instances.
416+
'''
417+
# XXX do this
418+
return []
419+
415420
def history(self, direction='descending'):
416421
l = ['<table class="history">'
417422
'<tr><th colspan="4" class="header">',
@@ -753,13 +758,13 @@ class LinkHTMLProperty(HTMLProperty):
753758
'''
754759
def __getattr__(self, attr):
755760
''' return a new HTMLItem '''
756-
#print 'getattr', (self, attr, self._value)
761+
#print 'Link.getattr', (self, attr, self._value)
757762
if not self._value:
758763
raise AttributeError, "Can't access missing value"
759764
if self._prop.classname == 'user':
760-
klass = HTMLItem
761-
else:
762765
klass = HTMLUser
766+
else:
767+
klass = HTMLItem
763768
i = klass(self._client, self._prop.classname, self._value)
764769
return getattr(i, attr)
765770

@@ -865,14 +870,19 @@ def __getattr__(self, attr):
865870
def __getitem__(self, num):
866871
''' iterate and return a new HTMLItem
867872
'''
868-
#print 'getitem', (self, num)
873+
#print 'Multi.getitem', (self, num)
869874
value = self._value[num]
870875
if self._prop.classname == 'user':
871876
klass = HTMLUser
872877
else:
873878
klass = HTMLItem
874879
return klass(self._client, self._prop.classname, value)
875880

881+
def __contains__(self, value):
882+
''' Support the "in" operator
883+
'''
884+
return value in self._value
885+
876886
def reverse(self):
877887
''' return the list in reverse order
878888
'''

roundup/date.py

Lines changed: 2 additions & 2 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: date.py,v 1.27 2002-09-10 01:27:13 richard Exp $
18+
# $Id: date.py,v 1.28 2002-09-10 12:44:42 richard Exp $
1919

2020
__doc__ = """
2121
Date, time and time interval handling.
@@ -153,7 +153,7 @@ def __add__(self, interval):
153153
"""
154154
return Date(self.addInterval(interval))
155155

156-
# XXX deviates from spec to allow subtraction of dates as well
156+
# deviates from spec to allow subtraction of dates as well
157157
def __sub__(self, other):
158158
""" Subtract:
159159
1. an interval from this date to produce another date.

roundup/init.py

Lines changed: 2 additions & 2 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: init.py,v 1.23 2002-09-09 23:55:19 richard Exp $
18+
# $Id: init.py,v 1.24 2002-09-10 12:44:42 richard Exp $
1919

2020
__doc__ = """
2121
Init (create) a roundup instance.
@@ -36,7 +36,7 @@ def copytree(src, dst, symlinks=0):
3636
it is false, the contents of the files pointed to by symbolic
3737
links are copied.
3838
39-
XXX copied from shutil.py in std lib
39+
This was copied from shutil.py in std lib.
4040
4141
"""
4242
names = os.listdir(src)

roundup/mailgw.py

Lines changed: 58 additions & 55 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.85 2002-09-10 03:01:18 richard Exp $
76+
$Id: mailgw.py,v 1.86 2002-09-10 12:44:42 richard Exp $
7777
'''
7878

7979
import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
@@ -391,6 +391,63 @@ def handle_message(self, message):
391391
Subject was: "%s"
392392
'''%(nodeid, subject)
393393

394+
#
395+
# handle the users
396+
#
397+
# Don't create users if anonymous isn't allowed to register
398+
create = 1
399+
anonid = self.db.user.lookup('anonymous')
400+
if not self.db.security.hasPermission('Email Registration', anonid):
401+
create = 0
402+
403+
# ok, now figure out who the author is - create a new user if the
404+
# "create" flag is true
405+
author = uidFromAddress(self.db, message.getaddrlist('from')[0],
406+
create=create)
407+
408+
# no author? means we're not author
409+
if not author:
410+
raise Unauthorized, '''
411+
You are not a registered user.
412+
413+
Unknown address: %s
414+
'''%message.getaddrlist('from')[0][1]
415+
416+
# make sure the author has permission to use the email interface
417+
if not self.db.security.hasPermission('Email Access', author):
418+
raise Unauthorized, 'You are not permitted to access this tracker.'
419+
420+
# make sure they're allowed to edit this class of information
421+
if not self.db.security.hasPermission('Edit', author, classname):
422+
raise Unauthorized, 'You are not permitted to edit %s.'%classname
423+
424+
# the author may have been created - make sure the change is
425+
# committed before we reopen the database
426+
self.db.commit()
427+
428+
# reopen the database as the author
429+
username = self.db.user.get(author, 'username')
430+
self.db = self.instance.open(username)
431+
432+
# re-get the class with the new database connection
433+
cl = self.db.getclass(classname)
434+
435+
# now update the recipients list
436+
recipients = []
437+
tracker_email = self.instance.config.TRACKER_EMAIL.lower()
438+
for recipient in message.getaddrlist('to') + message.getaddrlist('cc'):
439+
r = recipient[1].strip().lower()
440+
if r == tracker_email or not r:
441+
continue
442+
443+
# look up the recipient - create if necessary (and we're
444+
# allowed to)
445+
recipient = uidFromAddress(self.db, recipient, create)
446+
447+
# if all's well, add the recipient to the list
448+
if recipient:
449+
recipients.append(recipient)
450+
394451
#
395452
# extract the args
396453
#
@@ -521,60 +578,6 @@ def handle_message(self, message):
521578
Subject was: "%s"
522579
'''%(errors, subject)
523580

524-
#
525-
# handle the users
526-
#
527-
528-
# Don't create users if anonymous isn't allowed to register
529-
create = 1
530-
anonid = self.db.user.lookup('anonymous')
531-
if not self.db.security.hasPermission('Email Registration', anonid):
532-
create = 0
533-
534-
# ok, now figure out who the author is - create a new user if the
535-
# "create" flag is true
536-
author = uidFromAddress(self.db, message.getaddrlist('from')[0],
537-
create=create)
538-
539-
# no author? means we're not author
540-
if not author:
541-
raise Unauthorized, '''
542-
You are not a registered user.
543-
544-
Unknown address: %s
545-
'''%message.getaddrlist('from')[0][1]
546-
547-
# make sure the author has permission to use the email interface
548-
if not self.db.security.hasPermission('Email Access', author):
549-
raise Unauthorized, 'You are not permitted to access this tracker.'
550-
551-
# the author may have been created - make sure the change is
552-
# committed before we reopen the database
553-
self.db.commit()
554-
555-
# reopen the database as the author
556-
username = self.db.user.get(author, 'username')
557-
self.db = self.instance.open(username)
558-
559-
# re-get the class with the new database connection
560-
cl = self.db.getclass(classname)
561-
562-
# now update the recipients list
563-
recipients = []
564-
tracker_email = self.instance.config.TRACKER_EMAIL.lower()
565-
for recipient in message.getaddrlist('to') + message.getaddrlist('cc'):
566-
r = recipient[1].strip().lower()
567-
if r == tracker_email or not r:
568-
continue
569-
570-
# look up the recipient - create if necessary (and we're
571-
# allowed to)
572-
recipient = uidFromAddress(self.db, recipient, create)
573-
574-
# if all's well, add the recipient to the list
575-
if recipient:
576-
recipients.append(recipient)
577-
578581
#
579582
# handle message-id and in-reply-to
580583
#

roundup/roundupdb.py

Lines changed: 5 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.66 2002-09-10 03:01:18 richard Exp $
18+
# $Id: roundupdb.py,v 1.67 2002-09-10 12:44:42 richard Exp $
1919

2020
__doc__ = """
2121
Extending hyperdb with types specific to issue-tracking.
@@ -46,9 +46,11 @@ class MessageSendError(RuntimeError):
4646
pass
4747

4848
class DetectorError(RuntimeError):
49+
''' Raised by detectors that want to indicate that something's amiss
50+
'''
4951
pass
5052

51-
# XXX deviation from spec - was called ItemClass
53+
# deviation from spec - was called IssueClass
5254
class IssueClass:
5355
""" This class is intended to be mixed-in with a hyperdb backend
5456
implementation. The backend should provide a mechanism that
@@ -134,7 +136,7 @@ def nosymessage(self, nodeid, msgid, oldvalues):
134136
# send the message
135137
self.send_message(nodeid, msgid, note, sendto)
136138

137-
# XXX backwards compatibility - don't remove
139+
# backwards compatibility - don't remove
138140
sendmessage = nosymessage
139141

140142
def send_message(self, nodeid, msgid, note, sendto):

0 commit comments

Comments
 (0)