Mercurial > p > roundup > code
comparison roundup/templates/classic/dbinit.py @ 748:2e70123bbf5a
Added commentage to the dbinit files to help people with their customisation.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 24 May 2002 04:03:23 +0000 |
| parents | bb52c1419b4c |
| children | 0779ea9f1f18 |
comparison
equal
deleted
inserted
replaced
| 747:3c1cb2021b5e | 748:2e70123bbf5a |
|---|---|
| 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.16 2002-02-16 08:06:14 richard Exp $ | 18 # $Id: dbinit.py,v 1.17 2002-05-24 04:03:23 richard 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 |
| 45 from roundup.hyperdb import String, Password, Date, Link, Multilink | 45 from roundup.hyperdb import String, Password, Date, Link, Multilink |
| 46 | 46 |
| 47 # open the database | 47 # open the database |
| 48 db = Database(instance_config, name) | 48 db = Database(instance_config, name) |
| 49 | 49 |
| 50 # Now initialise the schema. Must do this each time. | 50 # |
| 51 # Now initialise the schema. Must do this each time the database is | |
| 52 # opened. | |
| 53 # | |
| 54 | |
| 55 # Class automatically gets these properties: | |
| 56 # creation = Date() | |
| 57 # activity = Date() | |
| 58 # creator = Link('user') | |
| 51 pri = Class(db, "priority", | 59 pri = Class(db, "priority", |
| 52 name=String(), order=String()) | 60 name=String(), order=String()) |
| 53 pri.setkey("name") | 61 pri.setkey("name") |
| 54 | 62 |
| 55 stat = Class(db, "status", | 63 stat = Class(db, "status", |
| 65 address=String(), realname=String(), | 73 address=String(), realname=String(), |
| 66 phone=String(), organisation=String(), | 74 phone=String(), organisation=String(), |
| 67 alternate_addresses=String()) | 75 alternate_addresses=String()) |
| 68 user.setkey("username") | 76 user.setkey("username") |
| 69 | 77 |
| 78 # FileClass automatically gets these properties: | |
| 79 # content = String() [saved to disk in <instance home>/db/files/] | |
| 80 # (it also gets the Class properties creation, activity and creator) | |
| 70 msg = FileClass(db, "msg", | 81 msg = FileClass(db, "msg", |
| 71 author=Link("user"), recipients=Multilink("user"), | 82 author=Link("user"), recipients=Multilink("user"), |
| 72 date=Date(), summary=String(), | 83 date=Date(), summary=String(), |
| 73 files=Multilink("file"), | 84 files=Multilink("file"), |
| 74 messageid=String(), inreplyto=String()) | 85 messageid=String(), inreplyto=String()) |
| 75 | 86 |
| 76 file = FileClass(db, "file", | 87 file = FileClass(db, "file", |
| 77 name=String(), type=String()) | 88 name=String(), type=String()) |
| 78 | 89 |
| 90 # IssueClass automatically gets these properties: | |
| 91 # title = String() | |
| 92 # messages = Multilink("msg") | |
| 93 # files = Multilink("file") | |
| 94 # nosy = Multilink("user") | |
| 95 # superseder = Multilink("issue") | |
| 96 # (it also gets the Class properties creation, activity and creator) | |
| 79 issue = IssueClass(db, "issue", | 97 issue = IssueClass(db, "issue", |
| 80 assignedto=Link("user"), topic=Multilink("keyword"), | 98 assignedto=Link("user"), topic=Multilink("keyword"), |
| 81 priority=Link("priority"), status=Link("status")) | 99 priority=Link("priority"), status=Link("status")) |
| 82 | 100 |
| 83 import detectors | 101 import detectors |
| 86 return db | 104 return db |
| 87 | 105 |
| 88 def init(adminpw): | 106 def init(adminpw): |
| 89 ''' as from the roundupdb method initDB | 107 ''' as from the roundupdb method initDB |
| 90 | 108 |
| 91 Open the new database, and set up a bunch of attributes. | 109 Open the new database, and add new nodes - used for initialisation. You |
| 92 | 110 can edit this before running the "roundup-admin initialise" command to |
| 111 change the initial database entries. | |
| 93 ''' | 112 ''' |
| 94 dbdir = os.path.join(instance_config.DATABASE, 'files') | 113 dbdir = os.path.join(instance_config.DATABASE, 'files') |
| 95 if not os.path.isdir(dbdir): | 114 if not os.path.isdir(dbdir): |
| 96 os.makedirs(dbdir) | 115 os.makedirs(dbdir) |
| 97 | 116 |
| 120 address=instance_config.ADMIN_EMAIL) | 139 address=instance_config.ADMIN_EMAIL) |
| 121 db.commit() | 140 db.commit() |
| 122 | 141 |
| 123 # | 142 # |
| 124 # $Log: not supported by cvs2svn $ | 143 # $Log: not supported by cvs2svn $ |
| 144 # Revision 1.16 2002/02/16 08:06:14 richard | |
| 145 # Removed the key property restriction on title of the classic issue class. | |
| 146 # | |
| 125 # Revision 1.15 2002/02/15 07:08:44 richard | 147 # Revision 1.15 2002/02/15 07:08:44 richard |
| 126 # . Alternate email addresses are now available for users. See the MIGRATION | 148 # . Alternate email addresses are now available for users. See the MIGRATION |
| 127 # file for info on how to activate the feature. | 149 # file for info on how to activate the feature. |
| 128 # | 150 # |
| 129 # Revision 1.14 2002/01/14 02:20:15 richard | 151 # Revision 1.14 2002/01/14 02:20:15 richard |
