Ok, now I fixed it using format_to_html instead of wiki_to_html, and creating a correct Context.
Users of wikiprint, please update to latest version, as now attachment: and Image problems should be fixed. Greets. On Tue, Apr 7, 2009 at 2:38 PM, Álvaro J. Iradier <[email protected]> wrote: > After some digging... > later in convert_content, I call 'trac.wiki.formatter.wiki_to_html': > > ---------- > page = trac_wiki_to_html(text, env, req, absurls=True) > ---------- > > which is: > > ---------- > def wiki_to_html(wikitext, env, req, db=None, > absurls=False, escape_newlines=False): > if not wikitext: > return Markup() > abs_ref, href = (req or env).abs_href, (req or env).href > context = Context.from_request(req, absurls=absurls) > ---------- > > and Context.from_request: > > ----------- > def from_request(cls, req, resource=None, id=False, version=False, > absurls=False): > > #.... > > self = cls(Resource(resource, id=id, version=version), href=href, > perm=perm) > ----------- > > So resource will always be None in the used context... > > is there a suggested workaround? > or should I write my own version of wiki_to_html function and create a > Context object using the constructor instead of Content.from_request? > > Thanks > > On Tue, Apr 7, 2009 at 2:10 PM, Álvaro J. Iradier > <[email protected]> wrote: >> The req object is the parameter received in the call to >> 'convert_content' on my IContentConverter implementation. It's called >> when clicking the new format in the "Download in other formats" link >> at the bottom of the wiki page. Shouldn't be already initialized? >> >> If not, I already get the wiki page Resource with: >> >> wikipage = WikiPage(self.env, req.args.get('page', 'WikiStart')) >> >> how do I set this resource to the req object? >> >> I guess this will also fix the problem with the >> [[Image(wiki:file.jpg)]] (omitting page name) in the PDF plugin. >> >> Thanks very much! >> >> >> On Mon, Apr 6, 2009 at 3:04 PM, Christian Boos <[email protected]> wrote: >>>> My guess is Trac is trying to display an error, but it fails? >>>> >>>> Is this a bug I should report, or is there a problem with my plugin? >>>> >>>> Thanks very much, tell me if you need more info. >>>> >>> >>> The req object has been wrongly initialized, you need to specify a >>> resource (here, Resource('wiki', 'PageName')). Otherwise, how would you >>> know which page is the one containing the attachment when you're talking >>> about attachment:file.txt? >>> >>> -- Christian >>> >>> >>> >>> >> >> >> >> -- >> Álvaro J. Iradier Muro >> Departamento de Desarrollo >> [email protected] >> >> Polar Technologies >> T +34 976 527 952 >> F +34 976 466 125 >> www.polartech.es >> >> Antes de imprimir este mensaje, por favor, compruebe que es verdaderamente >> necesario. El medioambiente es cosa de todos. >> >> AVISO LEGAL >> Este mensaje, y en su caso, cualquier fichero anexo al mismo, puede contener >> información confidencial, siendo para uso exclusivo del destinatario, >> quedando prohibida su divulgación, copia o distribución a terceros sin la >> autorización expresa del remitente. Si Vd. ha recibido este mensaje >> erróneamente, se ruega lo notifique al remitente y proceda a su borrado. >> Gracias por su colaboración. >> > > > > -- > Álvaro J. Iradier Muro > Departamento de Desarrollo > [email protected] > > Polar Technologies > T +34 976 527 952 > F +34 976 466 125 > www.polartech.es > > Antes de imprimir este mensaje, por favor, compruebe que es verdaderamente > necesario. El medioambiente es cosa de todos. > > AVISO LEGAL > Este mensaje, y en su caso, cualquier fichero anexo al mismo, puede contener > información confidencial, siendo para uso exclusivo del destinatario, > quedando prohibida su divulgación, copia o distribución a terceros sin la > autorización expresa del remitente. Si Vd. ha recibido este mensaje > erróneamente, se ruega lo notifique al remitente y proceda a su borrado. > Gracias por su colaboración. > -- Álvaro J. Iradier Muro Departamento de Desarrollo [email protected] Polar Technologies T +34 976 527 952 F +34 976 466 125 www.polartech.es Antes de imprimir este mensaje, por favor, compruebe que es verdaderamente necesario. El medioambiente es cosa de todos. AVISO LEGAL Este mensaje, y en su caso, cualquier fichero anexo al mismo, puede contener información confidencial, siendo para uso exclusivo del destinatario, quedando prohibida su divulgación, copia o distribución a terceros sin la autorización expresa del remitente. Si Vd. ha recibido este mensaje erróneamente, se ruega lo notifique al remitente y proceda a su borrado. Gracias por su colaboración. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
