entity.py
branchstable
changeset 7139 20807d3d7cf6
parent 6954 f9a84d54ebf3
child 7152 39c1ffc7d93f
child 7200 81fd6e40a6a8
equal deleted inserted replaced
7138:9aba650eea6b 7139:20807d3d7cf6
    58     # the check for ?, /, & are to prevent problems when running
    58     # the check for ?, /, & are to prevent problems when running
    59     # behind Apache mod_proxy
    59     # behind Apache mod_proxy
    60     if value == u'' or u'?' in value or u'/' in value or u'&' in value:
    60     if value == u'' or u'?' in value or u'/' in value or u'&' in value:
    61         return False
    61         return False
    62     return True
    62     return True
    63 
       
    64 
    63 
    65 
    64 
    66 class Entity(AppObject):
    65 class Entity(AppObject):
    67     """an entity instance has e_schema automagically set on
    66     """an entity instance has e_schema automagically set on
    68     the class and instances has access to their issuing cursor.
    67     the class and instances has access to their issuing cursor.
   806             if not self.has_eid():
   805             if not self.has_eid():
   807                 existant = searchedvar
   806                 existant = searchedvar
   808             else:
   807             else:
   809                 existant = None # instead of 'SO', improve perfs
   808                 existant = None # instead of 'SO', improve perfs
   810             for select in rqlst.children:
   809             for select in rqlst.children:
   811                 rewriter.rewrite(select, [((searchedvar, searchedvar), rqlexprs)],
   810                 varmap = {}
       
   811                 for var in 'SO':
       
   812                     if var in select.defined_vars:
       
   813                         varmap[var] = var
       
   814                 rewriter.rewrite(select, [(varmap, rqlexprs)],
   812                                  select.solutions, args, existant)
   815                                  select.solutions, args, existant)
   813             rql = rqlst.as_string()
   816             rql = rqlst.as_string()
   814         return rql, args
   817         return rql, args
   815 
   818 
   816     def unrelated(self, rtype, targettype, role='subject', limit=None,
   819     def unrelated(self, rtype, targettype, role='subject', limit=None,