Edgewall Software
Modify

Opened 13 years ago

Closed 13 years ago

#2383 closed defect (fixed)

Can't set component correctly

Reported by: wilmer@… Owned by: Christian Boos
Priority: normal Milestone: 0.9.1
Component: ticket system Version: 0.9
Severity: major Keywords:
Cc: wilmer@… Branch:
Release Notes:
API Changes:

Description

The problem happens on this page:

http://bugs.bitlbee.org/bitlbee/ticket/26

I can't set component to IRC or BitlBee. All other components are allowed. Possible reason: There are bugs from the IRC and BitlBee components assigned to the 1.0 milestone, and all of them are fixed. There are also two OSCAR-related bugs in the 1.0 milestone, but one of them is still open.

This is the only connection I can find between the IRC- and BitlBee components.

If I unset the milestone for ticket 26, I still get the same problem:

Traceback (most recent call last):
  File "/home/wilmer/trac/trac/lib/python2.4/site-packages/trac/web/standalone.py", line 303, in _do_trac_req
    dispatch_request(path_info, req, env)
  File "/home/wilmer/trac/trac/lib/python2.4/site-packages/trac/web/main.py", line 139, in dispatch_request
    dispatcher.dispatch(req)
  File "/home/wilmer/trac/trac/lib/python2.4/site-packages/trac/web/main.py", line 107, in dispatch
    resp = chosen_handler.process_request(req)
  File "/home/wilmer/trac/trac/lib/python2.4/site-packages/trac/ticket/web_ui.py", line 191, in process_request
    self._do_save(req, db, ticket)
  File "/home/wilmer/trac/trac/lib/python2.4/site-packages/trac/ticket/web_ui.py", line 349, in _do_save
    req.args.get('comment'), when=now, db=db)
  File "/home/wilmer/trac/trac/lib/python2.4/site-packages/trac/ticket/model.py", line 197, in save_changes
    self['owner'] = new_comp.owner
  File "/home/wilmer/trac/trac/lib/python2.4/site-packages/trac/ticket/model.py", line 104, in __setitem__
    self.values[name] = value.strip()
AttributeError: 'NoneType' object has no attribute 'strip'

Thanks for the great product, and I hope this will be fixed soon. :-)

Attachments (0)

Change History (7)

comment:1 by wilmer@…, 13 years ago

And oh yeah, I'm running trac+darcs with a bzr repository, might be a good thing to mention.

comment:2 by Wilmer van der Gaast <wilmer@…>, 13 years ago

Cc: wilmer@… added

comment:3 by Christian Boos, 13 years ago

Milestone: 0.9.1
Owner: changed from Jonas Borgström to Christian Boos
Status: newassigned

From the stack trace it rather looks like those component have no owner (empty string).

Ok, I can reproduce it:

  1. manually assign null to the owner component2
  2. create a new ticket with component set to component1
  3. change component to component2 ⇒ the error

For some reason, we get a None value instead of an empty string in Python (source:trunk/trac/ticket/model.py@2539#L458). That's OK, I guess, but then we should be robust while saving the state of the ticket

  • model.py

     
    129129            self._old[name] = self.values.get(name)
    130130        elif self._old[name] == value: # Change of field reverted
    131131            del self._old[name]
    132         self.values[name] = value.strip()
     132        self.values[name] = value and value.strip()
    133133
    134134    def populate(self, values):
    135135        """Populate the ticket with 'suitable' values from a dictionary"""

One minor issue left with that would be that once the owner of the new ticket has been cleared because of such a component change, another component change wouldn't manage to reset the owner. Therefore, we need the additional fix:

  • model.py

     
    224226                    and not self._old.has_key('owner'):
    225227                try:
    226228                    old_comp = Component(self.env, self._old['component'], db)
    227                     if old_comp.owner == self.values.get('owner'):
    228                         new_comp = Component(self.env, self['component'],
    229                                              db)
     229                    old_owner = old_comp.owner or ''
     230                    current_owner = self.values.get('owner') or ''
     231                    if old_owner == current_owner:
     232                        new_comp = Component(self.env, self['component'], db)
    230233                        self['owner'] = new_comp.owner
    231234                except TracError, e:
    232235                    # If the old component has been removed from the database we

comment:4 by Christian Boos, 13 years ago

Oops, the source link above should have been:

source:trunk/trac/ticket/model.py@2539#L414

comment:5 by Wilmer van der Gaast <wilmer@…>, 13 years ago

Oops, yeah, my conclusion was indeed wrong, turns out the problem appears with the Jabber module too. Those three are the modules without a specific owner.

Also, manually assigning someone to the bug and then setting the component seems to fix the problem. :-)

Thanks!

comment:6 by Christian Boos, 13 years ago

Now in 0.9-stable too (r2544)

comment:7 by Christian Boos, 13 years ago

Resolution: fixed
Status: assignedclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.