Opened 19 years ago
Closed 19 years ago
#2383 closed defect (fixed)
Can't set component correctly
Reported by: | 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: | |||
Internal 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 , 19 years ago
comment:2 by , 19 years ago
Cc: | added |
---|
comment:3 by , 19 years ago
Milestone: | → 0.9.1 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
From the stack trace it rather looks like those component have no owner (empty string).
Ok, I can reproduce it:
- manually assign null to the owner
component2
- create a new ticket with
component
set tocomponent1
- change
component
tocomponent2
⇒ 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
129 129 self._old[name] = self.values.get(name) 130 130 elif self._old[name] == value: # Change of field reverted 131 131 del self._old[name] 132 self.values[name] = value .strip()132 self.values[name] = value and value.strip() 133 133 134 134 def populate(self, values): 135 135 """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
224 226 and not self._old.has_key('owner'): 225 227 try: 226 228 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) 230 233 self['owner'] = new_comp.owner 231 234 except TracError, e: 232 235 # If the old component has been removed from the database we
comment:5 by , 19 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:7 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
And oh yeah, I'm running trac+darcs with a bzr repository, might be a good thing to mention.