Modify

Opened 16 years ago

Last modified 12 years ago

#3245 new defect

rss feeds not parsed correctly which causes IcalExporterPlugin to fail

Reported by: Lars Skjærlund Owned by: Olemis Lang
Priority: normal Component: IcalExporterPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

I've just tried installing you nice plugin on a fresh Trac 0.11. Installation runs smoothly, but when I try activating the iCal link, Trac creates an Oops... with the following message:

Trac detected an internal error:
AttributeError: object has no attribute 'title'

Regards,
Lars

Attachments (0)

Change History (11)

comment:1 Changed 16 years ago by Jeff Hammel

Trac Release: 0.100.11

i can't reproduce this; can you provide more details as to what exactly you were doing? what link did you click on? was it a report? a ticket? ...etc. the more info, the better

comment:2 in reply to:  1 Changed 16 years ago by Jeff Hammel

Replying to k0s:

i can't reproduce this; can you provide more details as to what exactly you were doing? what link did you click on? was it a report? a ticket? ...etc. the more info, the better

also, the full traceback would be nice, if available

comment:3 Changed 16 years ago by ryan.kilkenny@…

Experiencing the same issue: AttributeError: object has no attribute 'title'

Using: report/1/ics - active tickets timeline/ics

I have multiple instances (projects) using the same base TRAC setup and so far this is only happening on one of them. The others are working properly.

Suspiciously. This particular instance is using a lot of custom ticket fields... So maybe there's a link.

comment:4 in reply to:  3 Changed 16 years ago by ryan.kilkenny@…

Replying to ryan.kilkenny@cadmusgroup.com: Most recent call last:

    * File "e:\python23\lib\site-packages\Trac-0.11-py2.3.egg\trac\web\main.py", line 423, in _dispatch_request
      Code fragment:
       418. try:
       419. if not env and env_error:
       420. raise HTTPInternalError(env_error)
       421. try:
       422. dispatcher = RequestDispatcher(env)
       423. dispatcher.dispatch(req)
       424. except RequestDone:
       425. pass
       426. resp = req._response or []
       427.  
       428. except HTTPException, e:
      Local variables:
      Name	Value
      after 	[u' except RequestDone:', u' pass', u' resp = ...
      before 	[u' try:', u' if not env and env_error:', u' raise ...
      dispatcher 	<trac.web.main.RequestDispatcher object at 0x052C2850>
      e 	<exceptions.AttributeError instance at 0x05608170>
      env 	<trac.env.Environment object at 0x050A4550>
      env_error 	None
      exc_info 	(<class exceptions.AttributeError at 0x005DE990>, ...
      filename 	'e:\\python23\\lib\\site-packages\\Trac-0.11-py2.3.egg\\trac\\web\\main.py' ...
      frames 	[{'function': '_dispatch_request', 'lines_before': [u' try:', u' ...
      has_admin 	True
      line 	u' dispatcher.dispatch(req)'
      lineno 	422
      message 	u"AttributeError: object has no attribute 'title'"
      req 	<Request "GET u'/timeline/ics'">
      resp 	[]
      tb 	<traceback object at 0x05CA0080>
      tb_hide 	None
      traceback 	'Traceback (most recent call last):\n File ...
    * File "e:\python23\lib\site-packages\Trac-0.11-py2.3.egg\trac\web\main.py", line 197, in dispatch
      Code fragment:
       192. req.args.get('__FORM_TOKEN') != req.form_token:
       193. raise HTTPBadRequest('Missing or invalid form token. '
       194. 'Do you have cookies enabled?')
       195.  
       196. # Process the request and render the template
       197. resp = chosen_handler.process_request(req)
       198. if resp:
       199. if len(resp) == 2: # Clearsilver
       200. chrome.populate_hdf(req)
       201. template, content_type = \
       202. self._post_process_request(req, *resp)
      Local variables:
      Name	Value
      chosen_handler 	<icalexporter.icalexporter.iCalExporterPlugin object at 0x05227810>
      chrome 	<trac.web.chrome.Chrome object at 0x05501670>
      err 	(<class exceptions.AttributeError at 0x005DE990>, ...
      handler 	<trac.timeline.web_ui.TimelineModule object at 0x054CD190>
      req 	<Request "GET u'/timeline/ics'">
      self 	<trac.web.main.RequestDispatcher object at 0x052C2850>
    * File "e:\python23\lib\site-packages\icalexporter-0.1-py2.3.egg\icalexporter\icalexporter.py", line 64, in process_request
      Code fragment:
        59. req.send_response(200)
        60. req.send_header('Content-Type', 'text/calendar;charset=utf-8')
        61. req.send_header('Content-Disposition', 'attachment; filename=%s' % filename)
        62. req.end_headers()
        63. calendar = iCal(req.write)
        64. calendar.from_rss(rss)
        65.  
        66.  
        67. ### methods for IRequestFilter
        68.  
        69. def pre_process_request(self, req, handler):
      Local variables:
      Name	Value
      calendar 	<icalexporter.ical.iCal object at 0x05BE9ED0>
      filename 	u'timeline.ics'
      path 	u'/timeline/ics'
      req 	<Request "GET u'/timeline/ics'">
      rss 	u'http://extrac.quantecllc.com/powermanagement/timeline?ticket=on&changeset ...
      self 	<icalexporter.icalexporter.iCalExporterPlugin object at 0x05227810>
      sub 	u'/timeline?ticket=on&changeset=on&milestone=on&wiki=on&max=50&daysback=90& ...
    * File "e:\python23\lib\site-packages\icalexporter-0.1-py2.3.egg\icalexporter\ical.py", line 114, in from_rss
      Code fragment:
       109. for key in attrmap:
       110. if key in entry:
       111. event.append(Property(attrmap[key], entry[key]))
       112. events.append(event)
       113.
       114. return self.write(feed.feed.title, events)
       115.  
       116. except ImportError:
       117. pass
       118.  
       119. if __name__ == '__main__':
      Local variables:
      Name	Value
      attrmap 	{'summary': 'DESCRIPTION', 'link': 'URL', 'title': 'SUMMARY'}
      events 	[]
      feed 	{'feed': {'subtitle': u'<div id="banner">\n <div id="header">\n ...
      self 	<icalexporter.ical.iCal object at 0x05BE9ED0>
      url 	u'http://extrac.quantecllc.com/powermanagement/timeline?ticket=on&changeset ...
    * File "build\bdist.win32\egg\feedparser.py", line 236, in __getattr__
      Local variables:
      Name	Value
      key 	'title'
      self 	{'subtitle': u'<div id="banner">\n <div id="header">\n <a ...

File "e:\python23\lib\site-packages\Trac-0.11-py2.3.egg\trac\web\main.py", line 423, in _dispatch_request
  dispatcher.dispatch(req)
File "e:\python23\lib\site-packages\Trac-0.11-py2.3.egg\trac\web\main.py", line 197, in dispatch
  resp = chosen_handler.process_request(req)
File "e:\python23\lib\site-packages\icalexporter-0.1-py2.3.egg\icalexporter\icalexporter.py", line 64, in process_request
  calendar.from_rss(rss)
File "e:\python23\lib\site-packages\icalexporter-0.1-py2.3.egg\icalexporter\ical.py", line 114, in from_rss
  return self.write(feed.feed.title, events)
File "build\bdist.win32\egg\feedparser.py", line 236, in __getattr__

comment:5 Changed 16 years ago by Jeff Hammel

Resolution: fixed
Status: newclosed

(In [4017]) dont fail if you cant find the title; hopefully fixes #3245

comment:6 Changed 16 years ago by Jeff Hammel

ive closed the ticket, because i think i have found the fix for the missing feed.feed.title attribute; however, this probably means the feed is not actually being parsed correctly (see http://www.feedparser.org/docs/basic-existence.html) so there might be other bugs that this is masking. I still can't reproduce the actual cause. Please open a new ticket if another such bug is found -- and note, more information means quicker fixes (espec since it doesn't seem to be a bug for me locally).

comment:7 Changed 16 years ago by ryan.kilkenny@…

Resolution: fixed
Status: closedreopened

In my case, this means that it now exports a blank ics file, which means all of the attribute fields are invalid I would guess... Can you think if it has to do with custo tickets at all? Thats the only difference between my working trac projects and this one. its the only one using custom ticket fields.

comment:8 Changed 16 years ago by ryan.kilkenny@…

on further investigation, it doesn't appear to even parse the url correctly I think. I tried to do some debugging with ical.py and couldn't get any results from the feed parser.

I also checked another instance of TRAC that I had recently upgraded from .10 to .11 and it suffered the same issue, but this time no custom ticket fields. Hoping to narrow down the issue, but I'm still lost.

comment:9 in reply to:  8 Changed 16 years ago by Jeff Hammel

Replying to ryan.kilkenny@cadmusgroup.com:

on further investigation, it doesn't appear to even parse the url correctly I think. I tried to do some debugging with ical.py and couldn't get any results from the feed parser.

I also checked another instance of TRAC that I had recently upgraded from .10 to .11 and it suffered the same issue, but this time no custom ticket fields. Hoping to narrow down the issue, but I'm still lost.

I would check these, in order:

  1. is the url that feedparser is trying to parse correct? That is, I would put a pdb or a print statement around http://trac-hacks.org/browser/icalexporterplugin/0.11/icalexporter/ical.py#L85 and see what the url is
  1. if the url is good, does it return the proper RSS? Since you have the rss url, try viewing it with a browser or other user agent. Is the RSS sane?
  1. if the RSS looks sane, does feedparser parse it correctly? Open the url with feedparser. Does it have a feed.title attribute? If not, it probably did not parse correctly. If not, save the RSS as a file, then read this with feedparser. Any better luck?

My guess is the problem is 1. I don't know of why custom fields would interfere with rss creation or parsing.

comment:10 Changed 15 years ago by Jeff Hammel

Owner: changed from Jeff Hammel to Lars Skjærlund
Status: reopenednew
Summary: Plugin crashes Tracrss feeds not parsed correctly which causes IcalExporterPlugin to fail

I am still unable to reproduce this. Could you please provide the output of /report/1?format=rss (assuming /report/1/ics is giving you the error)? Do you have any other plugins installed? If this is a public trac instance, I would appreciate the URL if you could give it.

Thanks for your help!

comment:11 Changed 12 years ago by Ryan J Ollos

Owner: changed from Lars Skjærlund to Olemis Lang

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Olemis Lang.

Add Comment


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

 
Note: See TracTickets for help on using tickets.