web/views/primary.py
changeset 7894 ad0eeb0f7a8d
parent 7848 db6bb2da397c
parent 7879 9aae456abab5
child 7990 a673d1d9a738
equal deleted inserted replaced
7889:6cebeb1f386a 7894:ad0eeb0f7a8d
   128         if boxes or hasattr(self, 'render_side_related'):
   128         if boxes or hasattr(self, 'render_side_related'):
   129             self.w(u'<table width="100%"><tr><td style="width: 75%">')
   129             self.w(u'<table width="100%"><tr><td style="width: 75%">')
   130         if hasattr(self, 'render_entity_summary'):
   130         if hasattr(self, 'render_entity_summary'):
   131             warn('[3.10] render_entity_summary method is deprecated (%s)' % self,
   131             warn('[3.10] render_entity_summary method is deprecated (%s)' % self,
   132                  DeprecationWarning)
   132                  DeprecationWarning)
   133             self.render_entity_summary(entity)
   133             self.render_entity_summary(entity) # pylint: disable=E1101
       
   134 
   134         summary = self.summary(entity)
   135         summary = self.summary(entity)
   135         if summary:
   136         if summary:
   136             warn('[3.10] summary method is deprecated (%s)' % self,
   137             warn('[3.10] summary method is deprecated (%s)' % self,
   137                  DeprecationWarning)
   138                  DeprecationWarning)
   138             self.w(u'<div class="summary">%s</div>' % summary)
   139             self.w(u'<div class="summary">%s</div>' % summary)
   147         if boxes or hasattr(self, 'render_side_related'):
   148         if boxes or hasattr(self, 'render_side_related'):
   148             self.w(u'</td><td>')
   149             self.w(u'</td><td>')
   149             self.w(u'<div class="primaryRight">')
   150             self.w(u'<div class="primaryRight">')
   150             if hasattr(self, 'render_side_related'):
   151             if hasattr(self, 'render_side_related'):
   151                 warn('[3.2] render_side_related is deprecated')
   152                 warn('[3.2] render_side_related is deprecated')
   152                 self.render_side_related(entity, [])
   153                 self.render_side_related(entity, []) # pylint: disable=E1101
   153             self.render_side_boxes(boxes)
   154             self.render_side_boxes(boxes)
   154             self.w(u'</div>')
   155             self.w(u'</div>')
   155             self.w(u'</td></tr></table>')
   156             self.w(u'</td></tr></table>')
   156 
   157 
   157     def content_navigation_components(self, context):
   158     def content_navigation_components(self, context):
   215             if not self.skip_none or (value is not None and value != ''):
   216             if not self.skip_none or (value is not None and value != ''):
   216                 display_attributes.append( (rschema, role, dispctrl, value) )
   217                 display_attributes.append( (rschema, role, dispctrl, value) )
   217         if display_attributes:
   218         if display_attributes:
   218             self.w(u'<table>')
   219             self.w(u'<table>')
   219             for rschema, role, dispctrl, value in display_attributes:
   220             for rschema, role, dispctrl, value in display_attributes:
       
   221                 # pylint: disable=E1101
   220                 if not hasattr(self, '_render_attribute'):
   222                 if not hasattr(self, '_render_attribute'):
   221                     label = self._rel_label(entity, rschema, role, dispctrl)
   223                     label = self._rel_label(entity, rschema, role, dispctrl)
   222                     self.render_attribute(label, value, table=True)
   224                     self.render_attribute(label, value, table=True)
   223                 elif support_args(self._render_attribute, 'dispctrl'):
   225                 elif support_args(self._render_attribute, 'dispctrl'):
   224                     warn('[3.9] _render_attribute prototype has changed and '
   226                     warn('[3.9] _render_attribute prototype has changed and '
   225                          'renamed to render_attribute, please update %s'
   227                          'renamed to render_attribute, please update %s'
   226                          % self.__class___, DeprecationWarning)
   228                          % self.__class__, DeprecationWarning)
   227                     self._render_attribute(dispctrl, rschema, value, role=role,
   229                     self._render_attribute(dispctrl, rschema, value, role=role,
   228                                            table=True)
   230                                            table=True)
   229                 else:
   231                 else:
   230                     self._render_attribute(rschema, value, role=role, table=True)
   232                     self._render_attribute(rschema, value, role=role, table=True)
   231                     warn('[3.6] _render_attribute prototype has changed and '
   233                     warn('[3.6] _render_attribute prototype has changed and '
   232                          'renamed to render_attribute, please update %s'
   234                          'renamed to render_attribute, please update %s'
   233                          % self.__class___, DeprecationWarning)
   235                          % self.__class__, DeprecationWarning)
   234             self.w(u'</table>')
   236             self.w(u'</table>')
   235 
   237 
   236     def render_attribute(self, label, value, table=False):
   238     def render_attribute(self, label, value, table=False):
   237         self.field(label, value, tr=False, table=table)
   239         self.field(label, value, tr=False, table=table)
   238 
   240 
   253             else:
   255             else:
   254                 rset = self._relation_rset(entity, rschema, role, dispctrl)
   256                 rset = self._relation_rset(entity, rschema, role, dispctrl)
   255                 if not rset:
   257                 if not rset:
   256                     continue
   258                     continue
   257                 if hasattr(self, '_render_relation'):
   259                 if hasattr(self, '_render_relation'):
       
   260                     # pylint: disable=E1101
   258                     if not support_args(self._render_relation, 'showlabel'):
   261                     if not support_args(self._render_relation, 'showlabel'):
   259                         self._render_relation(dispctrl, rset, 'autolimited')
   262                         self._render_relation(dispctrl, rset, 'autolimited')
   260                         warn('[3.9] _render_relation prototype has changed and has '
   263                         warn('[3.9] _render_relation prototype has changed and has '
   261                              'been renamed to render_relation, please update %s'
   264                              'been renamed to render_relation, please update %s'
   262                              % self.__class__, DeprecationWarning)
   265                              % self.__class__, DeprecationWarning)
   429     both relations and attributes.
   432     both relations and attributes.
   430     """
   433     """
   431     __regid__ = 'attribute'
   434     __regid__ = 'attribute'
   432     __select__ = EntityView.__select__ & match_kwargs('rtype')
   435     __select__ = EntityView.__select__ & match_kwargs('rtype')
   433 
   436 
   434     def entity_call(self, entity, rtype, **kwargs):
   437     def entity_call(self, entity, rtype, role, **kwargs):
   435         if self._cw.vreg.schema.rschema(rtype).final:
   438         if self._cw.vreg.schema.rschema(rtype).final:
   436             self.w(entity.printable_value(rtype))
   439             self.w(entity.printable_value(rtype))
   437         else:
   440         else:
   438             dispctrl = uicfg.primaryview_display_ctrl.etype_get(
   441             dispctrl = uicfg.primaryview_display_ctrl.etype_get(
   439                 entity.e_schema, rtype, role, '*')
   442                 entity.e_schema, rtype, role, '*')