equal
deleted
inserted
replaced
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 |