rqlrewrite.py
changeset 10612 84468b90e9c1
parent 10588 fdaa0e4b7eaf
child 10662 10942ed172de
equal deleted inserted replaced
10611:f4dec0cca9a1 10612:84468b90e9c1
    19 tree.
    19 tree.
    20 
    20 
    21 This is used for instance for read security checking in the repository.
    21 This is used for instance for read security checking in the repository.
    22 """
    22 """
    23 __docformat__ = "restructuredtext en"
    23 __docformat__ = "restructuredtext en"
       
    24 
       
    25 from six import string_types
    24 
    26 
    25 from rql import nodes as n, stmts, TypeResolverException
    27 from rql import nodes as n, stmts, TypeResolverException
    26 from rql.utils import common_parent
    28 from rql.utils import common_parent
    27 
    29 
    28 from yams import BadSchemaDefinition
    30 from yams import BadSchemaDefinition
   881             vi = self.varinfos[index]
   883             vi = self.varinfos[index]
   882             if vi.get('const') is not None:
   884             if vi.get('const') is not None:
   883                 return n.Constant(vi['const'], 'Int')
   885                 return n.Constant(vi['const'], 'Int')
   884             return n.VariableRef(stmt.get_variable(selectvar))
   886             return n.VariableRef(stmt.get_variable(selectvar))
   885         vname_or_term = self._get_varname_or_term(node.name)
   887         vname_or_term = self._get_varname_or_term(node.name)
   886         if isinstance(vname_or_term, basestring):
   888         if isinstance(vname_or_term, string_types):
   887             return n.VariableRef(stmt.get_variable(vname_or_term))
   889             return n.VariableRef(stmt.get_variable(vname_or_term))
   888         # shared term
   890         # shared term
   889         return vname_or_term.copy(stmt)
   891         return vname_or_term.copy(stmt)
   890 
   892 
   891     def current_statement(self):
   893     def current_statement(self):