web/component.py
branchstable
changeset 7879 9aae456abab5
parent 7536 29961a416faa
child 7990 a673d1d9a738
child 8052 fbeb82fe45a4
equal deleted inserted replaced
7874:be04706eacc9 7879:9aae456abab5
   319                  % self.__class__, DeprecationWarning)
   319                  % self.__class__, DeprecationWarning)
   320             self.w = w
   320             self.w = w
   321             def wview(__vid, rset=None, __fallback_vid=None, **kwargs):
   321             def wview(__vid, rset=None, __fallback_vid=None, **kwargs):
   322                 self._cw.view(__vid, rset, __fallback_vid, w=self.w, **kwargs)
   322                 self._cw.view(__vid, rset, __fallback_vid, w=self.w, **kwargs)
   323             self.wview = wview
   323             self.wview = wview
   324             self.call(**kwargs)
   324             self.call(**kwargs) # pylint: disable=E1101
   325             return
   325             return
   326         getlayout = self._cw.vreg['components'].select
   326         getlayout = self._cw.vreg['components'].select
   327         layout = getlayout('layout', self._cw, **self.layout_select_args())
   327         layout = getlayout('layout', self._cw, **self.layout_select_args())
   328         layout.render(w)
   328         layout.render(w)
   329 
   329 
   537     """base class for boxes which let add or remove entities linked by a given
   537     """base class for boxes which let add or remove entities linked by a given
   538     relation
   538     relation
   539 
   539 
   540     subclasses should define at least id, rtype and target class attributes.
   540     subclasses should define at least id, rtype and target class attributes.
   541     """
   541     """
       
   542     # to be defined in concrete classes
       
   543     rtype = None
       
   544 
   542     def render_title(self, w):
   545     def render_title(self, w):
   543         w(display_name(self._cw, self.rtype, role(self),
   546         w(display_name(self._cw, self.rtype, role(self),
   544                        context=self.entity.__regid__))
   547                        context=self.entity.__regid__))
   545 
   548 
   546     def render_body(self, w):
   549     def render_body(self, w):
   564     separator = ','
   567     separator = ','
   565     # msgid of the message to display when some new relation has been added/removed
   568     # msgid of the message to display when some new relation has been added/removed
   566     added_msg = None
   569     added_msg = None
   567     removed_msg = None
   570     removed_msg = None
   568 
   571 
   569     # class attributes below *must* be set in concret classes (additionaly to
   572     # to be defined in concrete classes
       
   573     rtype = role = target_etype = None
       
   574     # class attributes below *must* be set in concrete classes (additionaly to
   570     # rtype / role [/ target_etype]. They should correspond to js_* methods on
   575     # rtype / role [/ target_etype]. They should correspond to js_* methods on
   571     # the json controller
   576     # the json controller
   572 
   577 
   573     # function(eid)
   578     # function(eid)
   574     # -> expected to return a list of values to display as input selector
   579     # -> expected to return a list of values to display as input selector
   704 class RelatedObjectsVComponent(EntityVComponent):
   709 class RelatedObjectsVComponent(EntityVComponent):
   705     """a section to display some related entities"""
   710     """a section to display some related entities"""
   706     __select__ = EntityVComponent.__select__ & partial_has_related_entities()
   711     __select__ = EntityVComponent.__select__ & partial_has_related_entities()
   707 
   712 
   708     vid = 'list'
   713     vid = 'list'
       
   714     # to be defined in concrete classes
       
   715     rtype = title = None
   709 
   716 
   710     def rql(self):
   717     def rql(self):
   711         """override this method if you want to use a custom rql query"""
   718         """override this method if you want to use a custom rql query"""
   712         return None
   719         return None
   713 
   720