Mercurial > p > roundup > code
comparison roundup/templates/classic/dbinit.py @ 480:a5cd27d33516 config-0-4-0-branch
Initial ConfigParser implementation.
| author | Titus Brown <titus@users.sourceforge.net> |
|---|---|
| date | Thu, 03 Jan 2002 02:12:05 +0000 |
| parents | a1a44636bace |
| children | c242455d9b46 |
comparison
equal
deleted
inserted
replaced
| 479:a038b872ab8b | 480:a5cd27d33516 |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: dbinit.py,v 1.13 2002-01-02 02:31:38 richard Exp $ | 18 # $Id: dbinit.py,v 1.13.2.1 2002-01-03 02:12:05 titus Exp $ |
| 19 | 19 |
| 20 import os | 20 import os |
| 21 | 21 |
| 22 import instance_config | 22 import instance_config |
| 23 from roundup import roundupdb | 23 from roundup import roundupdb |
| 49 | 49 |
| 50 ''' | 50 ''' |
| 51 from roundup.hyperdb import String, Password, Date, Link, Multilink | 51 from roundup.hyperdb import String, Password, Date, Link, Multilink |
| 52 | 52 |
| 53 # open the database | 53 # open the database |
| 54 db = Database(instance_config.DATABASE, name) | 54 db = Database(instance_config.get_default_database_dir(), name) |
| 55 | 55 |
| 56 # Now initialise the schema. Must do this each time. | 56 # Now initialise the schema. Must do this each time. |
| 57 pri = Class(db, "priority", | 57 pri = Class(db, "priority", |
| 58 name=String(), order=String()) | 58 name=String(), order=String()) |
| 59 pri.setkey("name") | 59 pri.setkey("name") |
| 95 ''' as from the roundupdb method initDB | 95 ''' as from the roundupdb method initDB |
| 96 | 96 |
| 97 Open the new database, and set up a bunch of attributes. | 97 Open the new database, and set up a bunch of attributes. |
| 98 | 98 |
| 99 ''' | 99 ''' |
| 100 dbdir = os.path.join(instance_config.DATABASE, 'files') | 100 dbdir = os.path.join(instance_config.get_default_database_dir(), 'files') |
| 101 if not os.path.isdir(dbdir): | 101 if not os.path.isdir(dbdir): |
| 102 os.makedirs(dbdir) | 102 os.makedirs(dbdir) |
| 103 | 103 |
| 104 db = open("admin") | 104 db = open("admin") |
| 105 db.clear() | 105 db.clear() |
| 121 stat.create(name="done-cbb", order="7") | 121 stat.create(name="done-cbb", order="7") |
| 122 stat.create(name="resolved", order="8") | 122 stat.create(name="resolved", order="8") |
| 123 | 123 |
| 124 user = db.getclass('user') | 124 user = db.getclass('user') |
| 125 user.create(username="admin", password=adminpw, | 125 user.create(username="admin", password=adminpw, |
| 126 address=instance_config.ADMIN_EMAIL) | 126 address=instance_config.get_default_admin_email()) |
| 127 db.commit() | 127 db.commit() |
| 128 | 128 |
| 129 # | 129 # |
| 130 # $Log: not supported by cvs2svn $ | 130 # $Log: not supported by cvs2svn $ |
| 131 # Revision 1.13 2002/01/02 02:31:38 richard | |
| 132 # Sorry for the huge checkin message - I was only intending to implement #496356 | |
| 133 # but I found a number of places where things had been broken by transactions: | |
| 134 # . modified ROUNDUPDBSENDMAILDEBUG to be SENDMAILDEBUG and hold a filename | |
| 135 # for _all_ roundup-generated smtp messages to be sent to. | |
| 136 # . the transaction cache had broken the roundupdb.Class set() reactors | |
| 137 # . newly-created author users in the mailgw weren't being committed to the db | |
| 138 # | |
| 139 # Stuff that made it into CHANGES.txt (ie. the stuff I was actually working | |
| 140 # on when I found that stuff :): | |
| 141 # . #496356 ] Use threading in messages | |
| 142 # . detectors were being registered multiple times | |
| 143 # . added tests for mailgw | |
| 144 # . much better attaching of erroneous messages in the mail gateway | |
| 145 # | |
| 131 # Revision 1.12 2001/12/02 05:06:16 richard | 146 # Revision 1.12 2001/12/02 05:06:16 richard |
| 132 # . We now use weakrefs in the Classes to keep the database reference, so | 147 # . We now use weakrefs in the Classes to keep the database reference, so |
| 133 # the close() method on the database is no longer needed. | 148 # the close() method on the database is no longer needed. |
| 134 # I bumped the minimum python requirement up to 2.1 accordingly. | 149 # I bumped the minimum python requirement up to 2.1 accordingly. |
| 135 # . #487480 ] roundup-server | 150 # . #487480 ] roundup-server |
