load_site.py: patch1 draft
Hello! I want to discuss my first patch to load_site.py. The very gzipped file attached. I've included entire file, not only diff. Look for "phd" and "/phd" comments - all my modifications are between them. I have a plan to patch load_site to my needs, but I think my needs are general enough to be interesting for others. I want to here from you. Anyone interested to comment? My first patch is simple. Instead of putting entire HTML file as DTML Document I parse the file. I parse <TITLE></TITLE> and store title separately; I remove <HEAD></HEAD> completely and replace it with <!--#var standard_html_header-->. In the very upload_html I put extracted title as Document's title. It's all for now, very simple, and implementation is very simple too. I use SGMLParser because HTMLParser is doing too many things - I don't need such much :) I've debugged the program and downloaded my homepage (http://sun.med.ru/~phd/) to Zope - http://sun.med.ru/~zphd/ Next thing to do will be to strip off </BODY> and replace it with standard_html_footer. This would be very simple. But next thing would not be so simple. I want to parse META tags, put them into properties (I do not see any better place) and will construct special version of standard_html_header that will loop over properties reconstructing <HEAD> with META tags. Question. How can I loop over properties? BTW, I added comment "modified by Broytmann" to the load_site.py, not sure how good it goes with License. In any case I'll be glad to see all source files filled with CVS history logs, with full names of authors and contributors. Isn't it good to see "Initially created by Jim Fulton; modified by Brian Lloyd"? :) Oleg. ---- Oleg Broytmann http://members.xoom.com/phd2/ phd2@earthling.net Programmers don't die, they just GOSUB without RETURN.
On Sun, 3 Oct 1999, Oleg Broytmann wrote: [snip]
But next thing would not be so simple. I want to parse META tags, put them into properties (I do not see any better place) and will construct special version of standard_html_header that will loop over properties reconstructing <HEAD> with META tags. Question. How can I loop over properties?
Hi! You may wish to use the XMLWidgets+XMLDocument Products as these provide what you are after (and mine when I update it ;). Basically, you can upload an XHTML file (or HTML file with a little work) and then use the ZDOM methods to query it. Check out: lib/python/ZDOM.py -- Superclass for the Zope Document Object Model lib/python/Products/XMLDocument/Node.py -- XML DOM methods For example, to get the properties of a tag: x = getElementByTagName('body')[0].getAttributes() for a in x: name = getName() value = getValue() Cheers, Anthony Pfrunder
Hi! Thanks, will try it... On Mon, 4 Oct 1999, Anthony Pfrunder wrote:
You may wish to use the XMLWidgets+XMLDocument Products as these provide what you are after (and mine when I update it ;). Basically, you can upload an XHTML file (or HTML file with a little work) and then use the ZDOM methods to query it. Check out:
lib/python/ZDOM.py -- Superclass for the Zope Document Object Model lib/python/Products/XMLDocument/Node.py -- XML DOM methods
For example, to get the properties of a tag:
x = getElementByTagName('body')[0].getAttributes() for a in x: name = getName() value = getValue()
Cheers,
Anthony Pfrunder
Oleg. ---- Oleg Broytmann National Research Surgery Centre http://sun.med.ru/~phd/ Programmers don't die, they just GOSUB without RETURN.
participants (2)
-
Anthony Pfrunder -
Oleg Broytmann