selectors.py
changeset 6141 b8287e54b528
parent 6140 65a619eb31c4
child 6366 1806148d6ce8
equal deleted inserted replaced
6140:65a619eb31c4 6141:b8287e54b528
  1201         return score
  1201         return score
  1202 
  1202 
  1203 
  1203 
  1204 # Web request selectors ########################################################
  1204 # Web request selectors ########################################################
  1205 
  1205 
       
  1206 # XXX deprecate
  1206 @objectify_selector
  1207 @objectify_selector
  1207 @lltrace
  1208 @lltrace
  1208 def primary_view(cls, req, view=None, **kwargs):
  1209 def primary_view(cls, req, view=None, **kwargs):
  1209     """Return 1 if:
  1210     """Return 1 if:
  1210 
  1211 
  1250         except AttributeError:
  1251         except AttributeError:
  1251             return 1 # class doesn't care about search state, accept it
  1252             return 1 # class doesn't care about search state, accept it
  1252         return 1
  1253         return 1
  1253 
  1254 
  1254 
  1255 
       
  1256 # XXX deprecate
  1255 @objectify_selector
  1257 @objectify_selector
  1256 @lltrace
  1258 @lltrace
  1257 def match_context_prop(cls, req, context=None, **kwargs):
  1259 def match_context_prop(cls, req, context=None, **kwargs):
  1258     """Return 1 if:
  1260     """Return 1 if:
  1259 
  1261 
  1270     """
  1272     """
  1271     if context is None:
  1273     if context is None:
  1272         return 1
  1274         return 1
  1273     propval = req.property_value('%s.%s.context' % (cls.__registry__,
  1275     propval = req.property_value('%s.%s.context' % (cls.__registry__,
  1274                                                     cls.__regid__))
  1276                                                     cls.__regid__))
  1275     if not propval:
       
  1276         propval = cls.context
       
  1277     if propval and context != propval:
  1277     if propval and context != propval:
  1278         return 0
  1278         return 0
  1279     return 1
  1279     return 1
  1280 
  1280 
  1281 
  1281