Training, Open Source computer languages

This is page http://www.wellho.net/forum/Programm ... -Ruby/Building-sites-with-Zope-and-Python.html

Our email: info@wellho.net • Phone: 01144 1225 708225

 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Building sites with Zope and Python

Posted by keir (keir), 17 December 2004
Hello,

I've got knowledge of DTML and ZPT in Zope...and I've knowlegde of Python.

But I've no idea how to bring these two together, so I can code with both Python and ZPT/DTML.

Coming from a PHP background, I'd like to have all of my programming and conditions etc at the head of a page, and the majority of the page design code at the latter.

At present, the code used on our site involves pages littered with ZPT and DTML in random and unmanageable chunks. I hate this because maintainence is a nightmare.

I've had very little luck at finding some "good coding practice" of Zope and Python on the net.

Any suggestions of a "way in" to coding in this way would be greatly welcomed.

Thanks.

Posted by admin (Graham Ellis), 17 December 2004
Hi, Keir ... I understand what you're asking and totally agree with putting the code largely in one bloack and the HTML largely in another - it does make huge sense for readability.

Alas, though, my Zope is limited at present so I can't give you an answer with any degree of Authority.   I do have several Zope books - they're on a customer site though, and I won't get them back here for nearly a week;  is this a question that I can usefully come back to in the few days before Christmas?

Posted by keir (keir), 18 December 2004
Hi Graham,

Thanks for the reply.

I am aiming to use 2005 as a year for "better coding practice" in several of the languages I use - Zope in particular. So, yes, you can usefully come back to me anytime at all as my learning experience will span 2005 (should I not throw my PC from the top-floor window).

Thanks again, hope to hear from you soon.

Any book recommendations would be greatly appreciated - as I am no stranger to self-teaching skills.

Keir

Posted by dcorking (David Corking), 21 December 2004
Good question.  I have recently been playing around with Zope and Plone.  

Plone 2  http://plone.org/ , like a number of recent Open Source projects built on Zope, uses a great deal of Python, so you could do some learning by poking around in the Plone internals.

But beware!  Plone code is also dotted around a number of objects and folders.

I have read at least one (negative but a little outdated) article that suggests this is the natural way of coding for Zope. http://www.furl.net/item.jsp?id=1411132

Yet Plone has been built by a small distributed team of developers and includes a great deal of code, so they seem to make it work.  Their biggest failing is how difficult it is for a beginner to make a stylesheet to completely change the look of a Plone site (notice how many sites have that distinctive Plone look and feel) and I suspect the underlying cause is the style of coding.

So in summary, looking at Plone may give you some clues to incorporate Python into your project.  But I have a feeling it won't help you much with ideas for a separation of style from data from business logic (in the way that Graham advocates with PHP and Sun advocate with Java/JSP/struts/JSF).

Enjoy your project!  I liked Plone enough to have prototyped a small site in it that I plan to go live with soon.

Posted by keir (keir), 21 December 2004
Hello David,

Thanks for your response. As a matter of fact, we use Plone to manage our website (of some 3,000 pages) so I do rate this CMS.

However, the use of inheritance of objects and containers is a tad hard to fully grasp. I am certain and aware of it's power but imagine my irritation when trying to track down a stylesheet attribute to find that some pages were using a crazy combination of a stylesheet file within the directory and another stylesheet attached as an 'object'.

Again, the main problem is this lack of "best practice" documentation.

My other problem is I am aware you can use DTML in DTML methods and documents (although I am at a loss to the difference between the two). I am also aware you can use both ZPT and DTML in a Page Template...

Now I realise you can have a python file contain python script, but I have only ever seen examples of python files that contain all code and design - so Plone is rendered partly defunct because templates cannot be used.

I also find it irritating that you HAVE to use a tag for all ZPT commands (e.g. <div> or <span>) because when I need to include conditionals, I often screw up page layout with an extra <div> tag that's soul purpose it just a condition. More importantly, this can also mean your page will not validate or be accessible because of the extra tags that ZPT creates...,

Basically, I suppose, I would like to take full advantage of ZPT for the main design and layout, and Python for everything else.

I continue to search for some good tutorials on combining Plone, ZPT and Python to make pages where design, content and programming sit in three different files...

P.S One thing that occured to me is to use a 'Wellho' technique of using a python script to gather data, then open and edit a html file with the content, to then serve that html file as if no server side scripting ever happened...

All ideas welcome - for a while too as this is the project of 2005, I have decided!

Posted by dcorking (David Corking), 22 December 2004
Hi Keir - you made some interesting points so I won't apologise for the long response.
on 12/21/04 at 14:39:49, keir wrote:
we use Plone to manage our website (of some 3,000 pages) so I do rate this CMS.
If you mean the Bristol Uni Careers Service - congratulations - a great web site, and none of the distinctive Plone look.
Quote:
However, the use of inheritance of objects and containers is a tad hard to fully grasp. I am certain and aware of it's power but imagine my irritation when trying to track down a stylesheet attribute to find that some pages were using a crazy combination of a stylesheet file within the directory and another stylesheet attached as an 'object'.
When you say 'attached' you mean inherited from an outer folder, don't you?  This is the way Plone is designed throughout, as far as I saw so far, but it does not mean it is 'the right way to do it'.   The disadvantage you mention seems to irritate many on blogs and forums, and certainly slowed me down learning Plone.
Quote:
My other problem is I am aware you can use DTML in DTML methods and documents (although I am at a loss to the difference between the two). I am also aware you can use both ZPT and DTML in a Page Template...
Isn't DTML deprecated, to be eventually replaced by ZPT (Zope Page Templates) ?
Quote:
More importantly, this can also mean your page will not validate or be accessible because of the extra tags that ZPT creates...,
Oh dear - I was not aware of that - I have a lot to learn.
Quote:
I continue to search for some good tutorials on combining Plone, ZPT and Python to make pages where design, content and programming sit in three different files...
sounds like you might be the person to write the tutorial!
Quote:
this is the project of 2005, I have decided!
I will be following your work with interest.
David

Posted by keir (keir), 22 December 2004
Thanks again for your response. I'm both sad and glad that there seems to be a consistency of these problems. I hoped that I was just going about things the wrong way and that there were simple answers - but alas seems like there is some anomousity towards aspects of Zope/plone.

However, there ARE still people out there willing to sing Zopes praises, so my hope is I can learn to love this system - I have to because it's what I work with and that's not going to change for a long while.

I will continue to bring my thoughts, experiences and questions here throughout the adventure...

Posted by keir (keir), 22 December 2004
Quick question, is it DTML you think is deprecated or DHTML? As they are certainly very different things. I hope it is DTML, because I hate having the choice, I'd rather be forced to stick to one...

Also, I welcome other's experiences here too.

Merry Christmas.

Posted by dcorking (David Corking), 24 December 2004
on 12/22/04 at 15:57:03, keir wrote:
Quick question, is it DTML you think is deprecated or DHTML?

Quick answer :- DTML*  (not DHTML).

I googled for a definitive reference but I could not find one quickly.  So I am not sure if DTML has merely been deprecated by the Plone folks, or overall by Zope Corporation and the Zope community. For more speculation see the first footnote  Nevertheless there is a push within the Zope community to use ZPT* instead of DTML.

By DHTML* I assume you mean a combination of scripting, HTML and CSS.   I don't think it is in the power of any one group to deprecate DHTML so I wouldn't worry

Merry Christmas to all!

* DTML - Document Template Markup Language of Zopehttp://zope.org/Documentation/Books/ZopeBook/2_6Edition/DTML.stx
* DHTML - Dynamic HTML - Dynamic Hypertext Markup Languagehttp://lists.w3.org/Archives/Public/www-html/1998Dec/0026.html
* ZPT - Zope Page Templates http://zope.org/Documentation/Books/ZopeBook/2_6Edition/ZPT.stx




This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho