Edgewall Software

Ticket #2383 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Can't set component correctly

Reported by: wilmer@… Owned by: cboos
Priority: normal Milestone: 0.9.1
Component: ticket system Version: 0.9
Severity: major Keywords:
Cc: wilmer@…

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

Change History

Changed 3 years ago by wilmer@…

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

Changed 3 years ago by Wilmer van der Gaast <wilmer@…>

  • cc wilmer@… added

Changed 3 years ago by cboos

  • owner changed from jonas to cboos
  • status changed from new to assigned
  • milestone set to 0.9.1

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 

Changed 3 years ago by cboos

Oops, the source link above should have been:

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

Changed 3 years ago by Wilmer van der Gaast <wilmer@…>

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!

Changed 3 years ago by cboos

Now in 0.9-stable too (r2544)

Changed 3 years ago by cboos

  • status changed from assigned to closed
  • resolution set to fixed

Add/Change #2383 (Can't set component correctly)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from cboos. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.