Changeset 2945
- Timestamp:
- 02/22/07 15:17:22 (2 years ago)
- Files:
-
- sandbox/lekma/README (modified) (1 diff)
- sandbox/lekma/TODO (added)
- sandbox/lekma/schevoz/usr/lib/schevoz/schemas/system/schema_001.py (modified) (4 diffs)
- sandbox/lekma/schevoz/usr/lib/schevoz/server.py (modified) (3 diffs)
- sandbox/lekma/tests (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/lekma/README
r2895 r2945 13 13 4. and then run: /path/to/schevoz/usr/bin/schevoz -c /path/to/schevoz/etc/schevoz/schevoz.cfg 14 14 15 there are some test script in the 'tests' folder, notably test_client_create.py16 that creates a db remotly, and test_client.py test_client2.py to test concurrent17 acces to a db.18 19 15 please forgive the crudeness of the code, it is still an experiment :) sandbox/lekma/schevoz/usr/lib/schevoz/schemas/system/schema_001.py
r2894 r2945 38 38 # initial data 39 39 _initial = [ 40 ("admin", " d033e22ae348aeb5660fc2140aec35850c4da997"),40 ("admin", "c759eaf09e4638954f63ace0ce1b53b40f62ccb7"), 41 41 ] 42 42 … … 55 55 # initial data 56 56 _initial = [ 57 ("system", ".system"),58 57 ("template", ".template"), 59 58 ] … … 69 68 db_file = "%s/Data.fs" % db_path 70 69 70 # checking 71 71 if os.path.isfile(db_file): 72 72 raise Exception("a '%s' db already exists in '%s'." % (db_name, zeo_datadir)) 73 if db.Db.findone(name=db_name): 74 raise Exception("a '%s' db already exists in system db." % db_name) 75 76 # create the path if needed 73 77 if not os.path.isdir(db_path): 74 78 os.mkdir(db_path) 75 79 80 # create the actual schevo db 76 81 import schevoz.database 77 new_db = schevoz.database.open(db_file, schema_source) 78 new_db.close() 82 schevoz.database.open(db_file, schema_source).close() 79 83 84 # update system db 80 85 tx = db.Db.t.create() 81 86 tx.name = db_name 82 87 tx.path = db_name 83 db.execute(tx) 88 new_db = db.execute(tx) 89 90 # by default admin has access to all dbs (is this sound?) 91 tx2 = db.Access.t.create() 92 tx2.user = db.User[1] 93 tx2.db = new_db 94 db.execute(tx2) 84 95 85 96 return db_file … … 89 100 90 101 102 class Access(E.Entity): 103 104 # fields 105 user = f.entity("User") 106 db = f.entity("Db") 107 108 # keys 109 _key(user, db) 110 111 # initial data 112 _initial = [ 113 (("admin", ), ("template", )), 114 ] 91 115 92 116 93 117 94 118 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 sandbox/lekma/schevoz/usr/lib/schevoz/server.py
r2894 r2945 16 16 from schevoz import config_defaults 17 17 from schevoz import database 18 from schevoz import zeo18 from schevoz.zeo import server 19 19 20 20 … … 243 243 # published dbs 244 244 for db in self.sys_db.Db.find(): 245 if db.name != "system": 246 db_uri = "%s/%s/Data.fs:%s" % (self._config.zeo_datadir, 247 db.path, db.name) 248 self._db_uris.append(db_uri) 245 db_uri = "%s/%s/Data.fs:%s" % (self._config.zeo_datadir, 246 db.path, db.name) 247 self._db_uris.append(db_uri) 249 248 250 249 … … 265 264 266 265 # intantiate the zeo 267 options = zeo.SchevoZEOOptions()266 options = server.SchevoZEOOptions() 268 267 options.realize(zeo_args) 269 self.zeo = zeo.SchevoZEOServer(options, self.sys_db)268 self.zeo = server.SchevoZEOServer(options, self.sys_db) 270 269 271 270 # and start it
