Mercurial > p > roundup > code
annotate roundup/backends/back_gadfly.py @ 968:07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
...and play with it a little bit :)
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 22 Aug 2002 07:56:51 +0000 |
| parents | |
| children | ca0a542b2d19 |
| rev | line source |
|---|---|
|
968
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1 # $Id: back_gadfly.py,v 1.1 2002-08-22 07:56:51 richard Exp $ |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2 __doc__ = ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3 About Gadfly |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
4 ============ |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
5 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
6 Gadfly is a collection of python modules that provides relational |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
7 database functionality entirely implemented in Python. It supports a |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
8 subset of the intergalactic standard RDBMS Structured Query Language |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
9 SQL. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
10 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
11 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
12 Basic Structure |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
13 =============== |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
14 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
15 We map roundup classes to relational tables. Automatically detect schema |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
16 changes and modify the gadfly table schemas appropriately. Multilinks |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
17 (which represent a many-to-many relationship) are handled through |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
18 intermediate tables. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
19 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
20 Journals are stored adjunct to the per-class tables. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
21 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
22 Table columns for properties have "_" prepended so the names can't |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
23 clash with restricted names (like "order"). Retirement is determined by the |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
24 __retired__ column being true. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
25 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
26 All columns are defined as VARCHAR, since it really doesn't matter what |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
27 type they're defined as. We stuff all kinds of data in there ;) [as long as |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
28 it's marshallable, gadfly doesn't care] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
29 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
30 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
31 Additional Instance Requirements |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
32 ================================ |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
33 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
34 The instance configuration must specify where the database is. It does this |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
35 with GADFLY_DATABASE, which is used as the arguments to the gadfly.gadfly() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
36 method: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
37 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
38 Using an on-disk database directly (not a good idea): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
39 GADFLY_DATABASE = (database name, directory) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
40 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
41 Using a network database (much better idea): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
42 GADFLY_DATABASE = (policy, password, address, port) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
43 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
44 Because multiple accesses directly to a gadfly database aren't handled, but |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
45 multiple network accesses are, it's strongly advised that the latter setup be |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
46 used. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
47 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
48 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
49 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
50 # standard python modules |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
51 import sys, os, time, re, errno, weakref |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
52 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
53 # roundup modules |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
54 from roundup import hyperdb, date, password, roundupdb, security |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
55 from roundup.hyperdb import String, Password, Date, Interval, Link, \ |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
56 Multilink, DatabaseError, Boolean, Number |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
57 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
58 # the all-important gadfly :) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
59 import gadfly |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
60 from gadfly import client |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
61 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
62 # support |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
63 from blobfiles import FileStorage |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
64 from roundup.indexer import Indexer |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
65 from sessions import Sessions |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
66 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
67 class Database(FileStorage, hyperdb.Database, roundupdb.Database): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
68 # flag to set on retired entries |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
69 RETIRED_FLAG = '__hyperdb_retired' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
70 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
71 def __init__(self, config, journaltag=None): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
72 ''' Open the database and load the schema from it. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
73 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
74 self.config, self.journaltag = config, journaltag |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
75 self.dir = config.DATABASE |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
76 self.classes = {} |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
77 self.indexer = Indexer(self.dir) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
78 self.sessions = Sessions(self.config) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
79 self.security = security.Security(self) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
80 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
81 db = config.GADFLY_DATABASE |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
82 if len(db) == 2: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
83 # ensure files are group readable and writable |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
84 os.umask(0002) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
85 try: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
86 self.conn = gadfly.gadfly(*db) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
87 except IOError, error: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
88 if error.errno != errno.ENOENT: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
89 raise |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
90 self.database_schema = {} |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
91 self.conn = gadfly.gadfly() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
92 self.conn.startup(*db) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
93 cursor = self.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
94 cursor.execute('create table schema (schema varchar)') |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
95 cursor.execute('create table ids (name varchar, num integer)') |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
96 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
97 cursor = self.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
98 cursor.execute('select schema from schema') |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
99 self.database_schema = cursor.fetchone()[0] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
100 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
101 self.conn = client.gfclient(*db) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
102 cursor = self.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
103 cursor.execute('select schema from schema') |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
104 self.database_schema = cursor.fetchone()[0] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
105 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
106 def post_init(self): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
107 ''' Called once the schema initialisation has finished. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
108 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
109 We should now confirm that the schema defined by our "classes" |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
110 attribute actually matches the schema in the database. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
111 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
112 for classname, spec in self.classes.items(): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
113 if self.database_schema.has_key(classname): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
114 dbspec = self.database_schema[classname] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
115 self.update_class(spec.schema(), dbspec) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
116 self.database_schema[classname] = dbspec |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
117 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
118 self.create_class(spec) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
119 self.database_schema[classname] = spec.schema() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
120 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
121 for classname in self.database_schema.keys(): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
122 if not self.classes.has_key(classname): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
123 self.drop_class(classname) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
124 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
125 # commit any changes |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
126 cursor = self.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
127 cursor.execute('delete from schema') |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
128 cursor.execute('insert into schema values (?)', (self.database_schema,)) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
129 self.conn.commit() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
130 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
131 def determine_columns(self, spec): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
132 ''' Figure the column names and multilink properties from the spec |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
133 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
134 cols = [] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
135 mls = [] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
136 # add the multilinks separately |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
137 for col, prop in spec.properties.items(): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
138 if isinstance(prop, Multilink): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
139 mls.append(col) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
140 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
141 cols.append('_'+col) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
142 cols.sort() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
143 return cols, mls |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
144 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
145 def update_class(self, spec, dbspec): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
146 ''' Determine the differences between the current spec and the |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
147 database version of the spec, and update where necessary |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
148 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
149 if spec == dbspec: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
150 return |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
151 raise NotImplementedError |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
152 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
153 def create_class(self, spec): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
154 ''' Create a database table according to the given spec. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
155 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
156 cols, mls = self.determine_columns(spec) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
157 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
158 # add on our special columns |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
159 cols.append('id') |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
160 cols.append('__retired__') |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
161 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
162 cursor = self.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
163 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
164 # create the base table |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
165 cols = ','.join(['%s varchar'%x for x in cols]) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
166 sql = 'create table %s (%s)'%(spec.classname, cols) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
167 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
168 print >>hyperdb.DEBUG, 'create_class', (self, sql) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
169 cursor.execute(sql) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
170 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
171 # journal table |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
172 cols = ','.join(['%s varchar'%x |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
173 for x in 'nodeid date tag action params'.split()]) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
174 sql = 'create table %s__journal (%s)'%(spec.classname, cols) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
175 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
176 print >>hyperdb.DEBUG, 'create_class', (self, sql) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
177 cursor.execute(sql) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
178 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
179 # now create the multilink tables |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
180 for ml in mls: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
181 sql = 'create table %s_%s (linkid varchar, nodeid varchar)'%( |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
182 spec.classname, ml) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
183 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
184 print >>hyperdb.DEBUG, 'create_class', (self, sql) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
185 cursor.execute(sql) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
186 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
187 # ID counter |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
188 sql = 'insert into ids (name, num) values (?,?)' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
189 vals = (spec.classname, 1) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
190 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
191 print >>hyperdb.DEBUG, 'create_class', (self, sql, vals) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
192 cursor.execute(sql, vals) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
193 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
194 def drop_class(self, spec): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
195 ''' Drop the given table from the database. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
196 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
197 Drop the journal and multilink tables too. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
198 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
199 # figure the multilinks |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
200 mls = [] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
201 for col, prop in spec.properties.items(): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
202 if isinstance(prop, Multilink): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
203 mls.append(col) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
204 cursor = self.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
205 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
206 sql = 'drop table %s'%spec.classname |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
207 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
208 print >>hyperdb.DEBUG, 'drop_class', (self, sql) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
209 cursor.execute(sql) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
210 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
211 sql = 'drop table %s__journal'%spec.classname |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
212 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
213 print >>hyperdb.DEBUG, 'drop_class', (self, sql) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
214 cursor.execute(sql) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
215 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
216 for ml in mls: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
217 sql = 'drop table %s_%s'%(spec.classname, ml) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
218 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
219 print >>hyperdb.DEBUG, 'drop_class', (self, sql) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
220 cursor.execute(sql) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
221 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
222 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
223 # Classes |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
224 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
225 def __getattr__(self, classname): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
226 ''' A convenient way of calling self.getclass(classname). |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
227 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
228 if self.classes.has_key(classname): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
229 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
230 print >>hyperdb.DEBUG, '__getattr__', (self, classname) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
231 return self.classes[classname] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
232 raise AttributeError, classname |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
233 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
234 def addclass(self, cl): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
235 ''' Add a Class to the hyperdatabase. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
236 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
237 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
238 print >>hyperdb.DEBUG, 'addclass', (self, cl) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
239 cn = cl.classname |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
240 if self.classes.has_key(cn): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
241 raise ValueError, cn |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
242 self.classes[cn] = cl |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
243 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
244 def getclasses(self): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
245 ''' Return a list of the names of all existing classes. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
246 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
247 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
248 print >>hyperdb.DEBUG, 'getclasses', (self,) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
249 l = self.classes.keys() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
250 l.sort() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
251 return l |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
252 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
253 def getclass(self, classname): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
254 '''Get the Class object representing a particular class. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
255 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
256 If 'classname' is not a valid class name, a KeyError is raised. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
257 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
258 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
259 print >>hyperdb.DEBUG, 'getclass', (self, classname) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
260 return self.classes[classname] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
261 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
262 def clear(self): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
263 ''' Delete all database contents. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
264 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
265 Note: I don't commit here, which is different behaviour to the |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
266 "nuke from orbit" behaviour in the *dbms. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
267 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
268 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
269 print >>hyperdb.DEBUG, 'clear', (self,) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
270 cursor = self.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
271 for cn in self.classes.keys(): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
272 sql = 'delete from %s'%cn |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
273 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
274 print >>hyperdb.DEBUG, 'clear', (self, sql) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
275 cursor.execute(sql) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
276 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
277 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
278 # Node IDs |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
279 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
280 def newid(self, classname): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
281 ''' Generate a new id for the given class |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
282 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
283 # get the next ID |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
284 cursor = self.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
285 sql = 'select num from ids where name=?' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
286 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
287 print >>hyperdb.DEBUG, 'newid', (self, sql, classname) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
288 cursor.execute(sql, (classname, )) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
289 newid = cursor.fetchone()[0] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
290 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
291 # update the counter |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
292 sql = 'update ids set num=? where name=?' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
293 vals = (newid+1, classname) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
294 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
295 print >>hyperdb.DEBUG, 'newid', (self, sql, vals) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
296 cursor.execute(sql, vals) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
297 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
298 # return as string |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
299 return str(newid) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
300 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
301 def setid(self, classname, setid): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
302 ''' Set the id counter: used during import of database |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
303 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
304 cursor = self.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
305 sql = 'update ids set num=? where name=?' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
306 vals = (setid, spec.classname) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
307 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
308 print >>hyperdb.DEBUG, 'setid', (self, sql, vals) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
309 cursor.execute(sql, vals) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
310 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
311 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
312 # Nodes |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
313 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
314 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
315 def addnode(self, classname, nodeid, node): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
316 ''' Add the specified node to its class's db. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
317 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
318 # gadfly requires values for all non-multilink columns |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
319 cl = self.classes[classname] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
320 cols, mls = self.determine_columns(cl) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
321 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
322 # default the non-multilink columns |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
323 for col, prop in cl.properties.items(): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
324 if not isinstance(col, Multilink): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
325 if not node.has_key(col): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
326 node[col] = None |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
327 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
328 node = self.serialise(classname, node) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
329 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
330 # make sure the ordering is correct for column name -> column value |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
331 vals = tuple([node[col[1:]] for col in cols]) + (nodeid, 0) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
332 s = ','.join(['?' for x in cols]) + ',?,?' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
333 cols = ','.join(cols) + ',id,__retired__' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
334 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
335 # perform the inserts |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
336 cursor = self.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
337 sql = 'insert into %s (%s) values (%s)'%(classname, cols, s) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
338 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
339 print >>hyperdb.DEBUG, 'addnode', (self, sql, vals) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
340 cursor.execute(sql, vals) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
341 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
342 # insert the multilink rows |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
343 for col in mls: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
344 t = '%s_%s'%(classname, col) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
345 for entry in node[col]: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
346 sql = 'insert into %s (linkid, nodeid) values (?,?)'%t |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
347 vals = (entry, nodeid) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
348 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
349 print >>hyperdb.DEBUG, 'addnode', (self, sql, vals) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
350 cursor.execute(sql, vals) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
351 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
352 def setnode(self, classname, nodeid, node): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
353 ''' Change the specified node. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
354 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
355 node = self.serialise(classname, node) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
356 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
357 cl = self.classes[classname] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
358 cols = [] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
359 mls = [] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
360 # add the multilinks separately |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
361 for col in node.keys(): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
362 prop = cl.properties[col] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
363 if isinstance(prop, Multilink): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
364 mls.append(col) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
365 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
366 cols.append('_'+col) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
367 cols.sort() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
368 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
369 # make sure the ordering is correct for column name -> column value |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
370 vals = tuple([node[col[1:]] for col in cols]) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
371 s = ','.join(['?' for x in cols]) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
372 cols = ','.join(cols) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
373 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
374 # perform the update |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
375 cursor = self.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
376 sql = 'update %s (%s) values (%s)'%(classname, cols, s) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
377 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
378 print >>hyperdb.DEBUG, 'setnode', (self, sql, vals) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
379 cursor.execute(sql, vals) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
380 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
381 # now the fun bit, updating the multilinks ;) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
382 # XXX TODO XXX |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
383 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
384 def getnode(self, classname, nodeid): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
385 ''' Get a node from the database. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
386 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
387 # figure the columns we're fetching |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
388 cl = self.classes[classname] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
389 cols, mls = self.determine_columns(cl) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
390 cols = ','.join(cols) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
391 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
392 # perform the basic property fetch |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
393 cursor = self.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
394 sql = 'select %s from %s where id=?'%(cols, classname) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
395 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
396 print >>hyperdb.DEBUG, 'getnode', (self, sql, nodeid) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
397 cursor.execute(sql, (nodeid,)) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
398 values = cursor.fetchone() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
399 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
400 # make up the node |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
401 node = {} |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
402 for col in range(len(cols)): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
403 node[col] = values[col] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
404 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
405 # now the multilinks |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
406 for col in mls: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
407 # get the link ids |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
408 sql = 'select linkid from %s_%s where nodeid=?'%(classname, col) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
409 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
410 print >>hyperdb.DEBUG, 'getnode', (self, sql, nodeid) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
411 cursor.execute(sql, (nodeid,)) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
412 # extract the first column from the result |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
413 node[col] = [x[0] for x in cursor.fetchall()] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
414 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
415 return self.unserialise(classname, node) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
416 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
417 def serialise(self, classname, node): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
418 '''Copy the node contents, converting non-marshallable data into |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
419 marshallable data. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
420 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
421 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
422 print >>hyperdb.DEBUG, 'serialise', classname, node |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
423 properties = self.getclass(classname).getprops() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
424 d = {} |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
425 for k, v in node.items(): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
426 # if the property doesn't exist, or is the "retired" flag then |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
427 # it won't be in the properties dict |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
428 if not properties.has_key(k): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
429 d[k] = v |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
430 continue |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
431 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
432 # get the property spec |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
433 prop = properties[k] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
434 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
435 if isinstance(prop, Password): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
436 d[k] = str(v) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
437 elif isinstance(prop, Date) and v is not None: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
438 d[k] = v.serialise() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
439 elif isinstance(prop, Interval) and v is not None: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
440 d[k] = v.serialise() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
441 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
442 d[k] = v |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
443 return d |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
444 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
445 def unserialise(self, classname, node): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
446 '''Decode the marshalled node data |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
447 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
448 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
449 print >>hyperdb.DEBUG, 'unserialise', classname, node |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
450 properties = self.getclass(classname).getprops() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
451 d = {} |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
452 for k, v in node.items(): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
453 # if the property doesn't exist, or is the "retired" flag then |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
454 # it won't be in the properties dict |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
455 if not properties.has_key(k): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
456 d[k] = v |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
457 continue |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
458 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
459 # get the property spec |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
460 prop = properties[k] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
461 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
462 if isinstance(prop, Date) and v is not None: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
463 d[k] = date.Date(v) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
464 elif isinstance(prop, Interval) and v is not None: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
465 d[k] = date.Interval(v) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
466 elif isinstance(prop, Password): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
467 p = password.Password() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
468 p.unpack(v) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
469 d[k] = p |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
470 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
471 d[k] = v |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
472 return d |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
473 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
474 def hasnode(self, classname, nodeid): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
475 ''' Determine if the database has a given node. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
476 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
477 cursor = self.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
478 sql = 'select count(*) from %s where nodeid=?'%classname |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
479 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
480 print >>hyperdb.DEBUG, 'hasnode', (self, sql, nodeid) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
481 cursor.execute(sql, (nodeid,)) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
482 return cursor.fetchone()[0] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
483 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
484 def countnodes(self, classname): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
485 ''' Count the number of nodes that exist for a particular Class. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
486 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
487 cursor = self.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
488 sql = 'select count(*) from %s'%classname |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
489 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
490 print >>hyperdb.DEBUG, 'countnodes', (self, sql) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
491 cursor.execute(sql) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
492 return cursor.fetchone()[0] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
493 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
494 def getnodeids(self, classname): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
495 ''' Retrieve all the ids of the nodes for a particular Class. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
496 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
497 cursor = self.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
498 sql = 'select id from %s'%classname |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
499 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
500 print >>hyperdb.DEBUG, 'getnodeids', (self, sql) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
501 cursor.execute(sql) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
502 return [x[0] for x in cursor.fetchall()] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
503 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
504 def addjournal(self, classname, nodeid, action, params): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
505 ''' Journal the Action |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
506 'action' may be: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
507 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
508 'create' or 'set' -- 'params' is a dictionary of property values |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
509 'link' or 'unlink' -- 'params' is (classname, nodeid, propname) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
510 'retire' -- 'params' is None |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
511 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
512 if isinstance(params, type({})): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
513 if params.has_key('creator'): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
514 journaltag = self.user.get(params['creator'], 'username') |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
515 del params['creator'] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
516 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
517 journaltag = self.journaltag |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
518 if params.has_key('created'): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
519 journaldate = params['created'].serialise() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
520 del params['created'] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
521 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
522 journaldate = date.Date().serialise() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
523 if params.has_key('activity'): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
524 del params['activity'] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
525 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
526 # serialise the parameters now |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
527 if action in ('set', 'create'): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
528 params = self.serialise(classname, params) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
529 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
530 journaltag = self.journaltag |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
531 journaldate = date.Date().serialise() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
532 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
533 # create the journal entry |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
534 cols = ','.join('nodeid date tag action params'.split()) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
535 entry = (nodeid, journaldate, journaltag, action, params) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
536 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
537 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
538 print >>hyperdb.DEBUG, 'doSaveJournal', entry |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
539 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
540 # do the insert |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
541 cursor = self.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
542 sql = 'insert into %s__journal (%s) values (?,?,?,?,?)'%(classname, |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
543 cols) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
544 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
545 print >>hyperdb.DEBUG, 'addjournal', (self, sql, entry) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
546 cursor.execute(sql, entry) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
547 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
548 def getjournal(self, classname, nodeid): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
549 ''' get the journal for id |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
550 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
551 cols = ','.join('nodeid date tag action params'.split()) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
552 cursor = self.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
553 sql = 'select %s from %s__journal where nodeid=?'%(cols, classname) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
554 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
555 print >>hyperdb.DEBUG, 'getjournal', (self, sql, nodeid) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
556 cursor.execute(sql, (nodeid,)) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
557 res = [] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
558 for nodeid, date_stamp, user, action, params in cursor.fetchall(): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
559 res.append((nodeid, date.Date(date_stamp), user, action, params)) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
560 return res |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
561 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
562 def pack(self, pack_before): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
563 ''' Pack the database, removing all journal entries before the |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
564 "pack_before" date. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
565 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
566 # get a 'yyyymmddhhmmss' version of the date |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
567 date_stamp = pack_before.serialise() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
568 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
569 # do the delete |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
570 cursor = self.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
571 for classname in self.classes.keys(): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
572 sql = 'delete from %s__journal where date<?'%classname |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
573 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
574 print >>hyperdb.DEBUG, 'pack', (self, sql, date_stamp) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
575 cursor.execute(sql, (date_stamp,)) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
576 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
577 def commit(self): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
578 ''' Commit the current transactions. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
579 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
580 Save all data changed since the database was opened or since the |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
581 last commit() or rollback(). |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
582 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
583 self.conn.commit() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
584 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
585 def rollback(self): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
586 ''' Reverse all actions from the current transaction. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
587 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
588 Undo all the changes made since the database was opened or the last |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
589 commit() or rollback() was performed. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
590 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
591 self.conn.rollback() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
592 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
593 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
594 # The base Class class |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
595 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
596 class Class(hyperdb.Class): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
597 ''' The handle to a particular class of nodes in a hyperdatabase. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
598 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
599 All methods except __repr__ and getnode must be implemented by a |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
600 concrete backend Class. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
601 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
602 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
603 def __init__(self, db, classname, **properties): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
604 '''Create a new class with a given name and property specification. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
605 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
606 'classname' must not collide with the name of an existing class, |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
607 or a ValueError is raised. The keyword arguments in 'properties' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
608 must map names to property objects, or a TypeError is raised. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
609 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
610 if (properties.has_key('creation') or properties.has_key('activity') |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
611 or properties.has_key('creator')): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
612 raise ValueError, '"creation", "activity" and "creator" are '\ |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
613 'reserved' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
614 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
615 self.classname = classname |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
616 self.properties = properties |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
617 self.db = weakref.proxy(db) # use a weak ref to avoid circularity |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
618 self.key = '' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
619 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
620 # should we journal changes (default yes) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
621 self.do_journal = 1 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
622 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
623 # do the db-related init stuff |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
624 db.addclass(self) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
625 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
626 self.auditors = {'create': [], 'set': [], 'retire': []} |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
627 self.reactors = {'create': [], 'set': [], 'retire': []} |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
628 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
629 def schema(self): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
630 ''' A dumpable version of the schema that we can store in the |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
631 database |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
632 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
633 return (self.key, [(x, repr(y)) for x,y in self.properties.items()]) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
634 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
635 def enableJournalling(self): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
636 '''Turn journalling on for this class |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
637 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
638 self.do_journal = 1 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
639 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
640 def disableJournalling(self): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
641 '''Turn journalling off for this class |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
642 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
643 self.do_journal = 0 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
644 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
645 # Editing nodes: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
646 def create(self, **propvalues): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
647 ''' Create a new node of this class and return its id. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
648 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
649 The keyword arguments in 'propvalues' map property names to values. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
650 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
651 The values of arguments must be acceptable for the types of their |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
652 corresponding properties or a TypeError is raised. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
653 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
654 If this class has a key property, it must be present and its value |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
655 must not collide with other key strings or a ValueError is raised. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
656 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
657 Any other properties on this class that are missing from the |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
658 'propvalues' dictionary are set to None. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
659 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
660 If an id in a link or multilink property does not refer to a valid |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
661 node, an IndexError is raised. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
662 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
663 if propvalues.has_key('id'): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
664 raise KeyError, '"id" is reserved' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
665 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
666 if self.db.journaltag is None: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
667 raise DatabaseError, 'Database open read-only' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
668 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
669 if propvalues.has_key('creation') or propvalues.has_key('activity'): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
670 raise KeyError, '"creation" and "activity" are reserved' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
671 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
672 self.fireAuditors('create', None, propvalues) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
673 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
674 # new node's id |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
675 newid = self.db.newid(self.classname) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
676 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
677 # validate propvalues |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
678 num_re = re.compile('^\d+$') |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
679 for key, value in propvalues.items(): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
680 if key == self.key: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
681 try: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
682 self.lookup(value) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
683 except KeyError: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
684 pass |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
685 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
686 raise ValueError, 'node with key "%s" exists'%value |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
687 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
688 # try to handle this property |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
689 try: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
690 prop = self.properties[key] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
691 except KeyError: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
692 raise KeyError, '"%s" has no property "%s"'%(self.classname, |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
693 key) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
694 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
695 if value is not None and isinstance(prop, Link): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
696 if type(value) != type(''): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
697 raise ValueError, 'link value must be String' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
698 link_class = self.properties[key].classname |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
699 # if it isn't a number, it's a key |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
700 if not num_re.match(value): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
701 try: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
702 value = self.db.classes[link_class].lookup(value) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
703 except (TypeError, KeyError): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
704 raise IndexError, 'new property "%s": %s not a %s'%( |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
705 key, value, link_class) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
706 elif not self.db.getclass(link_class).hasnode(value): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
707 raise IndexError, '%s has no node %s'%(link_class, value) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
708 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
709 # save off the value |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
710 propvalues[key] = value |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
711 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
712 # register the link with the newly linked node |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
713 if self.do_journal and self.properties[key].do_journal: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
714 self.db.addjournal(link_class, value, 'link', |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
715 (self.classname, newid, key)) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
716 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
717 elif isinstance(prop, Multilink): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
718 if type(value) != type([]): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
719 raise TypeError, 'new property "%s" not a list of ids'%key |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
720 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
721 # clean up and validate the list of links |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
722 link_class = self.properties[key].classname |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
723 l = [] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
724 for entry in value: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
725 if type(entry) != type(''): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
726 raise ValueError, '"%s" link value (%s) must be '\ |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
727 'String'%(key, value) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
728 # if it isn't a number, it's a key |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
729 if not num_re.match(entry): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
730 try: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
731 entry = self.db.classes[link_class].lookup(entry) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
732 except (TypeError, KeyError): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
733 raise IndexError, 'new property "%s": %s not a %s'%( |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
734 key, entry, self.properties[key].classname) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
735 l.append(entry) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
736 value = l |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
737 propvalues[key] = value |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
738 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
739 # handle additions |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
740 for nodeid in value: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
741 if not self.db.getclass(link_class).hasnode(nodeid): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
742 raise IndexError, '%s has no node %s'%(link_class, |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
743 nodeid) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
744 # register the link with the newly linked node |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
745 if self.do_journal and self.properties[key].do_journal: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
746 self.db.addjournal(link_class, nodeid, 'link', |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
747 (self.classname, newid, key)) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
748 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
749 elif isinstance(prop, String): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
750 if type(value) != type(''): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
751 raise TypeError, 'new property "%s" not a string'%key |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
752 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
753 elif isinstance(prop, Password): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
754 if not isinstance(value, password.Password): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
755 raise TypeError, 'new property "%s" not a Password'%key |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
756 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
757 elif isinstance(prop, Date): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
758 if value is not None and not isinstance(value, date.Date): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
759 raise TypeError, 'new property "%s" not a Date'%key |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
760 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
761 elif isinstance(prop, Interval): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
762 if value is not None and not isinstance(value, date.Interval): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
763 raise TypeError, 'new property "%s" not an Interval'%key |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
764 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
765 elif value is not None and isinstance(prop, Number): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
766 try: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
767 float(value) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
768 except ValueError: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
769 raise TypeError, 'new property "%s" not numeric'%key |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
770 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
771 elif value is not None and isinstance(prop, Boolean): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
772 try: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
773 int(value) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
774 except ValueError: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
775 raise TypeError, 'new property "%s" not boolean'%key |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
776 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
777 # make sure there's data where there needs to be |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
778 for key, prop in self.properties.items(): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
779 if propvalues.has_key(key): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
780 continue |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
781 if key == self.key: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
782 raise ValueError, 'key property "%s" is required'%key |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
783 if isinstance(prop, Multilink): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
784 propvalues[key] = [] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
785 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
786 propvalues[key] = None |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
787 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
788 # done |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
789 self.db.addnode(self.classname, newid, propvalues) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
790 if self.do_journal: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
791 self.db.addjournal(self.classname, newid, 'create', propvalues) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
792 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
793 self.fireReactors('create', newid, None) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
794 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
795 return newid |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
796 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
797 _marker = [] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
798 def get(self, nodeid, propname, default=_marker, cache=1): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
799 '''Get the value of a property on an existing node of this class. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
800 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
801 'nodeid' must be the id of an existing node of this class or an |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
802 IndexError is raised. 'propname' must be the name of a property |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
803 of this class or a KeyError is raised. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
804 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
805 'cache' indicates whether the transaction cache should be queried |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
806 for the node. If the node has been modified and you need to |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
807 determine what its values prior to modification are, you need to |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
808 set cache=0. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
809 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
810 if propname == 'id': |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
811 return nodeid |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
812 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
813 if propname == 'creation': |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
814 if not self.do_journal: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
815 raise ValueError, 'Journalling is disabled for this class' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
816 journal = self.db.getjournal(self.classname, nodeid) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
817 if journal: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
818 return self.db.getjournal(self.classname, nodeid)[0][1] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
819 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
820 # on the strange chance that there's no journal |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
821 return date.Date() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
822 if propname == 'activity': |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
823 if not self.do_journal: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
824 raise ValueError, 'Journalling is disabled for this class' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
825 journal = self.db.getjournal(self.classname, nodeid) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
826 if journal: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
827 return self.db.getjournal(self.classname, nodeid)[-1][1] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
828 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
829 # on the strange chance that there's no journal |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
830 return date.Date() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
831 if propname == 'creator': |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
832 if not self.do_journal: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
833 raise ValueError, 'Journalling is disabled for this class' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
834 journal = self.db.getjournal(self.classname, nodeid) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
835 if journal: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
836 name = self.db.getjournal(self.classname, nodeid)[0][2] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
837 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
838 return None |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
839 return self.db.user.lookup(name) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
840 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
841 # get the property (raises KeyErorr if invalid) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
842 prop = self.properties[propname] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
843 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
844 # get the node's dict |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
845 d = self.db.getnode(self.classname, nodeid) #, cache=cache) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
846 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
847 if not d.has_key(propname): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
848 if default is _marker: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
849 if isinstance(prop, Multilink): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
850 return [] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
851 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
852 return None |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
853 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
854 return default |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
855 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
856 return d[propname] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
857 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
858 def getnode(self, nodeid, cache=1): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
859 ''' Return a convenience wrapper for the node. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
860 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
861 'nodeid' must be the id of an existing node of this class or an |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
862 IndexError is raised. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
863 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
864 'cache' indicates whether the transaction cache should be queried |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
865 for the node. If the node has been modified and you need to |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
866 determine what its values prior to modification are, you need to |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
867 set cache=0. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
868 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
869 return Node(self, nodeid, cache=cache) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
870 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
871 def set(self, nodeid, **propvalues): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
872 '''Modify a property on an existing node of this class. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
873 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
874 'nodeid' must be the id of an existing node of this class or an |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
875 IndexError is raised. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
876 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
877 Each key in 'propvalues' must be the name of a property of this |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
878 class or a KeyError is raised. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
879 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
880 All values in 'propvalues' must be acceptable types for their |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
881 corresponding properties or a TypeError is raised. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
882 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
883 If the value of the key property is set, it must not collide with |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
884 other key strings or a ValueError is raised. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
885 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
886 If the value of a Link or Multilink property contains an invalid |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
887 node id, a ValueError is raised. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
888 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
889 raise NotImplementedError |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
890 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
891 def retire(self, nodeid): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
892 '''Retire a node. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
893 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
894 The properties on the node remain available from the get() method, |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
895 and the node's id is never reused. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
896 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
897 Retired nodes are not returned by the find(), list(), or lookup() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
898 methods, and other nodes may reuse the values of their key properties. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
899 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
900 cursor = self.db.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
901 sql = 'update %s set __retired__=1 where id=?'%self.classname |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
902 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
903 print >>hyperdb.DEBUG, 'retire', (self, sql, nodeid) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
904 cursor.execute(sql, (nodeid,)) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
905 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
906 def is_retired(self, nodeid): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
907 '''Return true if the node is rerired |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
908 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
909 cursor = self.db.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
910 sql = 'select __retired__ from %s where id=?'%self.classname |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
911 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
912 print >>hyperdb.DEBUG, 'is_retired', (self, sql, nodeid) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
913 cursor.execute(sql, (nodeid,)) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
914 return cursor.fetchone()[0] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
915 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
916 def destroy(self, nodeid): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
917 '''Destroy a node. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
918 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
919 WARNING: this method should never be used except in extremely rare |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
920 situations where there could never be links to the node being |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
921 deleted |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
922 WARNING: use retire() instead |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
923 WARNING: the properties of this node will not be available ever again |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
924 WARNING: really, use retire() instead |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
925 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
926 Well, I think that's enough warnings. This method exists mostly to |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
927 support the session storage of the cgi interface. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
928 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
929 The node is completely removed from the hyperdb, including all journal |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
930 entries. It will no longer be available, and will generally break code |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
931 if there are any references to the node. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
932 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
933 raise NotImplementedError |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
934 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
935 def history(self, nodeid): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
936 '''Retrieve the journal of edits on a particular node. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
937 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
938 'nodeid' must be the id of an existing node of this class or an |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
939 IndexError is raised. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
940 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
941 The returned list contains tuples of the form |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
942 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
943 (date, tag, action, params) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
944 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
945 'date' is a Timestamp object specifying the time of the change and |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
946 'tag' is the journaltag specified when the database was opened. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
947 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
948 raise NotImplementedError |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
949 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
950 # Locating nodes: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
951 def hasnode(self, nodeid): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
952 '''Determine if the given nodeid actually exists |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
953 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
954 return self.db.hasnode(self.classname, nodeid) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
955 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
956 def setkey(self, propname): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
957 '''Select a String property of this class to be the key property. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
958 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
959 'propname' must be the name of a String property of this class or |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
960 None, or a TypeError is raised. The values of the key property on |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
961 all existing nodes must be unique or a ValueError is raised. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
962 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
963 # XXX create an index on the key prop column |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
964 prop = self.getprops()[propname] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
965 if not isinstance(prop, String): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
966 raise TypeError, 'key properties must be String' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
967 self.key = propname |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
968 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
969 def getkey(self): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
970 '''Return the name of the key property for this class or None.''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
971 return self.key |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
972 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
973 def labelprop(self, default_to_id=0): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
974 ''' Return the property name for a label for the given node. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
975 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
976 This method attempts to generate a consistent label for the node. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
977 It tries the following in order: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
978 1. key property |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
979 2. "name" property |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
980 3. "title" property |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
981 4. first property from the sorted property name list |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
982 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
983 raise NotImplementedError |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
984 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
985 def lookup(self, keyvalue): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
986 '''Locate a particular node by its key property and return its id. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
987 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
988 If this class has no key property, a TypeError is raised. If the |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
989 'keyvalue' matches one of the values for the key property among |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
990 the nodes in this class, the matching node's id is returned; |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
991 otherwise a KeyError is raised. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
992 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
993 if not self.key: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
994 raise TypeError, 'No key property set' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
995 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
996 cursor = self.db.conn.cursor() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
997 sql = 'select id from %s where _%s=?'%(self.classname, self.key) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
998 if __debug__: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
999 print >>hyperdb.DEBUG, 'lookup', (self, sql, keyvalue) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1000 cursor.execute(sql, (keyvalue,)) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1001 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1002 # see if there was a result |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1003 l = cursor.fetchall() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1004 if not l: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1005 raise KeyError, keyvalue |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1006 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1007 # return the id |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1008 return l[0][0] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1009 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1010 def find(self, **propspec): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1011 '''Get the ids of nodes in this class which link to the given nodes. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1012 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1013 'propspec' consists of keyword args propname={nodeid:1,} |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1014 'propname' must be the name of a property in this class, or a |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1015 KeyError is raised. That property must be a Link or Multilink |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1016 property, or a TypeError is raised. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1017 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1018 Any node in this class whose 'propname' property links to any of the |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1019 nodeids will be returned. Used by the full text indexing, which knows |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1020 that "foo" occurs in msg1, msg3 and file7, so we have hits on these |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1021 issues: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1022 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1023 db.issue.find(messages={'1':1,'3':1}, files={'7':1}) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1024 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1025 raise NotImplementedError |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1026 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1027 def filter(self, search_matches, filterspec, sort, group, |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1028 num_re = re.compile('^\d+$')): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1029 ''' Return a list of the ids of the active nodes in this class that |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1030 match the 'filter' spec, sorted by the group spec and then the |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1031 sort spec |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1032 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1033 raise NotImplementedError |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1034 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1035 def count(self): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1036 '''Get the number of nodes in this class. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1037 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1038 If the returned integer is 'numnodes', the ids of all the nodes |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1039 in this class run from 1 to numnodes, and numnodes+1 will be the |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1040 id of the next node to be created in this class. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1041 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1042 return self.db.countnodes(self.classname) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1043 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1044 # Manipulating properties: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1045 def getprops(self, protected=1): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1046 '''Return a dictionary mapping property names to property objects. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1047 If the "protected" flag is true, we include protected properties - |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1048 those which may not be modified. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1049 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1050 d = self.properties.copy() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1051 if protected: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1052 d['id'] = String() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1053 d['creation'] = hyperdb.Date() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1054 d['activity'] = hyperdb.Date() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1055 d['creator'] = hyperdb.Link("user") |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1056 return d |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1057 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1058 def addprop(self, **properties): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1059 '''Add properties to this class. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1060 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1061 The keyword arguments in 'properties' must map names to property |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1062 objects, or a TypeError is raised. None of the keys in 'properties' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1063 may collide with the names of existing properties, or a ValueError |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1064 is raised before any properties have been added. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1065 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1066 for key in properties.keys(): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1067 if self.properties.has_key(key): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1068 raise ValueError, key |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1069 self.properties.update(properties) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1070 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1071 def index(self, nodeid): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1072 '''Add (or refresh) the node to search indexes |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1073 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1074 # find all the String properties that have indexme |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1075 for prop, propclass in self.getprops().items(): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1076 if isinstance(propclass, String) and propclass.indexme: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1077 try: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1078 value = str(self.get(nodeid, prop)) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1079 except IndexError: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1080 # node no longer exists - entry should be removed |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1081 self.db.indexer.purge_entry((self.classname, nodeid, prop)) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1082 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1083 # and index them under (classname, nodeid, property) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1084 self.db.indexer.add_text((self.classname, nodeid, prop), |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1085 value) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1086 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1087 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1088 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1089 # Detector interface |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1090 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1091 def audit(self, event, detector): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1092 '''Register a detector |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1093 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1094 l = self.auditors[event] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1095 if detector not in l: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1096 self.auditors[event].append(detector) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1097 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1098 def fireAuditors(self, action, nodeid, newvalues): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1099 '''Fire all registered auditors. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1100 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1101 for audit in self.auditors[action]: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1102 audit(self.db, self, nodeid, newvalues) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1103 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1104 def react(self, event, detector): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1105 '''Register a detector |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1106 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1107 l = self.reactors[event] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1108 if detector not in l: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1109 self.reactors[event].append(detector) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1110 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1111 def fireReactors(self, action, nodeid, oldvalues): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1112 '''Fire all registered reactors. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1113 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1114 for react in self.reactors[action]: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1115 react(self.db, self, nodeid, oldvalues) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1116 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1117 class FileClass(Class): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1118 '''This class defines a large chunk of data. To support this, it has a |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1119 mandatory String property "content" which is typically saved off |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1120 externally to the hyperdb. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1121 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1122 The default MIME type of this data is defined by the |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1123 "default_mime_type" class attribute, which may be overridden by each |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1124 node if the class defines a "type" String property. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1125 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1126 default_mime_type = 'text/plain' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1127 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1128 def create(self, **propvalues): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1129 ''' snaffle the file propvalue and store in a file |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1130 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1131 content = propvalues['content'] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1132 del propvalues['content'] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1133 newid = Class.create(self, **propvalues) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1134 self.db.storefile(self.classname, newid, None, content) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1135 return newid |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1136 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1137 def import_list(self, propnames, proplist): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1138 ''' Trap the "content" property... |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1139 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1140 # dupe this list so we don't affect others |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1141 propnames = propnames[:] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1142 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1143 # extract the "content" property from the proplist |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1144 i = propnames.index('content') |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1145 content = proplist[i] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1146 del propnames[i] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1147 del proplist[i] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1148 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1149 # do the normal import |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1150 newid = Class.import_list(self, propnames, proplist) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1151 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1152 # save off the "content" file |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1153 self.db.storefile(self.classname, newid, None, content) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1154 return newid |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1155 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1156 _marker = [] |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1157 def get(self, nodeid, propname, default=_marker, cache=1): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1158 ''' trap the content propname and get it from the file |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1159 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1160 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1161 poss_msg = 'Possibly a access right configuration problem.' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1162 if propname == 'content': |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1163 try: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1164 return self.db.getfile(self.classname, nodeid, None) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1165 except IOError, (strerror): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1166 # BUG: by catching this we donot see an error in the log. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1167 return 'ERROR reading file: %s%s\n%s\n%s'%( |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1168 self.classname, nodeid, poss_msg, strerror) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1169 if default is not _marker: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1170 return Class.get(self, nodeid, propname, default, cache=cache) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1171 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1172 return Class.get(self, nodeid, propname, cache=cache) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1173 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1174 def getprops(self, protected=1): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1175 ''' In addition to the actual properties on the node, these methods |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1176 provide the "content" property. If the "protected" flag is true, |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1177 we include protected properties - those which may not be |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1178 modified. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1179 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1180 d = Class.getprops(self, protected=protected).copy() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1181 if protected: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1182 d['content'] = hyperdb.String() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1183 return d |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1184 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1185 def index(self, nodeid): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1186 ''' Index the node in the search index. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1187 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1188 We want to index the content in addition to the normal String |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1189 property indexing. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1190 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1191 # perform normal indexing |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1192 Class.index(self, nodeid) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1193 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1194 # get the content to index |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1195 content = self.get(nodeid, 'content') |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1196 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1197 # figure the mime type |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1198 if self.properties.has_key('type'): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1199 mime_type = self.get(nodeid, 'type') |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1200 else: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1201 mime_type = self.default_mime_type |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1202 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1203 # and index! |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1204 self.db.indexer.add_text((self.classname, nodeid, 'content'), content, |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1205 mime_type) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1206 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1207 # XXX deviation from spec - was called ItemClass |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1208 class IssueClass(Class, roundupdb.IssueClass): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1209 # Overridden methods: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1210 def __init__(self, db, classname, **properties): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1211 '''The newly-created class automatically includes the "messages", |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1212 "files", "nosy", and "superseder" properties. If the 'properties' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1213 dictionary attempts to specify any of these properties or a |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1214 "creation" or "activity" property, a ValueError is raised. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1215 ''' |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1216 if not properties.has_key('title'): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1217 properties['title'] = hyperdb.String(indexme='yes') |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1218 if not properties.has_key('messages'): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1219 properties['messages'] = hyperdb.Multilink("msg") |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1220 if not properties.has_key('files'): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1221 properties['files'] = hyperdb.Multilink("file") |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1222 if not properties.has_key('nosy'): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1223 properties['nosy'] = hyperdb.Multilink("user") |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1224 if not properties.has_key('superseder'): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1225 properties['superseder'] = hyperdb.Multilink(classname) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1226 Class.__init__(self, db, classname, **properties) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1227 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1228 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1229 # $Log: not supported by cvs2svn $ |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1230 # Revision 1.80 2002/08/16 04:28:13 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1231 # added is_retired query to Class |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1232 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1233 # Revision 1.79 2002/07/29 23:30:14 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1234 # documentation reorg post-new-security |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1235 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1236 # Revision 1.78 2002/07/21 03:26:37 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1237 # Gordon, does this help? |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1238 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1239 # Revision 1.77 2002/07/18 11:27:47 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1240 # ws |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1241 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1242 # Revision 1.76 2002/07/18 11:17:30 gmcm |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1243 # Add Number and Boolean types to hyperdb. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1244 # Add conversion cases to web, mail & admin interfaces. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1245 # Add storage/serialization cases to back_anydbm & back_metakit. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1246 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1247 # Revision 1.75 2002/07/14 02:05:53 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1248 # . all storage-specific code (ie. backend) is now implemented by the backends |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1249 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1250 # Revision 1.74 2002/07/10 00:24:10 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1251 # braino |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1252 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1253 # Revision 1.73 2002/07/10 00:19:48 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1254 # Added explicit closing of backend database handles. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1255 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1256 # Revision 1.72 2002/07/09 21:53:38 gmcm |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1257 # Optimize Class.find so that the propspec can contain a set of ids to match. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1258 # This is used by indexer.search so it can do just one find for all the index matches. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1259 # This was already confusing code, but for common terms (lots of index matches), |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1260 # it is enormously faster. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1261 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1262 # Revision 1.71 2002/07/09 03:02:52 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1263 # More indexer work: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1264 # - all String properties may now be indexed too. Currently there's a bit of |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1265 # "issue" specific code in the actual searching which needs to be |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1266 # addressed. In a nutshell: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1267 # + pass 'indexme="yes"' as a String() property initialisation arg, eg: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1268 # file = FileClass(db, "file", name=String(), type=String(), |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1269 # comment=String(indexme="yes")) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1270 # + the comment will then be indexed and be searchable, with the results |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1271 # related back to the issue that the file is linked to |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1272 # - as a result of this work, the FileClass has a default MIME type that may |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1273 # be overridden in a subclass, or by the use of a "type" property as is |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1274 # done in the default templates. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1275 # - the regeneration of the indexes (if necessary) is done once the schema is |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1276 # set up in the dbinit. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1277 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1278 # Revision 1.70 2002/06/27 12:06:20 gmcm |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1279 # Improve an error message. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1280 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1281 # Revision 1.69 2002/06/17 23:15:29 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1282 # Can debug to stdout now |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1283 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1284 # Revision 1.68 2002/06/11 06:52:03 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1285 # . #564271 ] find() and new properties |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1286 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1287 # Revision 1.67 2002/06/11 05:02:37 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1288 # . #565979 ] code error in hyperdb.Class.find |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1289 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1290 # Revision 1.66 2002/05/25 07:16:24 rochecompaan |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1291 # Merged search_indexing-branch with HEAD |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1292 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1293 # Revision 1.65 2002/05/22 04:12:05 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1294 # . applied patch #558876 ] cgi client customization |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1295 # ... with significant additions and modifications ;) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1296 # - extended handling of ML assignedto to all places it's handled |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1297 # - added more NotFound info |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1298 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1299 # Revision 1.64 2002/05/15 06:21:21 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1300 # . node caching now works, and gives a small boost in performance |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1301 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1302 # As a part of this, I cleaned up the DEBUG output and implemented TRACE |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1303 # output (HYPERDBTRACE='file to trace to') with checkpoints at the start of |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1304 # CGI requests. Run roundup with python -O to skip all the DEBUG/TRACE stuff |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1305 # (using if __debug__ which is compiled out with -O) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1306 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1307 # Revision 1.63 2002/04/15 23:25:15 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1308 # . node ids are now generated from a lockable store - no more race conditions |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1309 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1310 # We're using the portalocker code by Jonathan Feinberg that was contributed |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1311 # to the ASPN Python cookbook. This gives us locking across Unix and Windows. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1312 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1313 # Revision 1.62 2002/04/03 07:05:50 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1314 # d'oh! killed retirement of nodes :( |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1315 # all better now... |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1316 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1317 # Revision 1.61 2002/04/03 06:11:51 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1318 # Fix for old databases that contain properties that don't exist any more. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1319 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1320 # Revision 1.60 2002/04/03 05:54:31 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1321 # Fixed serialisation problem by moving the serialisation step out of the |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1322 # hyperdb.Class (get, set) into the hyperdb.Database. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1323 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1324 # Also fixed htmltemplate after the showid changes I made yesterday. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1325 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1326 # Unit tests for all of the above written. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1327 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1328 # Revision 1.59.2.2 2002/04/20 13:23:33 rochecompaan |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1329 # We now have a separate search page for nodes. Search links for |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1330 # different classes can be customized in instance_config similar to |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1331 # index links. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1332 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1333 # Revision 1.59.2.1 2002/04/19 19:54:42 rochecompaan |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1334 # cgi_client.py |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1335 # removed search link for the time being |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1336 # moved rendering of matches to htmltemplate |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1337 # hyperdb.py |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1338 # filtering of nodes on full text search incorporated in filter method |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1339 # roundupdb.py |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1340 # added paramater to call of filter method |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1341 # roundup_indexer.py |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1342 # added search method to RoundupIndexer class |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1343 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1344 # Revision 1.59 2002/03/12 22:52:26 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1345 # more pychecker warnings removed |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1346 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1347 # Revision 1.58 2002/02/27 03:23:16 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1348 # Ran it through pychecker, made fixes |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1349 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1350 # Revision 1.57 2002/02/20 05:23:24 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1351 # Didn't accomodate new values for new properties |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1352 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1353 # Revision 1.56 2002/02/20 05:05:28 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1354 # . Added simple editing for classes that don't define a templated interface. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1355 # - access using the admin "class list" interface |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1356 # - limited to admin-only |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1357 # - requires the csv module from object-craft (url given if it's missing) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1358 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1359 # Revision 1.55 2002/02/15 07:27:12 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1360 # Oops, precedences around the way w0rng. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1361 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1362 # Revision 1.54 2002/02/15 07:08:44 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1363 # . Alternate email addresses are now available for users. See the MIGRATION |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1364 # file for info on how to activate the feature. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1365 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1366 # Revision 1.53 2002/01/22 07:21:13 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1367 # . fixed back_bsddb so it passed the journal tests |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1368 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1369 # ... it didn't seem happy using the back_anydbm _open method, which is odd. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1370 # Yet another occurrance of whichdb not being able to recognise older bsddb |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1371 # databases. Yadda yadda. Made the HYPERDBDEBUG stuff more sane in the |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1372 # process. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1373 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1374 # Revision 1.52 2002/01/21 16:33:19 rochecompaan |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1375 # You can now use the roundup-admin tool to pack the database |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1376 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1377 # Revision 1.51 2002/01/21 03:01:29 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1378 # brief docco on the do_journal argument |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1379 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1380 # Revision 1.50 2002/01/19 13:16:04 rochecompaan |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1381 # Journal entries for link and multilink properties can now be switched on |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1382 # or off. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1383 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1384 # Revision 1.49 2002/01/16 07:02:57 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1385 # . lots of date/interval related changes: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1386 # - more relaxed date format for input |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1387 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1388 # Revision 1.48 2002/01/14 06:32:34 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1389 # . #502951 ] adding new properties to old database |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1390 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1391 # Revision 1.47 2002/01/14 02:20:15 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1392 # . changed all config accesses so they access either the instance or the |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1393 # config attriubute on the db. This means that all config is obtained from |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1394 # instance_config instead of the mish-mash of classes. This will make |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1395 # switching to a ConfigParser setup easier too, I hope. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1396 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1397 # At a minimum, this makes migration a _little_ easier (a lot easier in the |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1398 # 0.5.0 switch, I hope!) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1399 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1400 # Revision 1.46 2002/01/07 10:42:23 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1401 # oops |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1402 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1403 # Revision 1.45 2002/01/02 04:18:17 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1404 # hyperdb docstrings |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1405 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1406 # Revision 1.44 2002/01/02 02:31:38 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1407 # Sorry for the huge checkin message - I was only intending to implement #496356 |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1408 # but I found a number of places where things had been broken by transactions: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1409 # . modified ROUNDUPDBSENDMAILDEBUG to be SENDMAILDEBUG and hold a filename |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1410 # for _all_ roundup-generated smtp messages to be sent to. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1411 # . the transaction cache had broken the roundupdb.Class set() reactors |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1412 # . newly-created author users in the mailgw weren't being committed to the db |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1413 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1414 # Stuff that made it into CHANGES.txt (ie. the stuff I was actually working |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1415 # on when I found that stuff :): |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1416 # . #496356 ] Use threading in messages |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1417 # . detectors were being registered multiple times |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1418 # . added tests for mailgw |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1419 # . much better attaching of erroneous messages in the mail gateway |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1420 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1421 # Revision 1.43 2001/12/20 06:13:24 rochecompaan |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1422 # Bugs fixed: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1423 # . Exception handling in hyperdb for strings-that-look-like numbers got |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1424 # lost somewhere |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1425 # . Internet Explorer submits full path for filename - we now strip away |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1426 # the path |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1427 # Features added: |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1428 # . Link and multilink properties are now displayed sorted in the cgi |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1429 # interface |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1430 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1431 # Revision 1.42 2001/12/16 10:53:37 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1432 # take a copy of the node dict so that the subsequent set |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1433 # operation doesn't modify the oldvalues structure |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1434 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1435 # Revision 1.41 2001/12/15 23:47:47 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1436 # Cleaned up some bare except statements |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1437 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1438 # Revision 1.40 2001/12/14 23:42:57 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1439 # yuck, a gdbm instance tests false :( |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1440 # I've left the debugging code in - it should be removed one day if we're ever |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1441 # _really_ anal about performace :) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1442 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1443 # Revision 1.39 2001/12/02 05:06:16 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1444 # . We now use weakrefs in the Classes to keep the database reference, so |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1445 # the close() method on the database is no longer needed. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1446 # I bumped the minimum python requirement up to 2.1 accordingly. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1447 # . #487480 ] roundup-server |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1448 # . #487476 ] INSTALL.txt |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1449 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1450 # I also cleaned up the change message / post-edit stuff in the cgi client. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1451 # There's now a clearly marked "TODO: append the change note" where I believe |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1452 # the change note should be added there. The "changes" list will obviously |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1453 # have to be modified to be a dict of the changes, or somesuch. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1454 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1455 # More testing needed. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1456 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1457 # Revision 1.38 2001/12/01 07:17:50 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1458 # . We now have basic transaction support! Information is only written to |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1459 # the database when the commit() method is called. Only the anydbm |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1460 # backend is modified in this way - neither of the bsddb backends have been. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1461 # The mail, admin and cgi interfaces all use commit (except the admin tool |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1462 # doesn't have a commit command, so interactive users can't commit...) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1463 # . Fixed login/registration forwarding the user to the right page (or not, |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1464 # on a failure) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1465 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1466 # Revision 1.37 2001/11/28 21:55:35 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1467 # . login_action and newuser_action return values were being ignored |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1468 # . Woohoo! Found that bloody re-login bug that was killing the mail |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1469 # gateway. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1470 # (also a minor cleanup in hyperdb) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1471 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1472 # Revision 1.36 2001/11/27 03:16:09 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1473 # Another place that wasn't handling missing properties. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1474 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1475 # Revision 1.35 2001/11/22 15:46:42 jhermann |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1476 # Added module docstrings to all modules. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1477 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1478 # Revision 1.34 2001/11/21 04:04:43 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1479 # *sigh* more missing value handling |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1480 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1481 # Revision 1.33 2001/11/21 03:40:54 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1482 # more new property handling |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1483 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1484 # Revision 1.32 2001/11/21 03:11:28 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1485 # Better handling of new properties. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1486 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1487 # Revision 1.31 2001/11/12 22:01:06 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1488 # Fixed issues with nosy reaction and author copies. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1489 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1490 # Revision 1.30 2001/11/09 10:11:08 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1491 # . roundup-admin now handles all hyperdb exceptions |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1492 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1493 # Revision 1.29 2001/10/27 00:17:41 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1494 # Made Class.stringFind() do caseless matching. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1495 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1496 # Revision 1.28 2001/10/21 04:44:50 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1497 # bug #473124: UI inconsistency with Link fields. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1498 # This also prompted me to fix a fairly long-standing usability issue - |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1499 # that of being able to turn off certain filters. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1500 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1501 # Revision 1.27 2001/10/20 23:44:27 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1502 # Hyperdatabase sorts strings-that-look-like-numbers as numbers now. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1503 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1504 # Revision 1.26 2001/10/16 03:48:01 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1505 # admin tool now complains if a "find" is attempted with a non-link property. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1506 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1507 # Revision 1.25 2001/10/11 00:17:51 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1508 # Reverted a change in hyperdb so the default value for missing property |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1509 # values in a create() is None and not '' (the empty string.) This obviously |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1510 # breaks CSV import/export - the string 'None' will be created in an |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1511 # export/import operation. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1512 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1513 # Revision 1.24 2001/10/10 03:54:57 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1514 # Added database importing and exporting through CSV files. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1515 # Uses the csv module from object-craft for exporting if it's available. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1516 # Requires the csv module for importing. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1517 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1518 # Revision 1.23 2001/10/09 23:58:10 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1519 # Moved the data stringification up into the hyperdb.Class class' get, set |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1520 # and create methods. This means that the data is also stringified for the |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1521 # journal call, and removes duplication of code from the backends. The |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1522 # backend code now only sees strings. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1523 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1524 # Revision 1.22 2001/10/09 07:25:59 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1525 # Added the Password property type. See "pydoc roundup.password" for |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1526 # implementation details. Have updated some of the documentation too. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1527 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1528 # Revision 1.21 2001/10/05 02:23:24 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1529 # . roundup-admin create now prompts for property info if none is supplied |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1530 # on the command-line. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1531 # . hyperdb Class getprops() method may now return only the mutable |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1532 # properties. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1533 # . Login now uses cookies, which makes it a whole lot more flexible. We can |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1534 # now support anonymous user access (read-only, unless there's an |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1535 # "anonymous" user, in which case write access is permitted). Login |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1536 # handling has been moved into cgi_client.Client.main() |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1537 # . The "extended" schema is now the default in roundup init. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1538 # . The schemas have had their page headings modified to cope with the new |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1539 # login handling. Existing installations should copy the interfaces.py |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1540 # file from the roundup lib directory to their instance home. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1541 # . Incorrectly had a Bizar Software copyright on the cgitb.py module from |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1542 # Ping - has been removed. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1543 # . Fixed a whole bunch of places in the CGI interface where we should have |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1544 # been returning Not Found instead of throwing an exception. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1545 # . Fixed a deviation from the spec: trying to modify the 'id' property of |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1546 # an item now throws an exception. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1547 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1548 # Revision 1.20 2001/10/04 02:12:42 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1549 # Added nicer command-line item adding: passing no arguments will enter an |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1550 # interactive more which asks for each property in turn. While I was at it, I |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1551 # fixed an implementation problem WRT the spec - I wasn't raising a |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1552 # ValueError if the key property was missing from a create(). Also added a |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1553 # protected=boolean argument to getprops() so we can list only the mutable |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1554 # properties (defaults to yes, which lists the immutables). |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1555 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1556 # Revision 1.19 2001/08/29 04:47:18 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1557 # Fixed CGI client change messages so they actually include the properties |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1558 # changed (again). |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1559 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1560 # Revision 1.18 2001/08/16 07:34:59 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1561 # better CGI text searching - but hidden filter fields are disappearing... |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1562 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1563 # Revision 1.17 2001/08/16 06:59:58 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1564 # all searches use re now - and they're all case insensitive |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1565 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1566 # Revision 1.16 2001/08/15 23:43:18 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1567 # Fixed some isFooTypes that I missed. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1568 # Refactored some code in the CGI code. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1569 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1570 # Revision 1.15 2001/08/12 06:32:36 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1571 # using isinstance(blah, Foo) now instead of isFooType |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1572 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1573 # Revision 1.14 2001/08/07 00:24:42 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1574 # stupid typo |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1575 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1576 # Revision 1.13 2001/08/07 00:15:51 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1577 # Added the copyright/license notice to (nearly) all files at request of |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1578 # Bizar Software. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1579 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1580 # Revision 1.12 2001/08/02 06:38:17 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1581 # Roundupdb now appends "mailing list" information to its messages which |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1582 # include the e-mail address and web interface address. Templates may |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1583 # override this in their db classes to include specific information (support |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1584 # instructions, etc). |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1585 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1586 # Revision 1.11 2001/08/01 04:24:21 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1587 # mailgw was assuming certain properties existed on the issues being created. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1588 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1589 # Revision 1.10 2001/07/30 02:38:31 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1590 # get() now has a default arg - for migration only. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1591 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1592 # Revision 1.9 2001/07/29 09:28:23 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1593 # Fixed sorting by clicking on column headings. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1594 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1595 # Revision 1.8 2001/07/29 08:27:40 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1596 # Fixed handling of passed-in values in form elements (ie. during a |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1597 # drill-down) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1598 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1599 # Revision 1.7 2001/07/29 07:01:39 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1600 # Added vim command to all source so that we don't get no steenkin' tabs :) |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1601 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1602 # Revision 1.6 2001/07/29 05:36:14 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1603 # Cleanup of the link label generation. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1604 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1605 # Revision 1.5 2001/07/29 04:05:37 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1606 # Added the fabricated property "id". |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1607 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1608 # Revision 1.4 2001/07/27 06:25:35 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1609 # Fixed some of the exceptions so they're the right type. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1610 # Removed the str()-ification of node ids so we don't mask oopsy errors any |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1611 # more. |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1612 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1613 # Revision 1.3 2001/07/27 05:17:14 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1614 # just some comments |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1615 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1616 # Revision 1.2 2001/07/22 12:09:32 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1617 # Final commit of Grande Splite |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1618 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1619 # Revision 1.1 2001/07/22 11:58:35 richard |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1620 # More Grande Splite |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1621 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1622 # |
|
07d8a4e296f8
Whee! It's not finished yet, but I can create a new instance...
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
1623 # vim: set filetype=python ts=4 sw=4 et si |
