22 |
22 |
23 __docformat__ = "restructuredtext en" |
23 __docformat__ = "restructuredtext en" |
24 |
24 |
25 from itertools import repeat |
25 from itertools import repeat |
26 |
26 |
27 from six import string_types |
27 from six import string_types, integer_types |
28 from six.moves import range |
28 from six.moves import range |
29 |
29 |
30 from rql import RQLSyntaxError, CoercionError |
30 from rql import RQLSyntaxError, CoercionError |
31 from rql.stmts import Union |
31 from rql.stmts import Union |
32 from rql.nodes import ETYPE_PYOBJ_MAP, etype_from_pyobj, Relation, Exists, Not |
32 from rql.nodes import ETYPE_PYOBJ_MAP, etype_from_pyobj, Relation, Exists, Not |
451 relations = {} |
451 relations = {} |
452 for subj, rtype, obj in self.relation_defs(): |
452 for subj, rtype, obj in self.relation_defs(): |
453 # if a string is given into args instead of an int, we get it here |
453 # if a string is given into args instead of an int, we get it here |
454 if isinstance(subj, string_types): |
454 if isinstance(subj, string_types): |
455 subj = int(subj) |
455 subj = int(subj) |
456 elif not isinstance(subj, (int, long)): |
456 elif not isinstance(subj, integer_types): |
457 subj = subj.entity.eid |
457 subj = subj.entity.eid |
458 if isinstance(obj, string_types): |
458 if isinstance(obj, string_types): |
459 obj = int(obj) |
459 obj = int(obj) |
460 elif not isinstance(obj, (int, long)): |
460 elif not isinstance(obj, integer_types): |
461 obj = obj.entity.eid |
461 obj = obj.entity.eid |
462 if repo.schema.rschema(rtype).inlined: |
462 if repo.schema.rschema(rtype).inlined: |
463 if subj not in edited_entities: |
463 if subj not in edited_entities: |
464 entity = cnx.entity_from_eid(subj) |
464 entity = cnx.entity_from_eid(subj) |
465 edited = EditedEntity(entity) |
465 edited = EditedEntity(entity) |