Ticket #7974 (new defect)

Opened 2 years ago

Last modified 6 months ago

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

Reported by: anonymous Assigned to: doki_pen
Priority: normal Component: AnnouncerPlugin
Severity: normal Keywords:
Cc: jbeilicke, rjollos, hasienda 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

Change History

07/11/11 14:45:48 changed by jbeilicke

  • cc set to jbeilicke.

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.

12/02/11 03:56:25 changed by rjollos

  • cc changed from jbeilicke to jbeilicke, rjollos.

12/02/11 03:57:01 changed by rjollos

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

12/02/11 04:00:50 changed by rjollos

  • cc changed from jbeilicke, rjollos to jbeilicke, rjollos, hasienda.

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.


Add/Change #7974 (UnboundLocalError: local variable 'tid' referenced before assignment with announcements from AccountManager plugin)




Change Properties
Action