[Twisted-web] css File with Nevow
Valentino Volonghi aka Dialtone
dialtone at divmod.com
Thu Nov 17 15:15:01 MST 2005
On Thu, Nov 17, 2005 at 10:10:38PM +0100, dsalvatore at freesurf.fr wrote:
> Hello,
>
> I would like to use an externel xml file linked to a style sheet
>
> <html xmlns:nevow="http://nevow.com/ns/nevow/0.1">
> <head>
> <link rel="stylesheet" href="style.css" type="text/css" />
> </head>
> .......
>
> The problem is that the syle sheet is not teken in account.
> Could someone tell me how to proceed ?
you have to manually export the file to the Nevow object tree.
from nevow import rend, static
class MyPage(rend.Page):
child_css = static.File('on_filesystem_css_directory/')
This will export the entire content of the on_filesystem_css_directory/ in an
'online' directory named css/ so considering MyPage as the root page (in /)
the css will be in /css/style.css
If you really want stuff like 'style.css' at root level you have 2 choices:
put in the class the dictionary:
class MyPage(rend.Page):
children = { 'style.css':
static.File('on_filesystem_css_directory/cssfile.css')
}
or
class MyPage(rend.Page):
setattr(MyPage, 'child_style.css', static.File('on_file.......'))
HTH
--
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-web/attachments/20051117/8a12e42a/attachment-0001.pgp
More information about the Twisted-web
mailing list