Modify

Opened 16 years ago

Closed 16 years ago

Last modified 4 years ago

#4086 closed defect (fixed)

Attachment not found, Macro not evaluated

Reported by: alexander@… Owned by: Martin Scharrer
Priority: normal Component: AttachmentNumMacro
Severity: blocker Keywords:
Cc: Trac Release: 0.11

Description

Hi there,

when I put this in my custom field of the ticket (which accepts Wiki-formatting, e.g. [raw-attachment:file.pdf] works without problems] I get the result displayed as [[AttachmentNum(...)]. When I put it in the description field I get a "Attachment not found" error, although there is an attachment. When I let it display the type and ID used in the SQL query the type is ticket, which seems ok, but the ID is "Ticket #8", which is probably not ok, most likely this should be just "8"?

Sorry, I would fix this myself, but I have no clue about python neither about the necessary functions in trac (get_resource_id maybe?)

Thanks and best, ALEXander.

Attachments (0)

Change History (11)

comment:1 Changed 16 years ago by alexander@…

The last part of the first sentence should read "I get the result displayed as ![[AttachmentNum?(...)]. "

comment:2 Changed 16 years ago by anonymous

Owner: changed from Martin Scharrer to anonymous
Status: newassigned

By sure to end the macro with two ]], you only have one here.

I had to look for the proper functions to get the resource ID two and tested it only with wiki pages. I have to look into this, but I don't have time until the week end.

comment:3 Changed 16 years ago by Martin Scharrer

Owner: changed from anonymous to Martin Scharrer
Status: assignednew

Wasn't logged in :-)

comment:4 Changed 16 years ago by Martin Scharrer

Status: newassigned

comment:5 Changed 16 years ago by alexander@…

Yeah, I used to brackets, just a mistake in the description. No worries about taking your time, it's not at all urgent.

comment:6 Changed 16 years ago by Martin Scharrer

I found the fix for the ID right away. Try the new revision which works with tickets on my trac.

I can't do much about the non-evaluation from here. Can you try if other macros (not wiki links) work there or not. What kind of custom field do you use? This error might be a bug in the custom field implementation not this macro.

comment:7 Changed 16 years ago by alexander@…

Resolution: fixed
Status: assignedclosed

Yeah, now it shows in the wiki. I applied changeset [7563] to version 0.11.1 to get WikiFormatting into custom fields (I use text). But the image macro also does not work there, seems to be an issue with the patch. Well.... I think now I will wait for 0.12.

comment:8 Changed 16 years ago by alexander@…

I checked and it seems that wiki_to_oneliner(), which is used to evaluate the WikiFormatting in the query display (source:/trunk/trac/ticket/templates/query_results.html@7563#65) does not evaluate macros. I changed it to wiki_to_html, but then <p> and </p> tags are inserted, which make the list twice as long. I think I will stop now and go to bed :)

comment:10 Changed 16 years ago by Martin Scharrer

AFIK the wiki_to_... functions are deprecated anyway. Use the format_to_onliner function there, which should expand macros. Try to test it with some other macro instead of the Image macro ... its code isn't really my favorite.

BTW, you can just add trac: in front of source: links to point to trac.edgewall.org, i.e. trac:source:/trunk/trac/ticket/templates/query_results.html@7563#65

comment:11 Changed 16 years ago by Martin Scharrer

Mmpf, the above link seems only to work with Trac 0.11 :-(

Modify Ticket

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