Lucas Eisenzimmer wrote: > I am inquiring some advice although I know that it is a tough time with the > release of 0.11 (although my issue is somehow related with this). > > I am conducting some feasibility studies for a TracToDoc (yes, MS Word) > export and have one bigger issue there, which is images. The export works > like e.g. the PDF-Plugin, which is: (1) saving the wiki page into a > temporary file, (2) converting it, (3) reading the converted file and > returning its contents. > The export of images usually works like that the href-attributes in the > <img>-Tags created by the ImageMacro are replaced using regexps to directly > point to the files itself. There I face a problem. > > The wiki page is being rendered the new way as described in > http://trac.edgewall.org/wiki/WikiMacros#expand_macrodetails. Speaking of > the context, the formatter object is not available, since for conversions > the IContentConverter interface is used (instead of the IWikiMacroProvider). > The according convert_content() method still provides me with the req object > (instead of the formatter one). I retrieved the context using > Context.from_request(req), but by doing this, the ImageMacro fails with an > permission issue (attached below). My guess is that, as described in > http://trac.edgewall.org/wiki/TracDev/ApiChanges/0.11#IWikiMacroProvider, > the context created by Context.from_request(req) is different to > formatter.context. The same error occurs with the PDF-Plugin, where images > worked until I updated Trac from 0.11b2 to 0.11rc1. Is this the crux of the > matter? The image is an attachment, but with images from svn the same > problem occurs. > > So, assuming I have to use formatter.context instead of > Context.from_request(req), my question basically is: how can I get hold of > the formatter object when being in convert_content(req, mimetype, content, > key)? >
See http://trac.edgewall.org/browser/trunk/trac/mimeview/[EMAIL PROTECTED] (and #3332). As a workaround, you can attach the appropriate Resource yourself to the context, getting the page name from the req.path_info. > Error log > ------------------------------------------------------ > 2008-06-30 20:28:34,888 Trac[formatter] ERROR: Macro Image(eHR_logo.png, > alt=Alternativtext, title=Titeltext) failed > Traceback (most recent call last): > File > ... > "/usr/local/lib/python2.5/site-packages/Trac-0.11rc1-py2.5.egg/trac/resource > .py", line 111, in __repr__ > return '<Resource %r>' % (', '.join(reversed(path))) > > Yes, this __repr__ method needs to be made more robust. -- Christian --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Trac Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/trac-dev?hl=en -~----------~----~----~----~------~----~------~--~---
