Code

. Alternate email addresses are now available for users. See the MIGRATION
[roundup.git] / roundup / templates / classic / dbinit.py
index 7bc71cc066974dcc05360dc50a53b90d857af39a..e95104b1ba9ddd959efd2fba0e8d4e62a9f9b59a 100644 (file)
@@ -1,9 +1,26 @@
-# $Id: dbinit.py,v 1.3 2001-07-24 10:46:22 anthonybaxter Exp $
+#
+# Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
+# This module is free software, and you may redistribute it and/or modify
+# under the same terms as Python, so long as this copyright message and
+# disclaimer are retained in their original form.
+#
+# IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
+# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
+# OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE.  THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
+# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
+# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+# 
+# $Id: dbinit.py,v 1.15 2002-02-15 07:08:44 richard Exp $
 
 import os
 
 import instance_config
-from roundup import roundupdb, cgi_client, mailgw 
+from roundup import roundupdb
 import select_db
 
 from roundup.roundupdb import Class, FileClass
@@ -18,19 +35,17 @@ class Database(roundupdb.Database, select_db.Database):
 class IssueClass(roundupdb.IssueClass):
     ''' issues need the email information
     '''
-    ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL
-    ADMIN_EMAIL = instance_config.ADMIN_EMAIL
-    MAILHOST = instance_config.MAILHOST
+    pass
 
  
 def open(name=None):
     ''' as from the roundupdb method openDB 
  
     ''' 
-    from roundup.hyperdb import String, Date, Link, Multilink
+    from roundup.hyperdb import String, Password, Date, Link, Multilink
 
     # open the database
-    db = Database(instance_config.DATABASE, name)
+    db = Database(instance_config, name)
 
     # Now initialise the schema. Must do this each time.
     pri = Class(db, "priority", 
@@ -46,15 +61,17 @@ def open(name=None):
     keyword.setkey("name")
 
     user = Class(db, "user", 
-                    username=String(),   password=String(),
+                    username=String(),   password=Password(),
                     address=String(),    realname=String(), 
-                    phone=String(),      organisation=String())
+                    phone=String(),      organisation=String(),
+                    alternate_addresses=String())
     user.setkey("username")
 
     msg = FileClass(db, "msg", 
                     author=Link("user"), recipients=Multilink("user"), 
                     date=Date(),         summary=String(), 
-                    files=Multilink("file"))
+                    files=Multilink("file"),
+                    messageid=String(),  inreplyto=String())
 
     file = FileClass(db, "file", 
                     name=String(),       type=String())
@@ -102,11 +119,103 @@ def init(adminpw):
     user = db.getclass('user')
     user.create(username="admin", password=adminpw, 
                                   address=instance_config.ADMIN_EMAIL)
-
-    db.close()
+    db.commit()
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.14  2002/01/14 02:20:15  richard
+#  . changed all config accesses so they access either the instance or the
+#    config attriubute on the db. This means that all config is obtained from
+#    instance_config instead of the mish-mash of classes. This will make
+#    switching to a ConfigParser setup easier too, I hope.
+#
+# At a minimum, this makes migration a _little_ easier (a lot easier in the
+# 0.5.0 switch, I hope!)
+#
+# Revision 1.13  2002/01/02 02:31:38  richard
+# Sorry for the huge checkin message - I was only intending to implement #496356
+# but I found a number of places where things had been broken by transactions:
+#  . modified ROUNDUPDBSENDMAILDEBUG to be SENDMAILDEBUG and hold a filename
+#    for _all_ roundup-generated smtp messages to be sent to.
+#  . the transaction cache had broken the roundupdb.Class set() reactors
+#  . newly-created author users in the mailgw weren't being committed to the db
+#
+# Stuff that made it into CHANGES.txt (ie. the stuff I was actually working
+# on when I found that stuff :):
+#  . #496356 ] Use threading in messages
+#  . detectors were being registered multiple times
+#  . added tests for mailgw
+#  . much better attaching of erroneous messages in the mail gateway
+#
+# Revision 1.12  2001/12/02 05:06:16  richard
+# . We now use weakrefs in the Classes to keep the database reference, so
+#   the close() method on the database is no longer needed.
+#   I bumped the minimum python requirement up to 2.1 accordingly.
+# . #487480 ] roundup-server
+# . #487476 ] INSTALL.txt
+#
+# I also cleaned up the change message / post-edit stuff in the cgi client.
+# There's now a clearly marked "TODO: append the change note" where I believe
+# the change note should be added there. The "changes" list will obviously
+# have to be modified to be a dict of the changes, or somesuch.
+#
+# More testing needed.
+#
+# Revision 1.11  2001/12/01 07:17:50  richard
+# . We now have basic transaction support! Information is only written to
+#   the database when the commit() method is called. Only the anydbm
+#   backend is modified in this way - neither of the bsddb backends have been.
+#   The mail, admin and cgi interfaces all use commit (except the admin tool
+#   doesn't have a commit command, so interactive users can't commit...)
+# . Fixed login/registration forwarding the user to the right page (or not,
+#   on a failure)
+#
+# Revision 1.10  2001/11/26 22:55:56  richard
+# Feature:
+#  . Added INSTANCE_NAME to configuration - used in web and email to identify
+#    the instance.
+#  . Added EMAIL_SIGNATURE_POSITION to indicate where to place the roundup
+#    signature info in e-mails.
+#  . Some more flexibility in the mail gateway and more error handling.
+#  . Login now takes you to the page you back to the were denied access to.
+#
+# Fixed:
+#  . Lots of bugs, thanks Roché and others on the devel mailing list!
+#
+# Revision 1.9  2001/10/30 00:54:45  richard
+# Features:
+#  . #467129 ] Lossage when username=e-mail-address
+#  . #473123 ] Change message generation for author
+#  . MailGW now moves 'resolved' to 'chatting' on receiving e-mail for an issue.
+#
+# Revision 1.8  2001/10/09 07:25:59  richard
+# Added the Password property type. See "pydoc roundup.password" for
+# implementation details. Have updated some of the documentation too.
+#
+# Revision 1.7  2001/08/07 00:24:43  richard
+# stupid typo
+#
+# Revision 1.6  2001/08/07 00:15:51  richard
+# Added the copyright/license notice to (nearly) all files at request of
+# Bizar Software.
+#
+# Revision 1.5  2001/08/02 06:38:17  richard
+# Roundupdb now appends "mailing list" information to its messages which
+# include the e-mail address and web interface address. Templates may
+# override this in their db classes to include specific information (support
+# instructions, etc).
+#
+# Revision 1.4  2001/07/29 07:01:39  richard
+# Added vim command to all source so that we don't get no steenkin' tabs :)
+#
+# Revision 1.3  2001/07/24 10:46:22  anthonybaxter
+# Added templatebuilder module. two functions - one to pack up the html base,
+# one to unpack it. Packed up the two standard templates into htmlbases.
+# Modified __init__ to install them.
+#
+# __init__.py magic was needed for the rather high levels of wierd import magic.
+# Reducing level of import magic == (good, future)
+#
 # Revision 1.2  2001/07/24 01:06:43  richard
 # Oops - accidentally duped the keywords class
 #
@@ -134,5 +243,5 @@ def init(adminpw):
 # Final commit of Grande Splite
 #
 #
-
+# vim: set filetype=python ts=4 sw=4 et si