Code

be paranoid about TRACKER_WEB
[roundup.git] / roundup / roundupdb.py
index ddaf4dd2979b3ca4a3b0770a38213e600648a0d8..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.99 2004-02-29 00:35:55 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,11 +56,11 @@ 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):
-        props = self.otks.getall(otk)
+        props = self.getOTKManager().getall(otk)
         for propname, proptype in self.user.getprops().items():
             value = props.get(propname, None)
             if value is None:
@@ -80,10 +80,9 @@ class Database:
         cl = self.user
       
         props['roles'] = self.config.NEW_WEB_USER_ROLES
-        del props['__time']
         userid = cl.create(**props)
         # clear the props from the otk database
-        self.otks.destroy(otk)
+        self.getOTKManager().destroy(otk)
         self.commit()
         
         return userid
@@ -149,14 +148,14 @@ class IssueClass:
             if address:
                 sendto.append(address)
                 recipients.append(userid)
-        
+
         def good_recipient(userid):
             # Make sure we don't send mail to either the anonymous
             # user or a user who has already seen the message.
             return (userid and
                     (self.db.user.get(userid, 'username') != 'anonymous') and
                     not seen_message.has_key(userid))
-        
+
         # possibly send the message to the author, as long as they aren't
         # anonymous
         if (good_recipient(authid) and
@@ -339,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):
@@ -408,7 +408,7 @@ class IssueClass:
         for key in oldvalues.keys():
             if key in ['files','messages']:
                 continue
-            if key in ('activity', 'creator', 'creation'):
+            if key in ('actor', 'activity', 'creator', 'creation'):
                 continue
             # not all keys from oldvalues might be available in database
             # this happens when property was deleted