You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by Apache Bloodhound <bl...@incubator.apache.org> on 2012/05/15 17:20:11 UTC

[Apache Bloodhound] #76: TypeError from dashboard render_widget with no components

#76: TypeError from dashboard render_widget with no components
-----------------------+--------------------
 Reporter:  gjm        |      Owner:  nobody
     Type:  defect     |     Status:  new
 Priority:  minor      |  Milestone:
Component:  dashboard  |    Version:
 Keywords:             |
-----------------------+--------------------
 Remove all components and try to look at a milestone and you will get a
 {{{TypeError: __init__() takes at least 3 arguments (2 given)}}} when
 attempting to raise an {{{InvalidWidgetArgument}}} exception.

 While the specified error is easily fixed:

 {{{
 #!diff
 Index: bhdashboard/widgets/ticket.py
 ===================================================================
 --- bhdashboard/widgets/ticket.py       (revision 1338166)
 +++ bhdashboard/widgets/ticket.py       (working copy)
 @@ -89,7 +89,7 @@
              if field['name'] == fieldnm:
                  break
          else:
 -            raise InvalidWidgetArgument('Unknown ticket field %s' %
 (fieldnm,))
 +            raise InvalidWidgetArgument(fieldnm, 'Unknown ticket field
 %s' % (fieldnm,))
          if field.get('custom'):
              sql = "SELECT value, count(value) FROM ticket_custom " \
                      "WHERE name='%(name)s' GROUP BY value"
 }}}

 (or similar) the code is triggered because the ticket system does not
 report the component field as a valid field and so an error would still
 result. It would be better if this was handled a bit more gracefully so
 that we are still able to see other details of the milestone.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/76>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #76: TypeError from dashboard render_widget with no components

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#76: TypeError from dashboard render_widget with no components
------------------------+-------------------------------------
  Reporter:  gjm        |      Owner:  olemis
      Type:  defect     |     Status:  accepted
  Priority:  minor      |  Milestone:  RC1 for initial release
 Component:  dashboard  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by gjm):

 I don't think that is strictly correct - if the admin url is missing then
 it shouldn't revert to showing the contact-your-admin message.

 Is there still a route to testing this patch under the current design?

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/76#comment:14>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #76: TypeError from dashboard render_widget with no components

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#76: TypeError from dashboard render_widget with no components
------------------------+-------------------------------------
  Reporter:  gjm        |      Owner:  olemis
      Type:  defect     |     Status:  accepted
  Priority:  minor      |  Milestone:  RC1 for initial release
 Component:  dashboard  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by olemis):

 Please review attachment:t76_r1345273_empty_field.diff to be applied
 against r1345273 .

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/76#comment:13>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #76: TypeError from dashboard render_widget with no components

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#76: TypeError from dashboard render_widget with no components
------------------------+-------------------------------------
  Reporter:  gjm        |      Owner:  olemis
      Type:  defect     |     Status:  accepted
  Priority:  minor      |  Milestone:  RC1 for initial release
 Component:  dashboard  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by gjm):

 attachment:alt_empty_field.dff acts as a replacement for
 attachment:t76_r1339633_empty_field.diff​ providing a basic (and
 incomplete as I think some of the admin links may not exist) mapping to
 the ticket admin fields.

 My second concern is what "Hidden field" is for when it is not hidden.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/76#comment:5>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #76: TypeError from dashboard render_widget with no components

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#76: TypeError from dashboard render_widget with no components
------------------------+-------------------------------------
  Reporter:  gjm        |      Owner:  olemis
      Type:  defect     |     Status:  accepted
  Priority:  minor      |  Milestone:  RC1 for initial release
 Component:  dashboard  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by olemis):

 Replying to [comment:7 gjm]:
 > The admin links I refer to are what you were attempted to get from
 {{{req.href.admin('ticket', fieldnm)}}}, the problem apparently being that
 the field name does not properly predict the path (hence the mapping to a
 plural form for a few of the {{{fieldnm}}} values),
 >

 oh ! now I c . you are right .

 > If it is not possible to edit the status list then it probably doesn't
 matter what we do with that but that is what I mean by the missing admin
 link.
 >

 I didn't notice before ''':-/''' . I apologize .

 > As for the hidden field, I mean the output from this:
 > {{{
 > #!python
 > Markup(_('Hidden field <small>%(field)s</small>', field=fieldnm))
 > }}}
 >
 > I probably would not have noticed except that for the way that it was
 actually rendered.

 Well , any other caption is ok for me ''';)''' . In the end it is shown
 only when there's no value for select field . Hence what I don't
 understand about last sentence in [#comment:5 your previous comment] is
 the following part ''when it is not hidden'' . If field is not ''hidden''
 then that caption is not shown.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/76#comment:8>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #76: TypeError from dashboard render_widget with no components

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#76: TypeError from dashboard render_widget with no components
------------------------+-------------------------------------
  Reporter:  gjm        |      Owner:  olemis
      Type:  defect     |     Status:  accepted
  Priority:  minor      |  Milestone:  RC1 for initial release
 Component:  dashboard  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by gjm):

 If we are going with the t76_r1339633_empty_field.diff patch, I think it
 needs a little more work. I'll submit an alternative that does some of the
 work.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/76#comment:4>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #76: TypeError from dashboard render_widget with no components

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#76: TypeError from dashboard render_widget with no components
------------------------+-------------------------------------
  Reporter:  gjm        |      Owner:  olemis
      Type:  defect     |     Status:  closed
  Priority:  minor      |  Milestone:  RC1 for initial release
 Component:  dashboard  |    Version:
Resolution:  fixed      |   Keywords:
------------------------+-------------------------------------
Changes (by gjm):

 * status:  accepted => closed
 * resolution:   => fixed


Comment:

 r1351389 applies t76_r1345273_empty_field.diff​

 I'll assume this completes this ticket.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/76#comment:16>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #76: TypeError from dashboard render_widget with no components

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#76: TypeError from dashboard render_widget with no components
------------------------+-------------------------------------
  Reporter:  gjm        |      Owner:  olemis
      Type:  defect     |     Status:  accepted
  Priority:  minor      |  Milestone:  RC1 for initial release
 Component:  dashboard  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by gjm):

 r1341403 adds the missing argument when raising the exception

 r1341413 updates template to render system messages

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/76#comment:3>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #76: TypeError from dashboard render_widget with no components

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#76: TypeError from dashboard render_widget with no components
------------------------+-------------------------------------
  Reporter:  gjm        |      Owner:  olemis
      Type:  defect     |     Status:  accepted
  Priority:  minor      |  Milestone:  RC1 for initial release
 Component:  dashboard  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by gjm):

 The admin links I refer to are what you were attempted to get from
 {{{req.href.admin('ticket', fieldnm)}}}, the problem apparently being that
 the field name does not properly predict the path (hence the mapping to a
 plural form for a few of the {{{fieldnm}}} values),

 If it is not possible to edit the status list then it probably doesn't
 matter what we do with that but that is what I mean by the missing admin
 link.

 As for the hidden field, I mean the output from this:
 {{{
 #!python
 Markup(_('Hidden field <small>%(field)s</small>', field=fieldnm))
 }}}

 I probably would not have noticed except that for the way that it was
 actually rendered.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/76#comment:7>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #76: TypeError from dashboard render_widget with no components

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#76: TypeError from dashboard render_widget with no components
------------------------+-------------------------------------
  Reporter:  gjm        |      Owner:  olemis
      Type:  defect     |     Status:  accepted
  Priority:  minor      |  Milestone:  RC1 for initial release
 Component:  dashboard  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by gjm):

 Does attachment:HiddenFieldScreenshot.png help show what I mean?

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/76#comment:10>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #76: TypeError from dashboard render_widget with no components

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#76: TypeError from dashboard render_widget with no components
------------------------+-------------------------------------
  Reporter:  gjm        |      Owner:  olemis
      Type:  defect     |     Status:  accepted
  Priority:  minor      |  Milestone:  RC1 for initial release
 Component:  dashboard  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by olemis):

 Attached patches implement better error handling for
 `bhdashboard.widgets.ticket.TicketFieldCloudWidget` . They should be
 applied against r1339633 on top of
 [attachment:ticket:81:t81_r1339633_widget_except.diff widget error
 handling patch] submitted for #81 . Application order shown below

 {{{
 #!sh

 $ hg qapplied
 t81/t81_r1339633_widget_except.diff
 t76/t76_r1339633_ticketcloud_typeerror.diff
 t76/t76_r1339633_widget_alerts.diff
 t76/t76_r1339633_empty_field.diff

 }}}

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/76#comment:2>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #76: TypeError from dashboard render_widget with no components

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#76: TypeError from dashboard render_widget with no components
------------------------+-------------------------------------
  Reporter:  gjm        |      Owner:  olemis
      Type:  defect     |     Status:  accepted
  Priority:  minor      |  Milestone:  RC1 for initial release
 Component:  dashboard  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by olemis):

 Replying to [comment:14 gjm]:
 > I don't think that is strictly correct - if the admin url is missing
 then it shouldn't revert to showing the contact-your-admin message.
 >

 So what should it do instead ?

 > Is there still a route to testing this patch under the current design?

 hmmm ... maybe in dashboard view , if all components are removed .

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/76#comment:15>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #76: TypeError from dashboard render_widget with no components

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#76: TypeError from dashboard render_widget with no components
------------------------+-------------------------------------
  Reporter:  gjm        |      Owner:  olemis
      Type:  defect     |     Status:  accepted
  Priority:  minor      |  Milestone:  RC1 for initial release
 Component:  dashboard  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by olemis):

 Q:

   - What are missing admin links ? I mean ... what fields are missing ?
   - I don't understand your question about hidden field ... could you
 please clarify ?
     If there's no value for select field then it's treated as if it ever
 existed.
     (i.e. ''hidden field''). Relevant snippet is shown below . Extracted
 from `trac.ticket.api` .

 {{{
 #!sh

 for name, label, cls in selects:
     options = [val.name for val in cls.select(self.env, db=db)]
     if not options:
         # Fields without possible values are treated as if they didn't
         # exist
         continue
 }}}

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/76#comment:6>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #76: TypeError from dashboard render_widget with no components

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#76: TypeError from dashboard render_widget with no components
------------------------+-------------------------------------
  Reporter:  gjm        |      Owner:  olemis
      Type:  defect     |     Status:  accepted
  Priority:  minor      |  Milestone:  RC1 for initial release
 Component:  dashboard  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------
Changes (by olemis):

 * owner:  nobody => olemis
 * status:  new => accepted
 * milestone:   => RC1 for initial release


Comment:

 This ticket is related to #81 .

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/76#comment:1>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #76: TypeError from dashboard render_widget with no components

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#76: TypeError from dashboard render_widget with no components
------------------------+-------------------------------------
  Reporter:  gjm        |      Owner:  olemis
      Type:  defect     |     Status:  accepted
  Priority:  minor      |  Milestone:  RC1 for initial release
 Component:  dashboard  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by olemis):

 ... like I said ... that's the title for ticket field cloud widget when
 there's no option for `component` field . Please feel free to use a more
 appropriate caption or remove it if that's a better way to go ''';)''' .

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/76#comment:11>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #76: TypeError from dashboard render_widget with no components

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#76: TypeError from dashboard render_widget with no components
------------------------+-------------------------------------
  Reporter:  gjm        |      Owner:  olemis
      Type:  defect     |     Status:  accepted
  Priority:  minor      |  Milestone:  RC1 for initial release
 Component:  dashboard  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by gjm):

 I've replaced the markup line to just give a field name converted to a
 title form for the moment which makes a little more sense to me. I am sure
 it will get replaced at some point by someone who understands what should
 really be there.

 r1343179 provides the message for the !TicketFieldCloud widget

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/76#comment:12>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #76: TypeError from dashboard render_widget with no components

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#76: TypeError from dashboard render_widget with no components
------------------------+-------------------------------------
  Reporter:  gjm        |      Owner:  olemis
      Type:  defect     |     Status:  accepted
  Priority:  minor      |  Milestone:  RC1 for initial release
 Component:  dashboard  |    Version:
Resolution:             |   Keywords:
------------------------+-------------------------------------

Comment (by olemis):

 Replying to [comment:8 olemis]:
 > Replying to [comment:7 gjm]:
 >
 [...]
 >
 > > As for the hidden field, I mean the output from this:
 > > {{{
 > > #!python
 > > Markup(_('Hidden field <small>%(field)s</small>', field=fieldnm))
 > > }}}
 > >
 > > I probably would not have noticed except that for the way that it was
 actually rendered.
 >
 > Well , any other caption is ok for me ''';)''' . In the end it is shown
 only when there's no value for select field . Hence what I don't
 understand about last sentence in [#comment:5 your previous comment] is
 the following part ''when it is not hidden'' . If field is not ''hidden''
 then that caption is not shown.

 ... and if field name is not found and it is not a ''hidden select field''
 then , in that case , exception is raised and generic error message shown
 . Is it ok ? Do you prefer any other way to deal with it ?

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/76#comment:9>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker