Modify

Opened 7 years ago

Closed 5 months ago

#7974 closed defect (fixed)

UnboundLocalError: local variable 'tid' referenced before assignment with announcements from AccountManager plugin

Reported by: anonymous Owned by:
Priority: normal Component: AnnouncerPlugin
Severity: major Keywords: acct_mgr subscriber
Cc: Jan Beilicke, Ryan J Ollos, Robert Corsaro Trac Release: 0.12

Description

2010-11-02 22:31:40,402 Trac[api] ERROR: AnnouncementSystem failed.
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/TracAnnouncer-0.12.1.dev-py2.6.egg/announcer/api.py", line 536, in _real_send
    subscriptions = self.resolver.subscriptions(evt)
  File "/usr/local/lib/python2.6/dist-packages/TracAnnouncer-0.12.1.dev-py2.6.egg/announcer/api.py", line 342, in subscriptions
    [x for x in sp.matches(event) if x]
  File "/usr/local/lib/python2.6/dist-packages/TracAnnouncer-0.12.1.dev-py2.6.egg/announcer/subscribers.py", line 840, in matches
    klass, event.realm, self._get_target_id(event.target))
  File "/usr/local/lib/python2.6/dist-packages/TracAnnouncer-0.12.1.dev-py2.6.egg/announcer/subscribers.py", line 859, in _get_target_id
    return tid
UnboundLocalError: local variable 'tid' referenced before assignment

n.b. Plugin for AccountManager doesn’t send emails correctly even when this issue is fixed.

Attachments (0)

Change History (7)

comment:1 Changed 6 years ago by Jan Beilicke

Cc: Jan Beilicke added; anonymous removed

Providing some additional information:

I have this issue when trying to reset a password:

2011-07-11 11:54:44,867 Trac[main] DEBUG: Dispatching <Request "POST '/reset_password'">
2011-07-11 11:54:44,869 Trac[session] DEBUG: Retrieving session for ID '51af8124b3e3f79a239f76bd'
2011-07-11 11:54:44,869 Trac[main] DEBUG: Negotiated locale: ['de-de', 'de', 'en-us', 'en'] -> de
2011-07-11 11:54:44,879 Trac[api] INFO: Synchronized '' repository in 0.01 seconds
2011-07-11 11:54:44,879 Trac[api] INFO: Password reset user: foo, foo@example.org
2011-07-11 11:54:44,888 Trac[api] ERROR: AnnouncementSystem failed.
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/announcer/api.py", line 536, in _real_send
    subscriptions = self.resolver.subscriptions(evt)
  File "build/bdist.linux-x86_64/egg/announcer/api.py", line 342, in subscriptions
    [x for x in sp.matches(event) if x]
  File "build/bdist.linux-x86_64/egg/announcer/subscribers.py", line 840, in matches
    klass, event.realm, self._get_target_id(event.target))
  File "build/bdist.linux-x86_64/egg/announcer/subscribers.py", line 859, in _get_target_id
    return tid
UnboundLocalError: local variable 'tid' referenced before assignment
2011-07-11 11:54:44,896 Trac[api] DEBUG: AnnouncementSystem sent event in 0.01 seconds.
2011-07-11 11:54:44,896 Trac[api] INFO: Updated password for user: foo
2011-07-11 11:54:44,898 Trac[api] ERROR: AnnouncementSystem failed.
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/announcer/api.py", line 536, in _real_send
    subscriptions = self.resolver.subscriptions(evt)
  File "build/bdist.linux-x86_64/egg/announcer/api.py", line 342, in subscriptions
    [x for x in sp.matches(event) if x]
  File "build/bdist.linux-x86_64/egg/announcer/subscribers.py", line 840, in matches
    klass, event.realm, self._get_target_id(event.target))
  File "build/bdist.linux-x86_64/egg/announcer/subscribers.py", line 859, in _get_target_id
    return tid
UnboundLocalError: local variable '' referenced before assignment
2011-07-11 11:54:44,898 Trac[api] DEBUG: AnnouncementSystem sent event in 0.0 seconds.

I fixed a typo of the variable:

Index: trunk/announcer/subscribers.py
===================================================================
--- trunk/announcer/subscribers.py      (revision 10429)
+++ trunk/announcer/subscribers.py      (working copy)
@@ -855,7 +855,7 @@
         elif hasattr(target, 'name'):
             tid = target.name
         else:
-            id = str(target)
+            tid = str(target)
         return tid
 
 class GeneralWikiSubscriber(Component):

As the author of this ticket aready mentioned, the issue is not resolved by this fix. No mail is sent.

comment:2 Changed 5 years ago by Ryan J Ollos

Cc: Ryan J Ollos added

comment:3 Changed 5 years ago by Ryan J Ollos

(In [10986]) Refs #7974: Fixed typo in subscribers.

comment:4 Changed 5 years ago by Ryan J Ollos

Cc: Steffen Hoffmann added

I'm finding nothing in the logs indicating what the problem might be, after apply the fix for the typo. I can maybe dig into this over the weekend.

comment:5 Changed 5 years ago by Steffen Hoffmann

Cc: Robert Corsaro added; Steffen Hoffmann removed
Keywords: acct_mgr subscriber added
Owner: changed from Robert Corsaro to Steffen Hoffmann
Severity: normalmajor

I can't reproduce with current trunk code, so this suggests, that Ryan's change resolved it.

If not, I'll take care for this, after fixing some other issues as mentioned in #7977 too.

comment:6 Changed 6 months ago by Ryan J Ollos

Owner: Steffen Hoffmann deleted

comment:7 Changed 5 months ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.