Modify

Opened 14 months ago

Last modified 12 months ago

#11122 new enhancement

problems with DiaVisView Images

Reported by: anonymous Owned by: abompard
Priority: normal Component: OdtExportPlugin
Severity: normal Keywords: DiaVisView
Cc: Trac Release:

Description

If I export a page with a DiaVisView Macro call the resulting odt document contained just an empty Image container.

I did this hack to make it work:

--- odtexport.py	2013-03-25 00:56:46.000000000 +0100
+++ odtexport.py	2013-05-28 16:07:53.000000000 +0200
@@ -262,6 +262,9 @@
         # Handle attached images
         html = re.sub('<img [^>]*src="(%s/raw-attachment/([^/]+)(?:/([^"]*))?)"'
                       % base_url, self.handle_attached_img, html)
+        # Handle DiaVisView images
+        html = re.sub('<img [^>]*src="(%s/attachment/([^/]+)(?:/([^"]*))?)"'
+                      % base_url, self.handle_attached_img, html)
         # Handle chrome images
         html = re.sub('<img [^>]*src="(%s/chrome/([^"]+))"'
                       % base_url, self.handle_chrome_img, html)
@@ -278,6 +281,8 @@
         path_segments = path.split("/")
         parent_id = '/'.join(path_segments[:-1])
         filename = len(path_segments) > 1 and path_segments[-1]
+	filename = re.sub('\?format=raw','',filename)
+        self.env.log.debug('filename: %s' % filename)
         attachment = Attachment(self.env, realm, parent_id, filename)
         filename = attachment.path
         if not os.path.exists(filename): # fallback

Attachments (0)

Change History (1)

comment:1 Changed 12 months ago by rjollos

Which version of Trac are you running?

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.