entity.py
changeset 6467 869813c2dd40
parent 6464 11f9fbf6a645
child 6498 0ad62d6b6f8e
equal deleted inserted replaced
6466:43d71dd8a8ec 6467:869813c2dd40
    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 def prefill_entity_caches(entity, relations):
       
    65     session = entity._cw
       
    66     # prefill entity relation caches
       
    67     for rschema in entity.e_schema.subject_relations():
       
    68         rtype = str(rschema)
       
    69         if rtype in schema.VIRTUAL_RTYPES:
       
    70             continue
       
    71         if rschema.final:
       
    72             entity.cw_attr_cache.setdefault(rtype, None)
       
    73         else:
       
    74             entity.cw_set_relation_cache(rtype, 'subject',
       
    75                                          session.empty_rset())
       
    76     for rschema in entity.e_schema.object_relations():
       
    77         rtype = str(rschema)
       
    78         if rtype in schema.VIRTUAL_RTYPES:
       
    79             continue
       
    80         entity.cw_set_relation_cache(rtype, 'object', session.empty_rset())
       
    81     # set inlined relation cache before call to after_add_entity
       
    82     for attr, value in relations:
       
    83         session.update_rel_cache_add(entity.eid, attr, value)
       
    84         del_existing_rel_if_needed(session, entity.eid, attr, value)
       
    85 
    63 
    86 
    64 
    87 
    65 
    88 class Entity(AppObject):
    66 class Entity(AppObject):
    89     """an entity instance has e_schema automagically set on
    67     """an entity instance has e_schema automagically set on