[Twisted-Python] Woven, using microdom.lmx, and trying to use style sheets

Hegedus, Matthew S matthew.s.hegedus at lmco.com
Wed Oct 29 18:37:05 EST 2003


Setting color through microdom.lmx just doesn't seem to be working for me. I
can view the source of the web page xhtml generated (browser right-click,
view source), and everything looks good, but I just don't see the browser
actually rendering page features in the color I specified. All of the lmx
generated xhtml is literally rendered black and white. I am using style
sheets. Do I need to do some sort of rerender trick?

<UPDATE before I send this out: It appears NONE of the style sheet stuff has
any effect on the look of the web page when implemented using microdom.lmx.>

To clarify, I receive no errors and from the looks of things the xhtml code
generated by lmx seems legit. Here is the key snippets of code(hopefully
formatting will remain intact):

XHTML template:

<html>
   <head>
      <style type="text/css">
         table.exerciseTableClass {border: 0; cellspacing: 2;}
         table.exerciseTableClass tr.tableHeadingClass {color: white;
background-color: darkslateblue;}
      </style>
   </head>
   <body>
      <h1 ~some stuff~></h1>
      <table model="amodel"
             view="aview">
      </table>
   </body>
</html>
   
Python code:

...
   def wvupdate_aview(sel, request, node, data):
       lmxnode = lmx(node)
       d = lmxnode.div()

       #These next two lines don't seem to do anything in terms of style.
       #It's as if I just made a plain-old table, and a couple of plain-old
rows
       t = d.table(_class='exerciseTableClass')    
       t.tr(_class='tableHeadingClass')

       t.td().text(data.label1)
       t.td().text(data.label2)
       ...

Have any of you run into similar troubles, and if so what did it take to fix
the problem? Thank you,

Matthew

-----Original Message-----
From: Matthew Scott [mailto:twisted at goldenspud.com] 
Sent: Wednesday, October 29, 2003 12:29 PM
To: twisted-python at twistedmatrix.com
Subject: Re: [Twisted-Python] Woven, using microdom.lmx, and trying to use
style sheets


On Wednesday 29 October 2003 11:59 am, Donovan Preston wrote:
> On Oct 29, 2003, at 12:44 PM, Hegedus, Matthew S wrote:
> > I tried t.tr['class'] = "mySpecialTableRowStyleClass" but then I got 
> > bitched at with an "object does not support item assignment". 
> > Thanks,
>
> t.tr(_class="mySpecialTableRowStyleClass")
>
> Since class is a python keyword, the special case of having a leading 
> underscore is used.

I ran into this recently too :)

Just an extra note, the leading underscore is not required when setting the 
class attribute of an existing node:

node = t.tr()
node['class'] = 'mySpecialTableRowStyleClass'

-- 
Matthew Scott
http://goldenspud.com/


_______________________________________________
Twisted-Python mailing list
Twisted-Python at twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python




More information about the Twisted-Python mailing list