Modify ↓
Opened 15 years ago
Closed 15 years ago
#6258 closed defect (fixed)
'Fragment' object has no attribute 'attrib'
Reported by: | Owned by: | Alexey Kinyov | |
---|---|---|---|
Priority: | normal | Component: | FlashEmbedMacro |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.11 |
Description
This error was shown when i tried to embed a .swf movie
Error: Macro Embed(swf=attachment:output.swf,w=400,h=300) failed 'Fragment' object has no attribute 'attrib'
Attachments (0)
Change History (5)
comment:1 Changed 15 years ago by
comment:3 follow-up: 4 Changed 15 years ago by
The extract_link code now returns a stream instead of one element. The following diff should fix for inputs following forms:
[[Embed(swf=output.swf)]]
[[Embed(swf=attachment:output.swf)]]
Index: tracflashembed/macros.py =================================================================== --- tracflashembed/macros.py (revision 7791) +++ tracflashembed/macros.py (working copy) @@ -9,7 +9,6 @@ from StringIO import StringIO from genshi.builder import tag from trac.wiki.api import IWikiMacroProvider, parse_args -from trac.wiki.formatter import format_to_oneliner, extract_link from trac.wiki.macros import WikiMacroBase @@ -95,10 +94,9 @@ # url for attachment if url[0] != '/' and url[0:7] != 'http://' and url[0:8] != 'https://': - if url[:11] != 'attachment:': - url = 'attachment:%s' % url - url = extract_link(formatter.env, formatter.context, '[%s attachment]' % url) - url = '/raw-' + url.attrib.get('href')[1:] + if url[:11] == 'attachment:': + url = url[11:] + url = formatter.env.abs_href('/raw-attachment/%s/%s/%s' % (formatter.resource.realm, formatter.resource.id, url)) # embed code code = '<object width="%(w)s" height="%(h)s">\
comment:4 Changed 15 years ago by
Status: | new → assigned |
---|
comment:5 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note: See
TracTickets for help on using
tickets.
I'm using Trac 0.11.1, Python 2.5.2
This is the log: