Commits

Lynn Rees committed 1af2621

- fixes

Comments (0)

Files changed (13)

graphalchemy/finders.py

 # settings
 conf = octopus.S
 # decorators
-direct = octopus.decorators.direct
+direct = octopus.context.direct
 
 
-class Finder(octopus.things.context):
+class Finder(octopus.context.thing):
 
     '''model finder'''
 
         '''
         if element is not None:
             try:
-                return self.Q.get(element['_model'], self.S.userspace)
+                return self.M.get(element['_model'], self.S.userspace)
             except (NoAppError, KeyError):
                 pass
         elif isinstance(model, string_types):
-            return self.Q.get(model, self.S.userspace)
+            return self.M.get(model, self.S.userspace)
         return model if model else self.generic
 
 

graphalchemy/generics/collectors.py

 # settings
 conf = octopus.S
 # decorators
-direct = octopus.decorators.direct
+direct = octopus.context.direct
 
 
 class Links(LinksMixin):

graphalchemy/generics/elements.py

 # settings
 conf = octopus.S
 # decorators
-direct = octopus.decorators.direct
-defer = octopus.decorators.defer
+direct = octopus.context.direct
+defer = octopus.context.defer
 
 
-class Generic(ElementMixin, octopus.things.workflow):
+class Generic(ElementMixin, octopus.process.thing):
 
     '''generic graph model'''
 

graphalchemy/graphs.py

 # settings
 conf = octopus.S
 # decorators
-subscribe = octopus.decorators.subscribe
+subscribe = octopus.context.subscribe
 
 
-class Session(octopus.locals.process):
+class Session(octopus.workflow.session):
 
     '''graph session'''
 
         '''
         super(Session, self).__init__(manager, max_length)
         # pipe for abort
-        self.M.pipe('abort', self.nodes.close)
+        self.M.pipe('abort', self.close)
 
     def __exit__(self, e, b, c):
         with self.nodes.transaction:
         self.nodes.close()
 
 
-class Graph(octopus.globals.process):
+class Graph(octopus.workflow.manager):
 
     '''graph interface'''
 
         @param url: database url
         '''
         super(Graph, self).__init__(**kw)
-        # get query
-        Q = self.Q
         # default settings
         defaults = self.defaults
         # required settings
         # database configuration in url format
         self.url = url
         # open database
-        self._db = Q.apply(database, required.backends, url)
+        self._db = self.apply(database, required.backends, url)
         # add manager instance to appspace
-        Q.set(self, graph_manager, userspace)
+        self.set(self, graph_manager, userspace)
         # add data source to appspace
-        Q.set(self._db, self.S.key.backend, userspace)
+        self.set(self._db, self.S.key.backend, userspace)
 
     def __repr__(self):
         return '{name}@{url}'.format(

graphalchemy/managers.py

 wrapper = conf.wrapper
 writer = conf.writer
 # decorators
-direct = octopus.decorators.direct
-factory = octopus.decorators.factory
-subscribe = octopus.decorators.subscribe
+direct = octopus.context.direct
+factory = octopus.context.factory
+subscribe = octopus.context.subscribe
 
 
-class Manager(octopus.flows.process):
+class Manager(octopus.workflow.flow):
 
     '''graph element manager base'''
 

graphalchemy/mixins/collections.py

 __all__ = ('LinksMixin', 'NodesMixin')
 
 
-class CollectionMixin(octopus.things.context):
+class CollectionMixin(octopus.context.thing):
 
     '''element collection'''
 

graphalchemy/mixins/collectors.py

 appspace = conf.appspace
 finder = conf.model.finder
 # decorators
-direct = octopus.decorators.direct
+direct = octopus.context.direct
 
 
-class CollectorsMixin(octopus.locals.context):
+class CollectorsMixin(octopus.context.thing):
 
     '''element collections collector'''
 

graphalchemy/mixins/elements.py

 # settings
 conf = getattr(octopus, 'S')
 # decorators
-defer = octopus.decorators.defer
-direct = octopus.decorators.direct
+defer = octopus.context.defer
+direct = octopus.context.direct
 
 
 class ElementMixin(object):

graphalchemy/models/collectors.py

 # settings
 conf = octopus.S
 # decorators
-direct = octopus.decorators.direct
+direct = octopus.context.direct
 
 
 class Nodes(NodesMixin):
             )
 
 
-class Direction(octopus.things.context):
+class Direction(octopus.context.thing):
 
     '''direction definition'''
 

graphalchemy/models/elements.py

 # settings
 conf = octopus.S
 # decorators
-class_defer = octopus.decorators.class_defer
-defer = octopus.decorators.defer
-direct = octopus.decorators.direct
+class_defer = octopus.context.class_defer
+defer = octopus.context.defer
+direct = octopus.context.direct
 
 
-class Node(NodeMixin, ElementMixin, octopus.things.process):
+class Node(NodeMixin, ElementMixin, octopus.workflow.thing):
 
     '''node model'''
 
 
     @classmethod
     def _link(cls):
-        return cls.Q.get(cls.S.generic.element.link, cls.S.generics)
+        return cls.M.get(cls.S.generic.element.link, cls.S.generics)
 
     @defer
     def _versioning(self, diff):

graphalchemy/readers.py

 # settings
 conf = octopus.S
 # decorators
-direct = octopus.decorators.direct
-factory = octopus.decorators.factory
-service = octopus.decorators.service
+direct = octopus.context.direct
+factory = octopus.context.factory
+service = octopus.context.service
 
 
-class Reader(octopus.things.pub):
+class Reader(octopus.context.publisher):
 
     '''graph reader base'''
 
             anchor_link = C.anchor_link
             S = self.S
             userspace = S.userspace
-            return self.Q.get(anchor_link, userspace)
+            return self.M.get(anchor_link, userspace)
         except AppLookupError:
             label = S.anchor.label
             anchor = self.filter_by(C.index, label, label)
             if anchor:
-                self.Q.set(anchor, anchor_link, userspace)
+                self.M.set(anchor, anchor_link, userspace)
                 return anchor
             
     def close(self):
             if model is None:
                 model = self._finder(model)
             C = model.C
-            return self.Q.get(C.reference_link, S.userspace)
+            return self.M.get(C.reference_link, S.userspace)
         except AppLookupError:
             label = S.reference.label
             ref = self.filter_by(C.index, label, label)
             if ref:
-                self.Q.set(ref, C.reference_link, S.userspace)
+                self.M.set(ref, C.reference_link, S.userspace)
                 return ref
 
     def root(self):
         '''
         try:
             S = self.S
-            return self.Q.get(S.root, S.userspace)
+            return self.M.get(S.root, S.userspace)
         except AppLookupError:
             root = self.r.root
             root = self._finder(element=root)(root)
-            self.Q.set(root, S.root, S.userspace)
+            self.M.set(root, S.root, S.userspace)
             return root
 
     def walk(self, this, direction=None, label=None, keys=None, end='end'):

graphalchemy/wrappers.py

 reader = conf.reader
 writer = conf.writer
 # decorators
-direct = octopus.decorators.direct
-subscribe = octopus.decorators.subscribe
+direct = octopus.context.direct
+subscribe = octopus.context.subscribe
 
 
-class Wrapper(octopus.flows.process):
+class Wrapper(octopus.workflow.flow):
 
     '''graph model wrapper'''
 

graphalchemy/writers.py

 backends = conf.backends
 db = conf.key.db
 # decorators
-defer = octopus.decorators.defer
-direct = octopus.decorators.direct
-factory = octopus.decorators.factory
-service = octopus.decorators.service
+defer = octopus.context.defer
+direct = octopus.context.direct
+factory = octopus.context.factory
+service = octopus.context.service
 
 
-class Writer(octopus.things.pub):
+class Writer(octopus.context.publisher):
 
     '''graph writer base'''
 
         '''
         if kw is None:
             kw = {}
-        kw.update(_created=self.now(), _uuid=self.Q.uuid())
+        kw.update(_created=self.now(), _uuid=self.A.uuid())
         return self.w.build(link, start, end, **kw)
 
 
         slug_from = C.slug_from
         if not slug_from:
             return
-        slug = tmpslug = self.Q.slugify(properties[slug_from])
+        slug = tmpslug = self.A.slugify(properties[slug_from])
         slug_field = C.slug_field
         # loop until unique slug is located
         filter_by = self.r.filter_by
             return node
         data = dict(
             _created=self.now(),
-            _uuid=self.Q.uuid(),
+            _uuid=self.A.uuid(),
             text=S.description.format(name=name),
         )
         data.update(kw)
         if model is None:
             model = self._finder(model)
         C = model.C
-        data.update(_created=self.now(), _model=C.name, _uuid=self.Q.uuid())
+        data.update(_created=self.now(), _model=C.name, _uuid=self.A.uuid())
         # number of versions to maintain
         if C.versioned:
             data['_versions'] = 0
         @param data: data
         @param model: graph model (default: None)
         '''
-        data.update(_created=self.now(), _uuid=self.Q.uuid())
+        data.update(_created=self.now(), _uuid=self.A.uuid())
         return self.w.build(data)
 
     @service('model')
         h = self
         data = dict(
             _created=h.now(),
-            _uuid=self.Q.uuid(),
+            _uuid=self.A.uuid(),
             text=S.description.format(name=name),
         )
         data.update(kw)