[Checkins] SVN: Sandbox/adamg/ocql/branches/dbprovider/src/ocql/testing/ comment implementation details for relation between project and the mentor

Charith Paranaliyanage paranaliyanage at gmail.com
Tue Jul 1 06:01:25 EDT 2008


Log message for revision 87876:
  comment implementation details for relation between project and the mentor

Changed:
  U   Sandbox/adamg/ocql/branches/dbprovider/src/ocql/testing/sample/interfaces.py
  U   Sandbox/adamg/ocql/branches/dbprovider/src/ocql/testing/sample/project.py
  U   Sandbox/adamg/ocql/branches/dbprovider/src/ocql/testing/utils.py

-=-
Modified: Sandbox/adamg/ocql/branches/dbprovider/src/ocql/testing/sample/interfaces.py
===================================================================
--- Sandbox/adamg/ocql/branches/dbprovider/src/ocql/testing/sample/interfaces.py	2008-07-01 09:55:37 UTC (rev 87875)
+++ Sandbox/adamg/ocql/branches/dbprovider/src/ocql/testing/sample/interfaces.py	2008-07-01 10:01:24 UTC (rev 87876)
@@ -59,8 +59,8 @@
 
     contains(".IProject", ".IStudent", ".IMentor")
     
-class IProjectRelation(Interface):
-    mentor = Attribute('assigned mentor for the project')
-    project = Attribute('mentoring project')
-    
-    
\ No newline at end of file
+#class IProjectRelation(Interface):
+#    mentor = Attribute('assigned mentor for the project')
+#    project = Attribute('mentoring project')
+#    
+#    
\ No newline at end of file

Modified: Sandbox/adamg/ocql/branches/dbprovider/src/ocql/testing/sample/project.py
===================================================================
--- Sandbox/adamg/ocql/branches/dbprovider/src/ocql/testing/sample/project.py	2008-07-01 09:55:37 UTC (rev 87875)
+++ Sandbox/adamg/ocql/branches/dbprovider/src/ocql/testing/sample/project.py	2008-07-01 10:01:24 UTC (rev 87876)
@@ -3,7 +3,7 @@
 from zope.interface import Interface
 import persistent
 
-from ocql.testing.sample.interfaces import IProject, IProjectRelation
+from ocql.testing.sample.interfaces import IProject
 
 class Project(persistent.Persistent):
     """A simple implementation of a Project .
@@ -34,9 +34,9 @@
         return "%s <%s>" % (self.__class__.__name__, self.name)
 
 
-class ProjectRelation(object):
-    implements(IProjectRelation)
-    
-    def __init__(self, mentor, project):
-        self.mentor = mentor
-        self.project = project
+#class ProjectRelation(object):
+#    implements(IProjectRelation)
+#    
+#    def __init__(self, mentor, project):
+#        self.mentor = mentor
+#        self.project = project

Modified: Sandbox/adamg/ocql/branches/dbprovider/src/ocql/testing/utils.py
===================================================================
--- Sandbox/adamg/ocql/branches/dbprovider/src/ocql/testing/utils.py	2008-07-01 09:55:37 UTC (rev 87875)
+++ Sandbox/adamg/ocql/branches/dbprovider/src/ocql/testing/utils.py	2008-07-01 10:01:24 UTC (rev 87876)
@@ -19,12 +19,12 @@
 from zope.app.keyreference.testing import SimpleKeyReference
 
 from ocql.testing.sample.interfaces import IOrganization
-from ocql.testing.sample.interfaces import IProject, IProjectRelation
+from ocql.testing.sample.interfaces import IProject
 from ocql.testing.sample.interfaces import IStudent
 from ocql.testing.sample.interfaces import IMentor
 
 from ocql.testing.sample.mentor import Mentor
-from ocql.testing.sample.project import Project, ProjectRelation
+from ocql.testing.sample.project import Project
 from ocql.testing.sample.student import Student
 from ocql.testing.sample.organization import Organization
         
@@ -33,8 +33,8 @@
 import zc.relation.queryfactory
 import BTrees
 
-_obj = {}
-_relation = {}
+#_obj = {}
+#_relation = {}
 
 def setupInterfaces(test):
     provideInterface('', IOrganization)
@@ -42,22 +42,22 @@
     provideInterface('', IStudent)
     provideInterface('', IMentor)
 
-def dumpObj(obj, catalog, cache):
-    if _obj.setdefault(obj.name,obj) is not obj:
-        raise ValueError('mentor can only take one project')
-    return obj
+#def dumpObj(obj, catalog, cache):
+#    if _obj.setdefault(obj.name,obj) is not obj:
+#        raise ValueError('mentor can only take one project')
+#    return obj
+#
+#def loadObj(token, catalog, cache):
+#    return _obj[token]
+#
+#def dumpRelation(obj, catalog, cache):
+#    if _relation.setdefault(id(obj),obj) is not obj:
+#        raise ValueError('same relation')
+#    return id(obj)
+#
+#def loadRelation(token, catalog, cache):
+#    return _relation[token]
 
-def loadObj(token, catalog, cache):
-    return _obj[token]
-
-def dumpRelation(obj, catalog, cache):
-    if _relation.setdefault(id(obj),obj) is not obj:
-        raise ValueError('same relation')
-    return id(obj)
-
-def loadRelation(token, catalog, cache):
-    return _relation[token]
-
 def setupCatalog(test):
     intids = IntIds()
     component.provideUtility(intids, IIntIds)
@@ -109,20 +109,20 @@
     id = intids.register(o1)
     cat.index_doc(id, o1)
     
-    cat2 = zc.relation.catalog.Catalog(dumpRelation, loadRelation)
-    cat2.addValueIndex(IProjectRelation['project'], dumpObj, loadObj, btree=BTrees.family32.OO)
-    cat2.addValueIndex(IProjectRelation['mentor'], dumpObj, loadObj, btree=BTrees.family32.OO)
-    cat2.addDefaultQueryFactory(zc.relation.queryfactory.TransposingTransitive('project','mentor'))
-
-    rel = ProjectRelation(m1, p1)
-    cat2.index(rel)
-    component.provideUtility(cat2, zc.relation.interfaces.ICatalog, name='rel-catalog')
+#    cat2 = zc.relation.catalog.Catalog(dumpRelation, loadRelation)
+#    cat2.addValueIndex(IProjectRelation['project'], dumpObj, loadObj, btree=BTrees.family32.OO)
+#    cat2.addValueIndex(IProjectRelation['mentor'], dumpObj, loadObj, btree=BTrees.family32.OO)
+#    cat2.addDefaultQueryFactory(zc.relation.queryfactory.TransposingTransitive('project','mentor'))
+#
+#    rel = ProjectRelation(m1, p1)
+#    cat2.index(rel)
+#    component.provideUtility(cat2, zc.relation.interfaces.ICatalog, name='rel-catalog')
     component.provideUtility(cat, ICatalog, name='foo-catalog')
 
 def queryCatalog():
     cat = component.getUtility(ICatalog, name='foo-catalog')
-    cat2 = component.getUtility(zc.relation.interfaces.ICatalog, name='rel-catalog')
-    query = cat2.tokenizeQuery
+#    cat2 = component.getUtility(zc.relation.interfaces.ICatalog, name='rel-catalog')
+#    query = cat2.tokenizeQuery
     intids = component.getUtility(IIntIds)
 
     results = cat.apply({'student_name':('Charith','Charith')})
@@ -137,10 +137,10 @@
         obj = intids.getObject(r)
         print obj
         
-    rel_mentor = cat.apply({'all_mentors':(1,1)})
-    
-    for r in rel_mentor:
-        obj = intids.getObject(r)     
-        for p in cat2.findValueTokens('project',query(mentor=obj)):
-            print p.name
-    
\ No newline at end of file
+#    rel_mentor = cat.apply({'all_mentors':(1,1)})
+#    
+#    for r in rel_mentor:
+#        obj = intids.getObject(r)     
+#        for p in cat2.findValueTokens('project',query(mentor=obj)):
+#            print p.name
+#    
\ No newline at end of file



More information about the Checkins mailing list