Modify

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#12550 closed defect (fixed)

can't find image specified in theme.css

Reported by: galen_liu Owned by: Ryan J Ollos
Priority: high Component: ThemeEnginePlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description (last modified by Ryan J Ollos)

Customize theme: Advanced

with style:

#banner {
 background: url(header-bg2.png);
}

and I put header-bg2.png in my <trac_project>/htdocs/ The ThemeEnginePlugin can't find it.

Fix method:

  • admin.py

     
    9797            return self._send_screenshot(req, data, path_info[11:])
    9898        elif path_info == 'theme.css':
    9999            req.send_file(os.path.join(self.env.path, 'htdocs', 'theme.css'), 'text/css')
    100        
     100        elif path_info.endswith('.png'):
     101            req.send_file(os.path.join(self.env.path, 'htdocs', path_info), 'image/png')
     102        elif path_info.endswith('.jpg'):
     103            req.send_file(os.path.join(self.env.path, 'htdocs', path_info), 'image/jpeg')
     104           
    101105        raise HTTPNotFound("The requested URL was not found on this server")
    102106   
    103107    def _send_screenshot(self, req, data, name):

Attachments (2)

t12550.patch (2.1 KB) - added by Ryan J Ollos 9 years ago.
t12550.1.patch (1.1 KB) - added by Ryan J Ollos 9 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 9 years ago by Ryan J Ollos

Description: modified (diff)
Summary: can't find iamge specified in theme.csscan't find image specified in theme.css

Changed 9 years ago by Ryan J Ollos

Attachment: t12550.patch added

comment:2 Changed 9 years ago by Ryan J Ollos

Owner: changed from Olemis Lang to Ryan J Ollos
Status: newaccepted

A workaround is to use ../chrome/site/header-bg2.png.

Since theme.css is located in the environment htdocs directory, we could just let Trac serve the file from the path /chrome/site/theme.css. That change would allow you to use url(header-bg2.png) in theme.css.

Proposed changes in attachment:t12550.patch.

comment:3 Changed 9 years ago by Ryan J Ollos

In 15011:

2.2.2dev: Extract local variable.

Refs #12550.

Changed 9 years ago by Ryan J Ollos

Attachment: t12550.1.patch added

comment:4 Changed 9 years ago by Ryan J Ollos

Simplified patch in attachment:t12550.1.patch. The refactoring portion of attachment:t12550.patch was committed in [15011].

comment:5 Changed 9 years ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

In 15025:

2.2.2dev: Let Trac serve theme.css

Fixes #12550.

comment:6 Changed 9 years ago by Ryan J Ollos

If you can confirm that it's working well for you, I will create a tag for release 2.2.2.

comment:7 Changed 9 years ago by Ryan J Ollos

In 15029:

2.2.2: Tag release 2.2.2

Refs #12549, #12550.

comment:8 Changed 9 years ago by Ryan J Ollos

Release 2.2.2 can be found on PyPI.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.