equal
deleted
inserted
replaced
1 # copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
1 # copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
3 # |
3 # |
4 # This file is part of CubicWeb. |
4 # This file is part of CubicWeb. |
5 # |
5 # |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
704 return 0 |
704 return 0 |
705 return req.user.eid == rset[row or 0][col] |
705 return req.user.eid == rset[row or 0][col] |
706 |
706 |
707 |
707 |
708 # entity predicates ############################################################# |
708 # entity predicates ############################################################# |
|
709 |
|
710 class composite_etype(Predicate): |
|
711 """Return 1 for composite entities. |
|
712 |
|
713 A composite entity has an etype for which at least one relation |
|
714 definition points in its direction with the |
|
715 composite='subject'/'object' notation. |
|
716 """ |
|
717 |
|
718 def __call__(self, cls, req, **kwargs): |
|
719 entity = kwargs.pop('entity', None) |
|
720 if entity is None: |
|
721 return 0 |
|
722 return entity.e_schema.is_composite |
|
723 |
|
724 |
709 |
725 |
710 class non_final_entity(EClassPredicate): |
726 class non_final_entity(EClassPredicate): |
711 """Return 1 for entity of a non final entity type(s). Remember, "final" |
727 """Return 1 for entity of a non final entity type(s). Remember, "final" |
712 entity types are String, Int, etc... This is equivalent to |
728 entity types are String, Int, etc... This is equivalent to |
713 `is_instance('Any')` but more optimized. |
729 `is_instance('Any')` but more optimized. |