entities/__init__.py
changeset 8450 11063635c4e4
parent 7875 65e460690139
child 8748 f5027f8d2478
equal deleted inserted replaced
8449:cc83a3f16c0f 8450:11063635c4e4
    37 
    37 
    38     @classmethod
    38     @classmethod
    39     def cw_create_url(cls, req, **kwargs):
    39     def cw_create_url(cls, req, **kwargs):
    40         """ return the url of the entity creation form for this entity type"""
    40         """ return the url of the entity creation form for this entity type"""
    41         return req.build_url('add/%s' % cls.__regid__, **kwargs)
    41         return req.build_url('add/%s' % cls.__regid__, **kwargs)
       
    42 
       
    43     @classmethod
       
    44     def cw_fti_index_rql_queries(cls, req):
       
    45         """return the list of rql queries to fetch entities to FT-index
       
    46 
       
    47         The default is to fetch all entities at once and to prefetch
       
    48         indexable attributes but one could imagine iterating over
       
    49         "smaller" resultsets if the table is very big or returning
       
    50         a subset of entities that match some business-logic condition.
       
    51         """
       
    52         restrictions = ['X is %s' % cls.__regid__]
       
    53         selected = ['X']
       
    54         for attrschema in cls.e_schema.indexable_attributes():
       
    55             varname = attrschema.type.upper()
       
    56             restrictions.append('X %s %s' % (attrschema, varname))
       
    57             selected.append(varname)
       
    58         return ['Any %s WHERE %s' % (', '.join(selected),
       
    59                                      ', '.join(restrictions))]
    42 
    60 
    43     # meta data api ###########################################################
    61     # meta data api ###########################################################
    44 
    62 
    45     def dc_title(self):
    63     def dc_title(self):
    46         """return a suitable *unicode* title for this entity"""
    64         """return a suitable *unicode* title for this entity"""