Edgewall Software

Opened 11 years ago

Closed 10 years ago

Last modified 9 years ago

#11129 closed enhancement (fixed)

Handle CSS as text/css type — at Version 5

Reported by: Chris.Nelson@… Owned by: Ryan J Ollos
Priority: normal Milestone: 1.1.2
Component: general Version:
Severity: normal Keywords:
Cc: ethan.jucovy@…, Christian Boos, olemis+trac@… Branch:
Release Notes:
API Changes:

CSS templates are transferred with the proper content type.

Internal Changes:

Description

I have a plugin that implements IRequestHandler and returns CSS from process_request like:

    def process_request(self, req):
	myColors = [
            ('a', '#3a3'),
            ('b', '#fff'),
            ('c', '#ada'),
            ('d', '#888')
	]
...
	return 'myplugin.css', {'myColors': myColors}, 'text/css'

but the CSS doesn't get the correct mime type without patching chrome.py as attached.

Change History (7)

by Chris.Nelson@…, 11 years ago

Attachment: chrome.diff added

Patch to fix mime type of style sheets

comment:1 by ethan.jucovy@…, 11 years ago

Cc: ethan.jucovy@… added

This would be helpful for me too — I also have a plugin that renders CSS from a template using a request handler, which doesn't work properly without this patch.

in reply to:  1 ; comment:2 by Ryan J Ollos, 10 years ago

This seems harmless enough. Any objections?

Replying to ethan.jucovy@…:

This would be helpful for me too — I also have a plugin that renders CSS from a template using a request handler, which doesn't work properly without this patch.

Which plugin? I'd just like to take a look at an example use-case.

in reply to:  2 comment:3 by ethan.jucovy@…, 10 years ago

Replying to rjollos:

Which plugin? I'd just like to take a look at an example use-case.

th:LighterTheme, which currently has a configuration option for the primary font-family. My workaround is to render the template to a string with mimetype text/plain, and then to send the string with content-type text/css using req.send.

comment:4 by Ryan J Ollos, 10 years ago

Milestone: next-dev-1.1.x1.1.2
Owner: set to Ryan J Ollos
Status: newassigned

Thanks. I will use your plugin to do some testing before committing the change.

by Ryan J Ollos, 10 years ago

Attachment: t11129-lightertheme.patch added

Patch for th:LighterTheme

comment:5 by Ryan J Ollos, 10 years ago

API Changes: modified (diff)
Resolution: fixed
Status: assignedclosed

I've attached a patch for the th:LighterTheme that seems to work well after the change to Trac.

Committed to trunk in [12418].

Note: See TracTickets for help on using tickets.