예제 #1
0
파일: repository.py 프로젝트: hforge/itws
 def orderable_classes(self):
     registry = get_boxes_registry()
     types = [ cls for cls, allow in registry.iteritems()
               if allow[self.allow_filter_key] ]
     types.sort(lambda x, y : cmp(x.class_title.gettext(),
                                  y.class_title.gettext()))
     types = self._reduce_orderable_classes(types)
     return types
예제 #2
0
 def can_paste(self, source):
     """Is the source resource can be pasted into myself.
     """
     allowed_types = self.get_document_types()
     # extend allowed type with content boxes
     registry = get_boxes_registry()
     boxe_cls = [ cls for cls, allow in registry.iteritems()
                  if allow['content'] ]
     allowed_types.extend(boxe_cls)
     return isinstance(source, tuple(allowed_types))
예제 #3
0
파일: repository.py 프로젝트: hforge/itws
 def _get_document_types(self, allow_instanciation=None, is_contentbox=None,
                         is_sidebox=None):
     registry = get_boxes_registry()
     types = []
     for cls, allow in registry.iteritems():
         if allow_instanciation is not None and \
                 allow_instanciation <> allow['instanciation']:
             continue
         if is_contentbox is not None and is_contentbox <> allow['content']:
             continue
         if is_sidebox is not None and is_sidebox <> allow['side']:
             continue
         types.append(cls)
     types.sort(lambda x, y : cmp(x.class_id, y.class_id))
     return types