[Zope-dev] CSS file serving

richard@bizarsoftware.com.au richard@bizarsoftware.com.au
Wed, 24 Jan 2001 11:25:22 +1100


This is a multi-part message in MIME format.
--------------486D9AAB44A863B5505DA19C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Dieter Maurer wrote:
> 
> richard@bizarsoftware.com.au writes:
>  > That (or rather Image.File) was where I started. I decided to go with
>  > HTMLFile as a basis so we could have some DTML in the CSS file - but
>  > overrode it so we weren't forced to have the .dtml extension (much happier
>  > web designers that way :)
> 
> Thus, the only thing, you need to do in addition, is to set
> the correct content type.

   Which is pretty much what I did. I've attached the CSSFile class (which
I suppose I should have done in the first place)...

   I'm not sure if this implementation is entirely "correct" - I have no
idea what the func_code stuff is for (though if it's not commented out, the
class breaks) or the __need_name__... but it works well for us :)


     Richard

-- 
Richard Jones
richard@bizarsoftware.com.au
Senior Software Developer, Bizar Software (www.bizarsoftware.com.au)
--------------486D9AAB44A863B5505DA19C
Content-Type: application/octet-stream;
 name="CSSFile.py"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="CSSFile.py"

aW1wb3J0IG9zCmZyb20gQXBwIGltcG9ydCBDb21tb24KaW1wb3J0IERvY3VtZW50VGVtcGxh
dGUsIE1ldGhvZE9iamVjdAppbXBvcnQgR2xvYmFscwoKY2xhc3MgQ1NTRmlsZShEb2N1bWVu
dFRlbXBsYXRlLkhUTUxGaWxlLE1ldGhvZE9iamVjdC5NZXRob2QsKToKICAgICJQZXJzaXN0
ZW50IENTUyBEb2N1bWVudCBUZW1wbGF0ZXMgcmVhZCBmcm9tIGZpbGVzIgoKIyAgICBjbGFz
cyBmdW5jX2NvZGU6IHBhc3MKIyAgICBmdW5jX2NvZGU9ZnVuY19jb2RlKCkKIyAgICBmdW5j
X2NvZGUuY29fdmFybmFtZXM9J3RydWVzZWxmJywgJ3NlbGYnLCAnUkVRVUVTVCcKIyAgICBm
dW5jX2NvZGUuY29fYXJnY291bnQ9MwogICAgX25lZWRfX25hbWVfXz0xCiAgICBfdl9sYXN0
X3JlYWQ9MAoKICAgIGRlZiBfX2luaXRfXyhzZWxmLG5hbWUsX3ByZWZpeD1Ob25lLCAqKmt3
KToKICAgICAgICBpZiBfcHJlZml4IGlzIE5vbmU6IF9wcmVmaXg9U09GVFdBUkVfSE9NRQog
ICAgICAgIGVsaWYgdHlwZShfcHJlZml4KSBpcyBub3QgdHlwZSgnJyk6CiAgICAgICAgICAg
IF9wcmVmaXg9Q29tbW9uLnBhY2thZ2VfaG9tZShfcHJlZml4KQogICAgICAgIGFyZ3M9KHNl
bGYsIG9zLnBhdGguam9pbihfcHJlZml4LCBuYW1lKSkKICAgICAgICBpZiBub3Qga3cuaGFz
X2tleSgnX19uYW1lX18nKToKICAgICAgICAgICAga3dbJ19fbmFtZV9fJ109b3MucGF0aC5z
cGxpdChuYW1lKVstMV0KICAgICAgICBhcHBseShDU1NGaWxlLmluaGVyaXRlZEF0dHJpYnV0
ZSgnX19pbml0X18nKSxhcmdzLGt3KQoKICAgIGRlZiBfY29va19jaGVjayhzZWxmKToKICAg
ICAgICBpZiBHbG9iYWxzLkRldmVsb3BtZW50TW9kZToKICAgICAgICAgICAgX190cmFjZWJh
Y2tfaW5mb19fPXNlbGYucmF3CiAgICAgICAgICAgIHRyeTogICAgbXRpbWU9b3Muc3RhdChz
ZWxmLnJhdylbOF0KICAgICAgICAgICAgZXhjZXB0OiBtdGltZT0wCiAgICAgICAgICAgIGlm
IG10aW1lICE9IHNlbGYuX3ZfbGFzdF9yZWFkOgogICAgICAgICAgICAgICAgc2VsZi5jb29r
KCkKICAgICAgICAgICAgICAgIHNlbGYuX3ZfbGFzdF9yZWFkPW10aW1lCiAgICAgICAgZWxp
ZiBub3QgaGFzYXR0cihzZWxmLCdfdl9jb29rZWQnKToKICAgICAgICAgICAgdHJ5OiBjaGFu
Z2VkPXNlbGYuX19jaGFuZ2VkX18oKQogICAgICAgICAgICBleGNlcHQ6IGNoYW5nZWQ9MQog
ICAgICAgICAgICBzZWxmLmNvb2soKQogICAgICAgICAgICBpZiBub3QgY2hhbmdlZDogc2Vs
Zi5fX2NoYW5nZWRfXygwKQoKICAgIGRlZiBfX2NhbGxfXyhzZWxmLCAqYXJncywgKiprdyk6
CiAgICAgICAgc2VsZi5fY29va19jaGVjaygpCiAgICAgICAgaWYga3cuaGFzX2tleSgnUkVT
UE9OU0UnKToKICAgICAgICAgICAga3dbJ1JFU1BPTlNFJ10uc2V0SGVhZGVyKCdDb250ZW50
LVR5cGUnLCAndGV4dC9jc3MnKQogICAgICAgIHJldHVybiBhcHBseShDU1NGaWxlLmluaGVy
aXRlZEF0dHJpYnV0ZSgnX19jYWxsX18nKSwKICAgICAgICAgICAgICAgICAgICAgKHNlbGYs
KSthcmdzWzE6XSxrdykKCg==

--------------486D9AAB44A863B5505DA19C--