Modify

Opened 11 years ago

Last modified 11 years ago

#11122 new enhancement

problems with DiaVisView Images

Reported by: anonymous Owned by: Aurélien Bompard
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 11 years ago by Ryan J Ollos

Which version of Trac are you running?

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Aurélien Bompard.

Add Comment


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

 
Note: See TracTickets for help on using tickets.