Modify ↓
      
#12173 closed defect (fixed)
Users added to CC are not notified by CarbonCopySubscriber
| Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos | 
|---|---|---|---|
| Priority: | normal | Milestone: | 1.0.9 | 
| Component: | notification | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | 
           Fixed: user added to empty CC list was not notified (1.2).  | 
      ||
| API Changes: | 
           
  | 
      ||
| Internal Changes: | |||
Description
The issue occurs when there are no users in the CC list, in which case event.changes['fields']['cc']['old'] is None: tags/trac-1.1.6/trac/ticket/notification.py@:466#L442.
>>> from trac.web.chrome import Chrome >>> from trac.test import EnvironmentStub >>> env = EnvironmentStub() >>> chrome = Chrome(env) >>> to_set = lambda cc: set(chrome.cc_list(cc)) >>> to_set(None) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 1, in <lambda> File "trac/web/chrome.py", line 1276, in cc_list for cc in re.split(r'[;,]', cc_field): File "/home/user/Workspace/t11944/py2.7/lib/python2.7/re.py", line 167, in split return _compile(pattern, flags).split(string, maxsplit) TypeError: expected string or buffer
We could fix the issue with the following:
- 
      
trac/web/chrome.py
diff --git a/trac/web/chrome.py b/trac/web/chrome.py index ba1896b..d4ed748 100644
a b class Chrome(Component): 1273 1273 def cc_list(self, cc_field): 1274 1274 """Split a CC: value in a list of addresses.""" 1275 1275 ccs = [] 1276 for cc in re.split(r'[;,]', cc_field ):1276 for cc in re.split(r'[;,]', cc_field or ''): 1277 1277 cc = cc.strip() 1278 1278 if cc: 1279 1279 ccs.append(cc)  
Attachments (0)
Change History (4)
comment:2 by , 10 years ago
| Milestone: | 1.2 → 1.0.9 | 
|---|
I'll also add test coverage for CarbonCopySubscriber.
comment:3 by , 10 years ago
| Owner: | set to | 
|---|---|
| Status: | new → assigned | 
  Note:
 See   TracTickets
 for help on using tickets.
    


  
It seems
Chrome.cc_list()in 1.0-stable has the same issue. I think we should apply it on 1.0-stable to make robust. That is a public api for Trac core and plugins.