Being new to Zope, I would like to minimize my learning curve to some extent. I guess I am a little confused between the uses of TAL, ZPT and Python. Where should one start to learn TAL? or ZPT?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday 30 May 2002 12:44 pm, you wrote:
Being new to Zope, I would like to minimize my learning curve to some extent. I guess I am a little confused between the uses of TAL, ZPT and Python.
Where should one start to learn TAL? or ZPT?
I've got a great book called Zope: Web application construction kit, from SAMS publishing. It's made tons of sense to me and breaks down a lot of the dtml into easily digestible chunks, much better, I think, than the Zope Book. But don't count out the Zope Book, though... Russell - -- Linux -- the OS for the Renaissance Man -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE89mRDAqKGrvVshJQRAlaZAJ93FfmjaqZohvyIw38kQmAVoJbdnQCeJlQX i1JnzwgQa4kPh28vN3NPWK4= =2tUb -----END PGP SIGNATURE-----
Frank Peavy <fpeavy@pop.net> writes:
Being new to Zope, I would like to minimize my learning curve to some extent. I guess I am a little confused between the uses of TAL, ZPT and Python.
Where should one start to learn TAL? or ZPT?
Zope Page Templates use TAL (Template Attribute Language). You can't learn one without the other. I would heartily recommend that you read Chapter 5 (and Chapter 9) of the Zope Book for an overview of how this technology works. http://www.zope.org/Documentation/ZopeBook/ I would strongly suggest taking a bit of static HTML, importing it into Zope as a Page Template and then adding some TAL attributes to add dynamic values. Take a look at the default values of a new ZPT for easy examples of things to try. It's not particularly hard, but it is a bit of a different mindset from other web programming toolkits like PHP that mix the HTML and the business logic into one big gumbo mishmash. Good Luck Jason
Well, if I were you, I would read the ZopeBook doing all the examples. That is 2-4 days of study. After that I would play with the python. Next step is learning *all* about TAL. DTML is very cool, but if I want to use DTML I can call it from my TAL template. Just my 2 pence \Oliver For those about to Zope - I salute you.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Frank Peavy Sent: 30. maj 2002 18:44 To: zope@zope.org Subject: [Zope] How to Learn ZPT or DTML??
Being new to Zope, I would like to minimize my learning curve to some extent. I guess I am a little confused between the uses of TAL, ZPT and Python.
Where should one start to learn TAL? or ZPT?
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
On Thu, May 30, 2002 at 09:44:17AM -0700, Frank Peavy wrote:
Being new to Zope, I would like to minimize my learning curve to some extent. I guess I am a little confused between the uses of TAL, ZPT and Python.
Where should one start to learn TAL? or ZPT?
TAL is part of the whole system referred to as ZPT, which also uses TALES and METAL. For now, it'll be easier for you to just think of it as ZPT. You may have been confusing TAL with DTML which is an older templating system. Following is my quick summary comparing the uses of DTML, ZPT, and Python. I tried to keep it neutral with respect to DTML vs. ZPT which is kind of a hot topic these days. DTML (Dynamic Template Markup Language): the established Zope template language. Used for creating dynamically rendered HTML pages. To learn DTML, try the tutorial that comes with Zope. Pro: * LOTS of example code and docs * stable, probably pretty thoroughly debugged by now * renders pretty quick * You can do a lot with just DTML. Con: * You can do a lot with just DTML - including get yourself in big trouble by making big complex DTML pages that nobody (including you) can understand. * Doesn't play nicely with WYSIWYG editors (dreamweaver et al). * Takes some getting used to (e.g. <dtml-var foo> and <dtml-var "foo()"> are often the same thing, and newbies are often confused about the difference. Things in quotes are implicitly python expressions). ZPT (Zope Page Templates): a newer Zope template language. Also used for creating dynamically rendered HTML pages. To learn ZPT, look at the online version of the Zope Book: http://www.zope.org/Documentation/ZopeBook/ZPT.stx Pro: * valid as XML, so works well with XML tools including WYSIWYG editors. * More explicit: e.g. to call a bit of python code "inline", you use the python: qualifier instead of just quotes. * Allows for "dummy" content so the raw template can be viewed in a browser and show you something representative. * Doesn't allow you to do very complex logic, which encourages you to put logic where it belongs - in python. Con: * renders slower than DTML at the moment. This will probably improve. * More verbose so it takes longer to type a page. * Takes some getting used to (e.g. doing all the work in attribute tags may seem odd because you've probably never seen another system that works that way). Python: A programming language. The language used to implement Zope and to create Products and little bits of logic ("Python Scripts" and "External Methods"). It's commonly agreed by Zope developers that *any* logic that isn't totally trivial should be done in python, whether that's in a Python Script, an External Method, or a Product. To learn Python, there are many options; I suggest "How to Think like a Computer Scientist", a very newbie-friendly document at http://www.ibiblio.org/obp/thinkCSpy/ Pro: * Probably one of the easiest programming languages to learn. * Extremely dynamic and flexible. * You can make Zope do *anything* if you learn python and start digging around in the Zope API. Con: * There is nothing bad about Python. ;-) As for learning them... I'd suggest keeping a bookmark to -- Paul Winkler home: http://www.slinkp.com "Muppet Labs, where the future is made - today!"
Aloha, Be honest now - how many of you saying "python is really easy to learn" or equivalent here recently would have said that when you first started using it? I'm not a newbie to programming, and I find python quite cryptic and confusing, especially all those mysterious underscores and 'self' and 'context' and mandatory indentation and so on and on. And then there's trying to understand and use it in/with Zope. I'm sure it'll get better for me. And, I *sure* am tired of people who already know it well saying over and over again how easy it is...for *them*, 'cause it's not for me. There, I feel much better now. John S. __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com
John Schinnerer wrote:
Be honest now - how many of you saying "python is really easy to learn" or equivalent here recently would have said that when you first started using it?
Me. And most of NIP. On average takes a programmer here about 1/2 day to pick up Python.
I'm not a newbie to programming, and I find python quite cryptic and confusing,
Hmmm... first person I've ever heard describe python as 'cryptic'. Python is really explicit, so cryptic may be the wrong word. Confusion, well, that's in the eye of the beholder ;-)
especially all those mysterious underscores
What's mysterious about them?
and 'self' and
self is pretty simple. It's the current object. Other languages (like C++) use this concept but try to hide the fact its there. Python is pretty explicit about it.
'context'
This is a Zope thing. Zope, contrary to Python, is not explicit, or easy to learn ;-)
and mandatory indentation
Get over it. You'll appreciate this when you come back to maintain some code you haven't seen in six months.
and so on and on.
No please, do go on... I'm interested in all these cryptic and confusing things...
And then there's trying to understand and use it in/with Zope.
Now THAT is a legitimate bitch ;-)
And, I *sure* am tired of people who already know it well saying over and over again how easy it is...for *them*, 'cause it's not for me.
Does that maybe say something about you? (joke ;-) cheers, Chris
John Schinnerer <johnschinnerer@yahoo.com> writes:
I'm sure it'll get better for me.
I come from C/Perl and had problems with Python too - some things that were simple in Perl by using well known idioms had to be expressed very noisy and explicit. Using Python for a year now I shudder when I see some Perl code I made before - not because it's bad code but because it's not easy to understand for a person not using Perl every day. The same _may_ happen with Python but because the number of idioms is much less in Python than in Perl it's more unlikely. Like Chris said - you will be glad for using Python when you have to maintain code written some months ago. Regards, Frank
John Schinnerer wrote:
Aloha,
Be honest now - how many of you saying "python is really easy to learn" or equivalent here recently would have said that when you first started using it?
Me ... certainly!
I'm not a newbie to programming, and I find python quite cryptic and confusing, especially all those mysterious underscores and 'self' and 'context' and mandatory indentation and so on and on. And then there's trying to understand and use it in/with Zope.
The only thing cryptic and confusing here is the Zope part ;-) Zope is a great idea, but rather poorly executed from an architectural pow that is. The code in Zope is mostly well written though. But considdering that this is the first attempt of anybody writing something like this, i believe that it is indeed a very good first attempt. But I believe that the Zope guys has realised that when writing an open source project like this, it is as much about communication as writing software. So the new Zope 3.0 will be more self documenting and easier to integrate with. It will be more like Python. More verbose but more explicit too. I am following the development on the sidelines and it looks great. Meanwhile just keep on using Zope 2.x as most of what you learn there can be used in Zope 3 regards Max M
Be honest now - how many of you saying "python is really easy to learn" or equivalent here recently would have said that when you first started using it?
Not me. I thought the idea of indentation sounded strange but I was keen on getting started with Zope and hence I had to accept the indentation and that stuff.
I'm not a newbie to programming, and I find python quite cryptic and confusing, especially all those mysterious underscores and 'self' and 'context' and mandatory indentation and so on and on. And then there's trying to understand and use it in/with Zope.
syntax wise you'll learn it fully in a couple of hours. Trust me. You'll notice that you picked up this language much quicker than you picked up any language before. Just give it a go and you'll see. _underscores are often overly used in python by developers who don't understand to use it carefully. self. is tricky yes. When you start integrating your python skills into zope be careful because self can there mean two different things: "self" of python OO syntax and "self" of Zope passing a object as first parameter. It'll get very clear after a little while.
I'm sure it'll get better for me.
And, I *sure* am tired of people who already know it well saying over and over again how easy it is...for *them*, 'cause it's not for me.
There, I feel much better now.
John S.
__________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
--- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 2002-05-07
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.361 / Virus Database: 199 - Release Date: 2002-05-07
Peter Bengtsson wrote:
_underscores are often overly used in python by developers who don't understand to use it carefully. self. is tricky yes. When you start integrating your python skills into zope be careful because self can there mean two different things: "self" of python OO syntax and "self" of Zope passing a object as first parameter. It'll get very clear after a little while
Well we can easily turn those two problems into just one: Just use _ insted of self: class underScore: def __init__(_, id, title): _.id = id _.title = title def __str__(_): return _.id + ' ' _.title Voila ... only one confusing issue left in Python regards Max M ;-)
Hello! On Fri, May 31, 2002 at 12:32:22AM -0700, John Schinnerer wrote:
Be honest now - how many of you saying "python is really easy to learn" or equivalent here recently would have said that when you first started using it?
ME!!! :) When I firts tried to learn a scripting language I started with Perl, of course - everyone used it, so why not me? It was a prob^H^H^H^Hnightmare from the very beginning. I could not write even a simple script. A friend of mine recommended to try Python. I installed it - and whoo!!! I started to write scripts the same day. Then I read docs... and since that times I use Python for all my programming needs - and there are many needs, I write command-line tools and filters, daemons and CGI-scripts... I changed job few times, and sometimes they tried to force me to use Perl, but I never managed to pick up Perl properly. And I certainly love Python, I love it more and more every new version. What is especially nice in the Python is Python community - all those mailing lists and newsgroups, the spirit of it. It is very helpful. We are fond of ourlanguage and tools, but we are not mad about it. Ask a perl programmer "what tools and languages can I use for task X besides Perl" and you'll have to find asbestos suite :) Ask python community - and they will give you all kind of answers, including "use Perl, Ruby, Lua..." Funny, right? Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
As someone who used Delphi and VB/ASP daily, as well as commercial experience with PERL, PHP, C++ and Java, I've taken to looking at as many different languages as possible. Other ones I'm familiar with are Scheme, Prolog, TCL and Ruby. Without question Python is the easiest language to learn out of all of these - so much so that for personal projects I no longer use any other language, even though I am forced to use other languages at work. Python has a simplicity in its syntax that makes code immediately readable - the indentation means that you can understand your code months later. The core is kept clean, but there are plenty of standard modules. There are sophisticated data structures to simplify most tasks compared to the likes of Delphi/C++. The documentation/books available are excellent, covering all levels of ability (the ActiveState Python Help Files are much better than the Delphi or VB help files, for example). I agree that self takes a little getting used to, and it's one of the few areas where I prefer, say, Ruby's way of doing things. 'context' is a Zope issue - and, frankly it would be bad programming practice to clutter up the global namespace with all the context attributes, etc, and could cause problems in knowing what you are referring to. Both self (Python quirk) and context (Zope feature) are relatively minor compared to the likes of figuring out compilation problems in Java, implementing robust, complex data structures in C++, or implementing persistence in most languages. So, I think there's some very clear reasons why Python is recommended as a teaching language and considered easy to use by all its proponents. As an aside, if you haven't already, try learning a little more about Python by playing with the Python interpreter outside of Zope. This will help make Python a lot more familiar, and even for Zope work, when working out the correct code for a small loop, or string processing or the like, this can help you to 'play around' to work out the correct code when your script has an error. My 2 cents, David Burton 31/05/2002 08:32:22, John Schinnerer <johnschinnerer@yahoo.com> wrote:
Aloha,
Be honest now - how many of you saying "python is really easy to learn" or equivalent here recently would have said that when you first started using it?
I'm not a newbie to programming, and I find python quite cryptic and confusing, especially all those mysterious underscores and 'self' and 'context' and mandatory indentation and so on and on. And then there's trying to understand and use it in/with Zope.
I'm sure it'll get better for me.
And, I *sure* am tired of people who already know it well saying over and over again how easy it is...for *them*, 'cause it's not for me.
There, I feel much better now.
John S.
__________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
"Into the abyss we stare, hoping that the abyss does not gaze so intently upon us"
[John Schinnerer]
Be honest now - how many of you saying "python is really easy to learn" or equivalent here recently would have said that when you first started using it?
I'm not a newbie to programming, and I find python quite cryptic and confusing, especially all those mysterious underscores and 'self' and 'context' and mandatory indentation and so on and on. And then there's trying to understand and use it in/with Zope.
I found it very easy. Some of those thing you mention are Zope things, not native Python things. Mandatory indentation, of course, is, but I found that delightful (of course, you do have to be careful about mixing and matching tabs and spaces, that's a small drawback). In non-Zope Python, there are very few times you need to get into underscores, "context" doesn't exist, and "self" is a placeholder meaning roughly the same thing as "this" in some other languages. For me, Python works about the same as I would write pseudocode, so I found it really easy to get started with. More advanced features like lambda expressions and list comprehensions are harder to grasp, but you don't have to use them yourself. Now that's for code you write yourself. If you look at code someone else has written, that gets tricky and fiddles with module dictionaries and default behaviors, I agree that can be hard to understand. But you can do most anything you would want to do in a script without tricky things like that. Cheers, Tom P
participants (13)
-
Chris Withers -
David Burton -
Frank Peavy -
Frank Tegtmeyer -
Jason Earl -
John Schinnerer -
Max M -
Oleg Broytmann -
Oliver Marx -
Paul Winkler -
Peter Bengtsson -
Russell Hires -
Thomas B. Passin