entity.py
changeset 8705 5b3e17a63fad
parent 8697 574bb05e40a4
child 8735 5567a5117aeb
equal deleted inserted replaced
8704:933f9693c53d 8705:5b3e17a63fad
   519     def cw_instantiate(cls, execute, **kwargs):
   519     def cw_instantiate(cls, execute, **kwargs):
   520         """add a new entity of this given type
   520         """add a new entity of this given type
   521 
   521 
   522         Example (in a shell session):
   522         Example (in a shell session):
   523 
   523 
   524         >>> companycls = vreg['etypes'].etype_class(('Company')
   524         >>> companycls = vreg['etypes'].etype_class('Company')
   525         >>> personcls = vreg['etypes'].etype_class(('Person')
   525         >>> personcls = vreg['etypes'].etype_class('Person')
   526         >>> c = companycls.cw_instantiate(session.execute, name=u'Logilab')
   526         >>> c = companycls.cw_instantiate(session.execute, name=u'Logilab')
   527         >>> p = personcls.cw_instantiate(session.execute, firstname=u'John', lastname=u'Doe',
   527         >>> p = personcls.cw_instantiate(session.execute, firstname=u'John', lastname=u'Doe',
   528         ...                              works_for=c)
   528         ...                              works_for=c)
   529 
   529 
   530         You can also set relations where the entity has 'object' role by
   530         You can also set relations where the entity has 'object' role by