Code

be paranoid about TRACKER_WEB
[roundup.git] / roundup / roundupdb.py
index 46f383d1d386178108b65244fc613d0d127e9ef6..d59d41e64e8970f2d37d0c42a49331b0e00fa615 100644 (file)
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: roundupdb.py,v 1.102 2004-03-19 04:47:59 richard Exp $
+# $Id: roundupdb.py,v 1.106 2004-04-05 06:13:42 richard Exp $
 
 """Extending hyperdb with types specific to issue-tracking.
 """
@@ -56,7 +56,7 @@ class Database:
             # If there is no class 'user' or current user doesn't have timezone 
             # property or that property is not numeric assume he/she lives in 
             # Greenwich :)
-            timezone = 0
+            timezone = getattr(self.config, 'DEFAULT_TIMEZONE', 0)
         return timezone
 
     def confirm_registration(self, otk):
@@ -338,18 +338,19 @@ class IssueClass:
         base = self.db.config.TRACKER_WEB 
         if (not isinstance(base , type('')) or
             not (base.startswith('http://') or base.startswith('https://'))):
-            base = "Configuration Error: TRACKER_WEB isn't a " \
+            web = "Configuration Error: TRACKER_WEB isn't a " \
                 "fully-qualified URL"
-        elif base[-1] != '/' :
-            base += '/'
-        web = base + self.classname + nodeid
+        else:
+            if not base.endswith('/'):
+                base = base + '/'
+            web = base + self.classname + nodeid
 
         # ensure the email address is properly quoted
         email = straddr((self.db.config.TRACKER_NAME,
             self.db.config.TRACKER_EMAIL))
 
         line = '_' * max(len(web)+2, len(email))
-        return '%s\n%s\n<%s>\n%s'%(line, email, web, line)
+        return '\n%s\n%s\n<%s>\n%s'%(line, email, web, line)
 
 
     def generateCreateNote(self, nodeid):