comparison roundup/templates/extended/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 edd210915e64
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.20 2002-02-15 07:08:44 richard Exp $ 18 # $Id: dbinit.py,v 1.21 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())
95 106
96 timelog = Class(db, "timelog", 107 timelog = Class(db, "timelog",
97 date=Date(), time=String(), 108 date=Date(), time=String(),
98 performedby=Link("user"), description=String()) 109 performedby=Link("user"), description=String())
99 110
111 # IssueClass automatically gets these properties:
112 # title = String()
113 # messages = Multilink("msg")
114 # files = Multilink("file")
115 # nosy = Multilink("user")
116 # superseder = Multilink("issue")
117 # (it also gets the Class properties creation, activity and creator)
100 support = IssueClass(db, "support", 118 support = IssueClass(db, "support",
101 assignedto=Link("user"), status=Link("status"), 119 assignedto=Link("user"), status=Link("status"),
102 rate=Link("rate"), source=Link("source"), 120 rate=Link("rate"), source=Link("source"),
103 product=Link("product"), platform=Multilink("platform"), 121 product=Link("product"), platform=Multilink("platform"),
104 version=String(), timelog=Multilink("timelog"), 122 version=String(), timelog=Multilink("timelog"),
116 return db 134 return db
117 135
118 def init(adminpw): 136 def init(adminpw):
119 ''' as from the roundupdb method initDB 137 ''' as from the roundupdb method initDB
120 138
121 Open the new database, and set up a bunch of attributes. 139 Open the new database, and add new nodes - used for initialisation. You
122 140 can edit this before running the "roundup-admin initialise" command to
141 change the initial database entries.
123 ''' 142 '''
124 dbdir = os.path.join(instance_config.DATABASE, 'files') 143 dbdir = os.path.join(instance_config.DATABASE, 'files')
125 if not os.path.isdir(dbdir): 144 if not os.path.isdir(dbdir):
126 os.makedirs(dbdir) 145 os.makedirs(dbdir)
127 146
172 191
173 db.commit() 192 db.commit()
174 193
175 # 194 #
176 # $Log: not supported by cvs2svn $ 195 # $Log: not supported by cvs2svn $
196 # Revision 1.20 2002/02/15 07:08:44 richard
197 # . Alternate email addresses are now available for users. See the MIGRATION
198 # file for info on how to activate the feature.
199 #
177 # Revision 1.19 2002/01/14 02:20:15 richard 200 # Revision 1.19 2002/01/14 02:20:15 richard
178 # . changed all config accesses so they access either the instance or the 201 # . changed all config accesses so they access either the instance or the
179 # config attriubute on the db. This means that all config is obtained from 202 # config attriubute on the db. This means that all config is obtained from
180 # instance_config instead of the mish-mash of classes. This will make 203 # instance_config instead of the mish-mash of classes. This will make
181 # switching to a ConfigParser setup easier too, I hope. 204 # switching to a ConfigParser setup easier too, I hope.

Roundup Issue Tracker: http://roundup-tracker.org/