RE: [Twisted-Python] Woven, using microdom.lmx, and trying to use style sheets
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@goldenspud.com] Sent: Wednesday, October 29, 2003 12:29 PM To: twisted-python@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@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
On Oct 29, 2003, at 6:37 PM, Hegedus, Matthew S wrote:
t = d.table(_class='exerciseTableClass') t.tr(_class='tableHeadingClass')
t.td().text(data.label1) t.td().text(data.label2)
Your table is borken. It will render like this <table class="excerciseTableClass"> <tr class="tableHeadingClass" /> <td>whatever label 1 was</td> <td>whatever label 2 was</td> </table> Notice you're not actually putting the td nodes inside the row. You want your code to save the return value from the call to tr (the tr node) and put the tds inside that: t = d.table(_class="exerciseTableClass") tr = t.tr(_class="tableHeadingClass") tr.td().text(data.label1) tr.td().text(data.label2) dp
participants (2)
-
Donovan Preston -
Hegedus, Matthew S