__init__.py
branchstable
changeset 3601 d77025be6f06
parent 3111 7b405bb305ab
child 3629 559cad62c786
child 3634 a2d00ff6eb68
equal deleted inserted replaced
3600:540210e138d3 3601:d77025be6f06
   121         raise KeyError
   121         raise KeyError
   122     def set_entity_cache(self, entity):
   122     def set_entity_cache(self, entity):
   123         pass
   123         pass
   124 
   124 
   125     def create_entity(self, etype, *args, **kwargs):
   125     def create_entity(self, etype, *args, **kwargs):
   126         """add a new entity of the given type"""
   126         """add a new entity of the given type
       
   127         
       
   128         Example (in a shell session):
       
   129 
       
   130         c = create_entity('Company', name='Logilab')
       
   131         create_entity('Person', ('works_for', 'Y'), Y=c.eid, firstname='John', lastname='Doe')
       
   132 
       
   133         """
   127         rql = 'INSERT %s X' % etype
   134         rql = 'INSERT %s X' % etype
   128         relations = []
   135         relations = []
   129         restrictions = []
   136         restrictions = []
   130         cachekey = []
   137         cachekey = []
   131         for rtype, rvar in args:
   138         for rtype, rvar in args: