|
15 | 15 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
16 | 16 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
17 | 17 | # |
18 | | -# $Id: roundupdb.py,v 1.57 2002-06-15 15:49:29 dman13 Exp $ |
| 18 | +# $Id: roundupdb.py,v 1.58 2002-06-16 01:05:15 dman13 Exp $ |
19 | 19 |
|
20 | 20 | __doc__ = """ |
21 | 21 | Extending hyperdb with types specific to issue-tracking. |
@@ -521,9 +521,7 @@ def email_signature(self, nodeid, msgid): |
521 | 521 | # simplistic check to see if the url is valid, |
522 | 522 | # then append a trailing slash if it is missing |
523 | 523 | base = self.db.config.ISSUE_TRACKER_WEB |
524 | | - # Oops, can't do this in python2.1 |
525 | | - #if not isinstance( base , "" ) or not base.startswith( "http://" ) : |
526 | | - if type(base) != type("") or not base.startswith( "http://" ) : |
| 524 | + if not isinstance( base , type('') ) or not base.startswith( "http://" ) : |
527 | 525 | base = "Configuration Error: ISSUE_TRACKER_WEB isn't a fully-qualified URL" |
528 | 526 | elif base[-1] != '/' : |
529 | 527 | base += '/' |
@@ -578,23 +576,18 @@ def generateCreateNote(self, nodeid): |
578 | 576 | def generateChangeNote(self, nodeid, oldvalues): |
579 | 577 | """Generate a change note that lists property changes |
580 | 578 | """ |
| 579 | + |
| 580 | + if __debug__ : |
| 581 | + if not isinstance( oldvalues , type({}) ) : |
| 582 | + raise TypeError( |
| 583 | + "'oldvalues' must be dict-like, not %s." |
| 584 | + % str(type(oldvalues)) ) |
| 585 | + |
581 | 586 | cn = self.classname |
582 | 587 | cl = self.db.classes[cn] |
583 | 588 | changed = {} |
584 | 589 | props = cl.getprops(protected=0) |
585 | 590 |
|
586 | | - # XXX DSH |
587 | | - # Temporary work-around to prevent crashes and allow the issue to be |
588 | | - # submitted. |
589 | | - try : |
590 | | - oldvalues.keys |
591 | | - except AttributeError : |
592 | | - # The arg isn't a dict. Precondition/interface violation. |
593 | | - return '\n'.join( |
594 | | - ('', '-'*10, |
595 | | - "Precondition/interface Error -- 'oldvalues' isn't a dict." , |
596 | | - '-'*10 , '' , str(oldvalues) ) ) |
597 | | - |
598 | 591 | # determine what changed |
599 | 592 | for key in oldvalues.keys(): |
600 | 593 | if key in ['files','messages']: continue |
@@ -666,6 +659,12 @@ def generateChangeNote(self, nodeid, oldvalues): |
666 | 659 |
|
667 | 660 | # |
668 | 661 | # $Log: not supported by cvs2svn $ |
| 662 | +# Revision 1.57 2002/06/15 15:49:29 dman13 |
| 663 | +# Use 'email' instead of 'rfc822', if available. |
| 664 | +# Don't use isinstance() on a string (not allowed in python 2.1). |
| 665 | +# Return an error message instead of crashing if 'oldvalues' isn't a |
| 666 | +# dict (in generateChangeNote). |
| 667 | +# |
669 | 668 | # Revision 1.56 2002/06/14 03:54:21 dman13 |
670 | 669 | # #565992 ] if ISSUE_TRACKER_WEB doesn't have the trailing '/', add it |
671 | 670 | # |
@@ -856,7 +855,7 @@ def generateChangeNote(self, nodeid, oldvalues): |
856 | 855 | # . Login now takes you to the page you back to the were denied access to. |
857 | 856 | # |
858 | 857 | # Fixed: |
859 | | -# . Lots of bugs, thanks Roché and others on the devel mailing list! |
| 858 | +# . Lots of bugs, thanks Roché and others on the devel mailing list! |
860 | 859 | # |
861 | 860 | # Revision 1.20 2001/11/25 10:11:14 jhermann |
862 | 861 | # Typo fix |
|
0 commit comments