Modify

Opened 11 years ago

Closed 11 years ago

Last modified 5 years ago

#11800 closed defect (invalid)

AttributeError: 'NoneType' object has no attribute 'id'

Reported by: ramprasad.subramanian@… Owned by: Steffen Hoffmann
Priority: high Component: DiscussionPlugin
Severity: critical Keywords: reply, error
Cc: Trac Release: 1.0

Description

How to Reproduce

While doing a GET operation on /discussion/topic/3, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{'discussion_action': u'add', 'message': u'5', 'topic': u'3'}

User agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36

System Information

Trac 1.0.1
Babel 0.9.6
Genshi 0.6 (without speedups)
mod_wsgi 3.3 (WSGIProcessGroup WSGIApplicationGroup %{GLOBAL})
MySQL server: "5.5.25", client: "6.0.0", thread-safe: 1
MySQLdb 1.2.4b4
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)]
RPC 1.1.2
setuptools 0.6c11
Subversion 1.7.5 (r1336830)
Subversion 1.7.5 (r1336830)
jQuery 1.7.2

Enabled Plugins

estimationtools 0.4.6
hudsontrac 0.5
jqchart 1.0dev
macro N/A
MilestoneCompactMacro N/A
svnsyncplugin 0.1.2
ticket-clone N/A
ticket-clone-bk-12032014 N/A
ticketimport 0.8.3
ticketsidebarprovider 0.0
ticketvalidator 0.2dev
tracaccountmanager 0.3.2
tracaddcommentmacro 0.3
traccustomfieldadmin 0.2.8
tracdatefield 1.1.0
tracdiscussion 0.9dev
trachoursplugin 0.6.0dev
tracmacropost 0.2
tracserverdownmacro 1.0
tracsubticketsplugin 0.2.0.dev-20130717
tracsumfields 1.0.1
tracticketcharts 0.2dev
tracworkflowadmin 0.12.0.2
tracxmlrpc 1.1.2
wikicalendarmacro 2.0.0dev
YumlPreprocessor N/A

Python Traceback

Traceback (most recent call last):
  File "build\bdist.win32\egg\trac\web\main.py", line 497, in _dispatch_request
    dispatcher.dispatch(req)
  File "build\bdist.win32\egg\trac\web\main.py", line 214, in dispatch
    resp = chosen_handler.process_request(req)
  File "build\bdist.win-amd64\egg\tracdiscussion\core.py", line 119, in process_request
    template, data = api.process_discussion(context)
  File "build\bdist.win-amd64\egg\tracdiscussion\api.py", line 274, in process_discussion
    self._do_actions(context, actions)
  File "build\bdist.win-amd64\egg\tracdiscussion\api.py", line 1391, in _do_actions
    self._prepare_message_list(context, context.topic)
  File "build\bdist.win-amd64\egg\tracdiscussion\api.py", line 1566, in _prepare_message_list
    .attachment_data(context)
  File "build\bdist.win32\egg\trac\attachment.py", line 559, in attachment_data
    context.href),
  File "build\bdist.win32\egg\trac\resource.py", line 297, in get_resource_url
    return manager.get_resource_url(resource, href, **kwargs)
  File "build\bdist.win32\egg\trac\attachment.py", line 650, in get_resource_url
    resource.parent(version=None), Href('')))
  File "build\bdist.win32\egg\trac\resource.py", line 297, in get_resource_url
    return manager.get_resource_url(resource, href, **kwargs)
  File "build\bdist.win-amd64\egg\tracdiscussion\api.py", line 209, in get_resource_url
    (self.get_resource_url(resource.parent, href),
  File "build\bdist.win-amd64\egg\tracdiscussion\api.py", line 204, in get_resource_url
    if resource.id:
AttributeError: 'NoneType' object has no attribute 'id'

Attached screenshot highlighting when I get the error.

Attachments (1)

second_level_message_error.PNG (13.0 KB) - added by ramprasad.subramanian@… 11 years ago.
screenshot discussion error

Download all attachments as: .zip

Change History (16)

Changed 11 years ago by ramprasad.subramanian@…

screenshot discussion error

comment:1 Changed 11 years ago by Ryan J Ollos

Owner: changed from anonymous to Steffen Hoffmann
Status: newassigned

comment:2 in reply to:  description Changed 11 years ago by Steffen Hoffmann

Replying to ramprasad.subramanian@…:

How to Reproduce

While doing a GET operation on /discussion/topic/3, Trac issued an internal error.

(please provide additional details here)

AttributeError: 'NoneType' object has no attribute 'id'

Attached screenshot highlighting when I get the error.

Still a bit unclear. You intended to 'Reply' to the first reply under the third topic, right?

The development version (0.9dev) is currently under heavy development, so it probably should be under trunk rather than 0.11. You happened to pull an arbitrary revision in-between a series of changes to introduce a complete Trac resource and fine-grained permissions to this plugin.

Sorry for the inconvenience, but I felt urged to step in here with regular non-maintainer changes, eventually ending in taking over full maintainer-ship, but this is the future.

For the time being I recommend to pull another, current copy from 0.11 branch, that should already work much better than last time you checked it out. In fact I cannot reproduce the error with the current revision. Please report back with you findings as you time permits.

comment:3 Changed 11 years ago by ramprasad.subramanian@…

Hi Hasienda, I have downloaded the source from the link given in the plugin page. http://trac-hacks.org/changeset/latest/discussionplugin?old_path=/&filename=discussionplugin&format=zip

I just generated the egg file and installed the same on trac and then upgraded our DB as described.

The error comes up when I click on the any of the operations - Reply, Quote or Edit operation for any of the replies to the topic.

I tried installing again but met with no luck. Can you please help me here?

Regards, Ram

comment:4 in reply to:  3 ; Changed 11 years ago by Steffen Hoffmann

Please confirm or correct my statements below.

Replying to ramprasad.subramanian@…:

Hi Hasienda, I have downloaded the source from the link given in the plugin page. http://trac-hacks.org/changeset/latest/discussionplugin?old_path=/&filename=discussionplugin&format=zip

This is a 'get-anything' archive. You did build the egg from source in the 0.11 folder?

I just generated the egg file and installed the same on trac and then upgraded our DB as described.

You didn't see any upgrade error, did you?

The error comes up when I click on the any of the operations - Reply, Quote or Edit operation for any of the replies to the topic.

Hm, as I told you I cannot see an issue with any of these operations, so I need more information from you.

I tried installing again but met with no luck.

You did replace the older egg with the latest built, deploy/refresh static resource in case of serving though a web server other than tracd, and restarted the server afterwards too?

But wait - the issue seems to be raised when evaluating a discussion attachment resource that is missing appropriate parent resource data, hence the error. This is where I'm right now.

Other than waiting for my progress in code review and finalizing fine-grained permission support you could revert back to revision 13910 (<-- download link), right before the start of current series of disruptive changes. This doesn't require changes to the db schema, so it is a zero-risk operation.

comment:5 in reply to:  4 Changed 11 years ago by Steffen Hoffmann

Replying to hasienda:

But wait - the issue seems to be raised when evaluating a discussion attachment resource that is missing appropriate parent resource data, hence the error. This is where I'm right now.

Confirmed easily by adding a single attachment to a topic. Hold on, I'll try to fix this before weekends end.

comment:6 Changed 11 years ago by Steffen Hoffmann

In 13942:

DiscussionPlugin: Hotfix for topic (attachment parent) Trac resource, refs #756 and #11800.

I've been expecting issues when moving on towards unified resources and
resource permissions. This is another hack before being able to associate
attachments with full resource path, not just topic, the current shortcut.

comment:7 Changed 11 years ago by Steffen Hoffmann

I've added the same revision-pinned download link I recommended in comment:4 to plugin's wiki page as well.

I invite you to close this ticket, if you tests of r13942 or later indicate that the issue has been resolved for you too.

comment:8 Changed 11 years ago by ramprasad.subramanian@…

Hello, I tried both the approaches: First I downloaded the plugin link from 13910 download link. The error still persists.

Second I replaced the api.py file from the hotfix and installed the plugin. In this case the tab "Discussion" did not even appear even though the plugin shows enabled in the admin UI.

Not sure what to do now. Do you want me to attach any other information?

I restart the Apache server everytime I install the plugin. The difference in above two approaches shows that the server is taking up the replaced egg files.

Regards, Ram

comment:9 Changed 11 years ago by ramprasad.subramanian@…

Continuing from my earlier comment....

I am pasting the log during the first approach during the hotfix installation:

  File "E:\Program Files\BitNami Trac Stack\python\lib\site-packages\setuptools-0.6c11-py2.7.egg\pkg_resources.py", line 1954, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "build\bdist.win-amd64\egg\tracdiscussion\timeline.py", line 21, in <module>
  File "build\bdist.win-amd64\egg\tracdiscussion\api.py", line 30, in <module>
ImportError: No module named compat
2014-05-31 11:25:54,897 Trac[loader] ERROR: Skipping "TracDiscussion.wiki = tracdiscussion.wiki": 
Traceback (most recent call last):
  File "build\bdist.win32\egg\trac\loader.py", line 68, in _load_eggs
    entry.load(require=True)
  File "E:\Program Files\BitNami Trac Stack\python\lib\site-packages\setuptools-0.6c11-py2.7.egg\pkg_resources.py", line 1954, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "build\bdist.win-amd64\egg\tracdiscussion\wiki.py", line 34, in <module>
  File "build\bdist.win-amd64\egg\tracdiscussion\api.py", line 30, in <module>
ImportError: No module named compat

Regards, Ram

Last edited 11 years ago by Jun Omae (previous) (diff)

comment:10 Changed 11 years ago by Steffen Hoffmann

Thanks for the information. compat is a new module added lately. It shouldn’t have issues to find it. The error suggests, that your egg cache is not consistent, and you may still load an older plugin version.

Because I could reproduce you issue, I see no reason, why the fixed code produces an unchanged error. I suggest to have a look into this and try to remove any obsolete plugin code and reinstall.

comment:11 Changed 11 years ago by Steffen Hoffmann

There is evidence for my theory of different interfering plugin versions: Trac egg is in bdist.win32 while the plugin is called from bdist.win-amd64. Please check at least these locations, eliminate any old plugin code and reinstall either from the pinned version (r13910) or r13942 or later.

And why didn't you mention attachments in your test reports, neither here nor in today's mailing-list posting, while I did not see any such issue until I added at least one topic-attachment? You mentioned just replying to messages what doesn't look critical, because it wouldn't trigger the code in the trace-back at all.

comment:12 Changed 11 years ago by ramprasad.subramanian@…

I am still figuring out the locations of the plugin cache although I do not see any cache issues with any of the other plugins.The error occurs irrespective of I attach or not attach anything.

Regards, Ram

comment:13 in reply to:  12 Changed 11 years ago by Steffen Hoffmann

Replying to ramprasad.subramanian@…:

The error occurs irrespective of I attach or not attach anything.

You mean the ImportError here? May I ask you to confirm that your checkout contains the file 'tracdiscussion/compat.py', please?

You said, that the error occurs even on reply to messages under attachment-less topics?

comment:14 Changed 11 years ago by ramprasad.subramanian@…

I just downloaded and installed the plugin again and all problems have disappeared :). Thanks. The issue was even with attachment-less topics.

Thanks Again .

comment:15 Changed 11 years ago by Steffen Hoffmann

Resolution: invalid
Status: assignedclosed

Great, so just what I thought - a local installation issue. Thanks for the positive feedback.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Steffen Hoffmann.
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.