entity.py
branchstable
changeset 9310 80c58c35145f
parent 9277 c964d8cf6efc
child 9340 b1e933b0e850
child 9432 030745ac9873
equal deleted inserted replaced
9308:a898c34200ad 9310:80c58c35145f
  1277 
  1277 
  1278         Example (in a shell session):
  1278         Example (in a shell session):
  1279 
  1279 
  1280         >>> c = rql('Any X WHERE X is Company').get_entity(0, 0)
  1280         >>> c = rql('Any X WHERE X is Company').get_entity(0, 0)
  1281         >>> p = rql('Any X WHERE X is Person').get_entity(0, 0)
  1281         >>> p = rql('Any X WHERE X is Person').get_entity(0, 0)
  1282         >>> c.set(name=u'Logilab')
  1282         >>> c.cw_set(name=u'Logilab')
  1283         >>> p.set(firstname=u'John', lastname=u'Doe', works_for=c)
  1283         >>> p.cw_set(firstname=u'John', lastname=u'Doe', works_for=c)
  1284 
  1284 
  1285         You can also set relations where the entity has 'object' role by
  1285         You can also set relations where the entity has 'object' role by
  1286         prefixing the relation name by 'reverse_'.  Also, relation values may be
  1286         prefixing the relation name by 'reverse_'.  Also, relation values may be
  1287         an entity or eid, a list of entities or eids, or None (meaning that all
  1287         an entity or eid, a list of entities or eids, or None (meaning that all
  1288         relations of the given type from or to this object should be deleted).
  1288         relations of the given type from or to this object should be deleted).