durusmail: quixote-users: DOMish view of HTML as it's being rendered
ZODB FileStorage problem
2002-02-27
2002-02-28
2002-02-28
2002-03-01
DOMish view of HTML as it's being rendered
2002-02-28
2002-03-01
2002-03-01
2002-03-01
2002-03-01
2002-03-01
2002-03-01
2002-03-01
2002-03-01
2002-03-01
2002-03-01
2002-03-01
DOMish view of HTML as it's being rendered
Quinn Dunkan
2002-03-01
> Here's another question that's straight on for Quixote.
>
> I've found that at times I need to do a fair bit of reorganizing of my
> code in order to, e.g., get the right things in the , while I'm
> actually deep in the body of the .  Given the very "sequential"
> nature of "HTML accretion" in Quixote, that can be a little tricky.

It's easy to apply ad hoc solutions for something like that.  I have many
templates that look like:

foo = []
bar = blah()
foo.append(stuff)
...

foo = ''.join(foo)
'''
 blah blah
%(foo)s
%(bar)s
''' % locals()

i.e. all the usual python tricks.  It often seems clearer to have all the
fancy formatting stuff up above and render the page in bigger chunks.

> response.getElement('table1').getChild('header_row').insertChild('Percent
> ages')
>
> ?
>
> I realize that there are lots of technical challenges involved in doing
> DOMish things on an as-yet ill-formed document.  At this point I'm just
> trying to figure out if my wishes seem bizarre to the rest of you.

If you want to do something like do "random access" editing on a table, you
could write a class like:

class Html_table:
    def add_cell(self, row, col, text):
    def __getitem__(self, (row, col)):
    def to_html(self):

etc.

I've never felt the need, but it seems easy if you just create the classes for
the html you actually need and don't try to fit the entire "spec" into a giant
master plan.

Actually, I'm sure one of those html generating python modules out there does
that sort of thing.  You could save yourself some time and hunt down one of
them.

One thing like about quixote is that it's easy to use a plain python solution
rather than a quixote specific one.


reply