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)?

--Lucas

PS. Wow, huge response for the 0.12 release date/ticket types inquiry. I
think about a workaround with an initial triage and then locking the ticket
types somehow.

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/wiki/for
matter.py", line 468, in _macro_formatter
    return macro.process(args, in_paragraph=True)
  File
"/usr/local/lib/python2.5/site-packages/Trac-0.11rc1-py2.5.egg/trac/wiki/for
matter.py", line 179, in process
    text = self.processor(text)
  File
"/usr/local/lib/python2.5/site-packages/Trac-0.11rc1-py2.5.egg/trac/wiki/for
matter.py", line 166, in _macro_processor
    text)
  File
"/usr/local/lib/python2.5/site-packages/Trac-0.11rc1-py2.5.egg/trac/wiki/mac
ros.py", line 425, in expand_macro
    if attachment and 'ATTACHMENT_VIEW' in formatter.perm(attachment):
  File
"/usr/local/lib/python2.5/site-packages/Trac-0.11rc1-py2.5.egg/trac/perm.py"
, line 521, in has_permission
    return self._has_permission(action, resource)
  File
"/usr/local/lib/python2.5/site-packages/Trac-0.11rc1-py2.5.egg/trac/perm.py"
, line 535, in _has_permission
    check_permission(action, perm.username, resource, perm)
  File
"/usr/local/lib/python2.5/site-packages/Trac-0.11rc1-py2.5.egg/trac/perm.py"
, line 432, in check_permission
    (username, action, resource))
  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)))


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to trac-dev@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to