common/appobject.py
branchtls-sprint
changeset 631 99f5852f8604
parent 447 0e52d72104a6
child 661 4f61eb8a96b7
--- a/common/appobject.py	Mon Feb 16 16:24:24 2009 +0100
+++ b/common/appobject.py	Mon Feb 16 18:26:13 2009 +0100
@@ -304,91 +304,6 @@
         if first in ('insert', 'set', 'delete'):
             raise Unauthorized(self.req._('only select queries are authorized'))
 
-    # .accepts handling utilities #############################################
-    
-    accepts = ('Any',)
-
-    @classmethod
-    def accept_rset(cls, req, rset, row, col):
-        """apply the following rules:
-        * if row is None, return the sum of values returned by the method
-          for each entity's type in the result set. If any score is 0,
-          return 0.
-        * if row is specified, return the value returned by the method with
-          the entity's type of this row
-        """
-        if row is None:
-            score = 0
-            for etype in rset.column_types(0):
-                accepted = cls.accept(req.user, etype)
-                if not accepted:
-                    return 0
-                score += accepted
-            return score
-        return cls.accept(req.user, rset.description[row][col or 0])
-        
-    @classmethod
-    def accept(cls, user, etype):
-        """score etype, returning better score on exact match"""
-        if 'Any' in cls.accepts:
-            return 1
-        eschema = cls.schema.eschema(etype)
-        matching_types = [e.type for e in eschema.ancestors()]
-        matching_types.append(etype)
-        for index, basetype in enumerate(matching_types):
-            if basetype in cls.accepts:
-                return 2 + index
-        return 0
-    
-    # .rtype  handling utilities ##############################################
-    
-    @classmethod
-    def relation_possible(cls, etype):
-        """tell if a relation with etype entity is possible according to 
-        mixed class'.etype, .rtype and .target attributes
-
-        XXX should probably be moved out to a function
-        """
-        schema = cls.schema
-        rtype = cls.rtype
-        eschema = schema.eschema(etype)
-        if hasattr(cls, 'role'):
-            role = cls.role
-        elif cls.target == 'subject':
-            role = 'object'
-        else:
-            role = 'subject'
-        # check if this relation is possible according to the schema
-        try:
-            if role == 'object':
-                rschema = eschema.object_relation(rtype)
-            else:
-                rschema = eschema.subject_relation(rtype)
-        except KeyError:
-            return False            
-        if hasattr(cls, 'etype'):
-            letype = cls.etype
-            try:
-                if role == 'object':
-                    return etype in rschema.objects(letype)
-                else:
-                    return etype in rschema.subjects(letype)
-            except KeyError, ex:
-                return False
-        return True
-
-    
-    # XXX deprecated (since 2.43) ##########################
-    
-    @obsolete('use req.datadir_url')
-    def datadir_url(self):
-        """return url of the application's data directory"""
-        return self.req.datadir_url
-
-    @obsolete('use req.external_resource()')
-    def external_resource(self, rid, default=_MARKER):
-        return self.req.external_resource(rid, default)
-
         
 class AppObject(AppRsetObject):
     """base class for application objects which are not selected