Commits

Lynn Rees  committed a9adb30

- fixes

  • Participants
  • Parent commits 75f6d0c

Comments (0)

Files changed (10)

File graphalchemy/backends/apps.py

             node = 'graphalchemy.backends.neo4jem.NodeWrite'
 
 
-appconf = Appconf.create()
+appconf = Appconf.build()

File graphalchemy/direct/apps.py

             node = 'graphalchemy.direct.workers.Nodes'
 
 
-appconf = Appconf.create()
+appconf = Appconf.build()

File graphalchemy/direct/workers.py

     _db = app(conf.key.backend, conf.userspace)
     _model = app(conf.direct.element.link, conf.direct)
     # direct link reader
-    _r = factory(conf.read.link, backends, db)
+    _r = factory(conf.readlink, backends, db)
     # direct link writer
-    _w = factory(conf.write.link, backends, db)
+    _w = factory(conf.writelink, backends, db)
 
     ###########################################################################
     ## link write methods #####################################################
 
     _model = app(conf.direct.element.node, conf.direct)
     # direct node reader
-    _r = factory(conf.read.node, backends, db)
+    _r = factory(conf.readnode, backends, db)
     # direct node writer
-    _w = factory(conf.write.node, backends, db)
+    _w = factory(conf.writenode, backends, db)
 
     ###########################################################################
     ## node write methods #####################################################

File graphalchemy/graphs.py

         database, split = url.split(':')
         # database path
         url = self.url = url2pathname(split)
-        # database settings
+        Q = self.Q
+        # update with database information
+        Q.settings.update(defaults.engines[database])
+        # freeze settings
+        self.freeze(
+            database=database,
+            # store database configuration
+            url=url,
+             # userspace name
+            userspace=userspace,
+            # store graph manager name
+            manager=graph_manager,
+        )
         G = self.G
-        dbsettings = G.backends[database]
-        # freeze settings
-        self.freeze({
-            # database connector
-            'connecton': dbsettings.connection,
-            # database closer
-            'close': dbsettings.close,
-            # raw database services
-            'raw': dbsettings.raw,
-            # database transaction
-            'transaction': dbsettings.transaction,
-            # database link read manager
-            'read.link': dbsettings.read.link,
-            # database node read manager
-            'read.node': dbsettings.read.node,
-            # database link write manager
-            'write.link': dbsettings.write.link,
-            # database node write manager
-            'write.node': dbsettings.write.node,
-            # store database source
-            'database': database,
-            # store database configuration
-            'url': url,
-             # userspace name
-            'userspace': userspace,
-            # store graph manager name
-            'manager.graph': graph_manager,
-        })
         # open database
-        self._db = self.Q.apply(G.connection, G.backends, url)
+        self._db = Q.apply(G.connection, G.backends, url)
         # add data source to appspace
-        self.Q.add(self._db, G.key.backend, userspace)
+        Q.add(self._db, G.key.backend, userspace)
         # pipe close
         self.pipe('abort', G.close, G.appspace)
         # add manager instance to appspace
-        self.Q.add(self, graph_manager, userspace)
+        Q.add(self, graph_manager, userspace)
 
     def __repr__(self):
         return '{name}@{url}'.format(

File graphalchemy/models/apps.py

             node = 'graphalchemy.models.workers.Nodes'
 
 
-appconf = Appconf.create()
+appconf = Appconf.build()

File graphalchemy/models/readers.py

     # model finder
     _finder = app(conf.model.finder.node, conf.appspace)
     # direct node reader
-    _r = factory(conf.read.node, backends, db)
+    _r = factory(conf.readnode, backends, db)
     # direct node writer
-    _w = factory(conf.write.node, backends, db)
+    _w = factory(conf.writenode, backends, db)
 
     def __init__(self, model):
         '''

File graphalchemy/models/workers.py

     # model user
     _using = app(conf.model.node.writer, conf.appspace)
     # node reader
-    _r = factory(conf.read.node, backends, db)
+    _r = factory(conf.readnode, backends, db)
     # node writer
-    _w = factory(conf.write.node, backends, db)
+    _w = factory(conf.writenode, backends, db)
     # direct
     direct = factory(conf.direct.worker.node, conf.direct, conf.key.session)
     # raw

File graphalchemy/models/writers.py

     # model finder
     _finder = app(conf.model.finder.node, conf.appspace)
     # direct node reader
-    _r = factory(conf.read.node, backends, db)
+    _r = factory(conf.readnode, backends, db)
     # direct node writer
-    _w = factory(conf.write.node, backends, db)
+    _w = factory(conf.writenode, backends, db)
 
     def __init__(self, model):
         '''

File graphalchemy/sessions.py

     # node monager
     nodes = extend(conf.model.worker.node, conf.models)
     # transaction monager
-    transaction = call(conf.transaction, conf.userspace)
+    transaction = call(conf.transaction, conf.backends, conf.key.db)
+
+    def __init__(self, manager):
+        super(Session, self).__init__(manager)
+        self._db = manager._db
 
     def __exit__(self, e, b, c):
         with self.transaction:

File graphalchemy/settings.py

         class worker:
             node = 'direct.worker.node'
 
-    class backends:
+    class engines:
 
         class neo4jem:
-            close = 'backends.neo4jem.close'
-            connection = 'backends.neo4jem.connection'
-            raw = 'backends.neo4jem.raw'
-            transaction = 'backends.neo4jem.transaction'
+            close = 'neo4jem.close'
+            connection = 'neo4jem.connection'
+            raw = 'neo4jem.raw'
+            transaction = 'neo4jem.transaction'
 
             class read:
-                link = 'backends.neo4jem.read.link'
-                node = 'backends.neo4jem.read.node'
+                link = 'neo4jem.read.link'
+                node = 'neo4jem.read.node'
 
             class write:
-                link = 'backends.neo4jem.write.link'
-                node = 'backends.neo4jem.write.node'
+                link = 'neo4jem.write.link'
+                node = 'neo4jem.write.node'